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

Side by Side Diff: Source/wtf/text/StringConcatenate.h

Issue 22572005: Remove all uses of the ASCIILiteral class. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rm it from wtf Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/wtf/text/AtomicString.h ('k') | Source/wtf/text/StringOperators.h » ('j') | 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) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 { 261 {
262 StringImpl::copyChars(destination, m_buffer, m_length); 262 StringImpl::copyChars(destination, m_buffer, m_length);
263 } 263 }
264 264
265 private: 265 private:
266 const LChar* m_buffer; 266 const LChar* m_buffer;
267 unsigned m_length; 267 unsigned m_length;
268 }; 268 };
269 269
270 template<> 270 template<>
271 class StringTypeAdapter<ASCIILiteral> {
272 public:
273 StringTypeAdapter<ASCIILiteral>(ASCIILiteral buffer)
274 : m_buffer(reinterpret_cast<const LChar*>(static_cast<const char*>(buffe r)))
275 , m_length(strlen(buffer))
276 {
277 }
278
279 size_t length() { return m_length; }
280
281 bool is8Bit() { return true; }
282
283 void writeTo(LChar* destination)
284 {
285 memcpy(destination, m_buffer, static_cast<size_t>(m_length));
286 }
287
288 void writeTo(UChar* destination)
289 {
290 StringImpl::copyChars(destination, m_buffer, m_length);
291 }
292
293 private:
294 const LChar* m_buffer;
295 unsigned m_length;
296 };
297
298 template<>
299 class StringTypeAdapter<Vector<char> > { 271 class StringTypeAdapter<Vector<char> > {
300 public: 272 public:
301 StringTypeAdapter<Vector<char> >(const Vector<char>& buffer) 273 StringTypeAdapter<Vector<char> >(const Vector<char>& buffer)
302 : m_buffer(buffer) 274 : m_buffer(buffer)
303 { 275 {
304 } 276 }
305 277
306 size_t length() { return m_buffer.size(); } 278 size_t length() { return m_buffer.size(); }
307 279
308 bool is8Bit() { return true; } 280 bool is8Bit() { return true; }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 result += adapter1.length(); 431 result += adapter1.length();
460 adapter2.writeTo(result); 432 adapter2.writeTo(result);
461 433
462 return resultImpl.release(); 434 return resultImpl.release();
463 } 435 }
464 436
465 } // namespace WTF 437 } // namespace WTF
466 438
467 #include "wtf/text/StringOperators.h" 439 #include "wtf/text/StringOperators.h"
468 #endif 440 #endif
OLDNEW
« no previous file with comments | « Source/wtf/text/AtomicString.h ('k') | Source/wtf/text/StringOperators.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698