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

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);
abarth-chromium 2013/09/03 15:46:40 I wonder if we should use WebLChar here instead of
davidben 2013/09/03 17:58:25 Done. Though it doesn't actually end up doing much
105
106 static WebString fromLatin1(const std::string& s)
107 {
108 return fromLatin1(s.data(), s.length());
109 }
110
102 template <int N> WebString(const char (&data)[N]) 111 template <int N> WebString(const char (&data)[N])
103 { 112 {
104 assign(fromUTF8(data, N - 1)); 113 assign(fromUTF8(data, N - 1));
105 } 114 }
106 115
107 template <int N> WebString& operator=(const char (&data)[N]) 116 template <int N> WebString& operator=(const char (&data)[N])
108 { 117 {
109 assign(fromUTF8(data, N - 1)); 118 assign(fromUTF8(data, N - 1));
110 return *this; 119 return *this;
111 } 120 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 183 }
175 184
176 inline bool operator!=(const WebString& a, const WebString& b) 185 inline bool operator!=(const WebString& a, const WebString& b)
177 { 186 {
178 return !(a == b); 187 return !(a == b);
179 } 188 }
180 189
181 } // namespace WebKit 190 } // namespace WebKit
182 191
183 #endif 192 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698