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

Side by Side Diff: third_party/WebKit/Source/wtf/text/StringOperators.h

Issue 2359663002: wtf: Implement StringView specialization of string concatenation. (Closed)
Patch Set: StringImpl::copyChars Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringConcatenate.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 inline StringAppend<const char*, String> operator+(const char* string1, const St ring& string2) 127 inline StringAppend<const char*, String> operator+(const char* string1, const St ring& string2)
128 { 128 {
129 return StringAppend<const char*, String>(string1, string2); 129 return StringAppend<const char*, String>(string1, string2);
130 } 130 }
131 131
132 inline StringAppend<const char*, AtomicString> operator+(const char* string1, co nst AtomicString& string2) 132 inline StringAppend<const char*, AtomicString> operator+(const char* string1, co nst AtomicString& string2)
133 { 133 {
134 return StringAppend<const char*, AtomicString>(string1, string2); 134 return StringAppend<const char*, AtomicString>(string1, string2);
135 } 135 }
136 136
137 inline StringAppend<const char*, StringView> operator+(const char* string1, cons t StringView& string2)
138 {
139 return StringAppend<const char*, StringView>(string1, string2);
140 }
141
137 template<typename U, typename V> 142 template<typename U, typename V>
138 inline StringAppend<const char*, StringAppend<U, V>> operator+(const char* strin g1, const StringAppend<U, V>& string2) 143 inline StringAppend<const char*, StringAppend<U, V>> operator+(const char* strin g1, const StringAppend<U, V>& string2)
139 { 144 {
140 return StringAppend<const char*, StringAppend<U, V>>(string1, string2); 145 return StringAppend<const char*, StringAppend<U, V>>(string1, string2);
141 } 146 }
142 147
143 inline StringAppend<const UChar*, String> operator+(const UChar* string1, const String& string2) 148 inline StringAppend<const UChar*, String> operator+(const UChar* string1, const String& string2)
144 { 149 {
145 return StringAppend<const UChar*, String>(string1, string2); 150 return StringAppend<const UChar*, String>(string1, string2);
146 } 151 }
147 152
148 inline StringAppend<const UChar*, AtomicString> operator+(const UChar* string1, const AtomicString& string2) 153 inline StringAppend<const UChar*, AtomicString> operator+(const UChar* string1, const AtomicString& string2)
149 { 154 {
150 return StringAppend<const UChar*, AtomicString>(string1, string2); 155 return StringAppend<const UChar*, AtomicString>(string1, string2);
151 } 156 }
152 157
158 inline StringAppend<const UChar*, StringView> operator+(const UChar* string1, co nst StringView& string2)
159 {
160 return StringAppend<const UChar*, StringView>(string1, string2);
161 }
162
153 template<typename U, typename V> 163 template<typename U, typename V>
154 inline StringAppend<const UChar*, StringAppend<U, V>> operator+(const UChar* str ing1, const StringAppend<U, V>& string2) 164 inline StringAppend<const UChar*, StringAppend<U, V>> operator+(const UChar* str ing1, const StringAppend<U, V>& string2)
155 { 165 {
156 return StringAppend<const UChar*, StringAppend<U, V>>(string1, string2); 166 return StringAppend<const UChar*, StringAppend<U, V>>(string1, string2);
157 } 167 }
158 168
159 template<typename T> 169 template<typename T>
160 StringAppend<String, T> operator+(const String& string1, T string2) 170 StringAppend<String, T> operator+(const String& string1, T string2)
161 { 171 {
162 return StringAppend<String, T>(string1, string2); 172 return StringAppend<String, T>(string1, string2);
163 } 173 }
164 174
175 template<typename T>
176 StringAppend<AtomicString, T> operator+(const AtomicString& string1, T string2)
177 {
178 return StringAppend<AtomicString, T>(string1, string2);
179 }
180
181 template<typename T>
182 StringAppend<StringView, T> operator+(const StringView& string1, T string2)
183 {
184 return StringAppend<StringView, T>(string1, string2);
185 }
186
165 template<typename U, typename V, typename W> 187 template<typename U, typename V, typename W>
166 StringAppend<StringAppend<U, V>, W> operator+(const StringAppend<U, V>& string1, W string2) 188 StringAppend<StringAppend<U, V>, W> operator+(const StringAppend<U, V>& string1, W string2)
167 { 189 {
168 return StringAppend<StringAppend<U, V>, W>(string1, string2); 190 return StringAppend<StringAppend<U, V>, W>(string1, string2);
169 } 191 }
170 192
171 } // namespace WTF 193 } // namespace WTF
172 194
173 #endif // StringOperators_h 195 #endif // StringOperators_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringConcatenate.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698