Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: public/platform/WebString.h

Issue 23456013: Expose latin1 methods in WebString (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 BLINK_COMMON_EXPORT std::string utf8() const; 92 BLINK_COMMON_EXPORT std::string utf8() const;
93 93
94 BLINK_COMMON_EXPORT static WebString fromUTF8(const char* data, size_t lengt h); 94 BLINK_COMMON_EXPORT static WebString fromUTF8(const char* data, size_t lengt h);
95 BLINK_COMMON_EXPORT static WebString fromUTF8(const char* data); 95 BLINK_COMMON_EXPORT static WebString fromUTF8(const char* data);
96 96
97 static WebString fromUTF8(const std::string& s) 97 static WebString fromUTF8(const std::string& s)
98 { 98 {
99 return fromUTF8(s.data(), s.length()); 99 return fromUTF8(s.data(), s.length());
100 } 100 }
101 101
102 BLINK_COMMON_EXPORT std::string latin1() const;
103
104 BLINK_COMMON_EXPORT static WebString fromLatin1(const char* data, size_t len gth);
105 BLINK_COMMON_EXPORT static WebString fromLatin1(const char* data);
106
107 static WebString fromLatin1(const std::string& s)
108 {
109 return fromLatin1(s.data(), s.length());
110 }
111
102 template <int N> WebString(const char (&data)[N]) 112 template <int N> WebString(const char (&data)[N])
103 { 113 {
104 assign(fromUTF8(data, N - 1)); 114 assign(fromUTF8(data, N - 1));
105 } 115 }
106 116
107 template <int N> WebString& operator=(const char (&data)[N]) 117 template <int N> WebString& operator=(const char (&data)[N])
108 { 118 {
109 assign(fromUTF8(data, N - 1)); 119 assign(fromUTF8(data, N - 1));
110 return *this; 120 return *this;
111 } 121 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 184 }
175 185
176 inline bool operator!=(const WebString& a, const WebString& b) 186 inline bool operator!=(const WebString& a, const WebString& b)
177 { 187 {
178 return !(a == b); 188 return !(a == b);
179 } 189 }
180 190
181 } // namespace WebKit 191 } // namespace WebKit
182 192
183 #endif 193 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698