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

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

Issue 2007103003: Expand WTF::StringView's API to be more like StringPiece. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove bad assert. Created 4 years, 6 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 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. 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 12 matching lines...) Expand all
23 #define WTFString_h 23 #define WTFString_h
24 24
25 // This file would be called String.h, but that conflicts with <string.h> 25 // This file would be called String.h, but that conflicts with <string.h>
26 // on systems without case-sensitive file systems. 26 // on systems without case-sensitive file systems.
27 27
28 #include "wtf/Allocator.h" 28 #include "wtf/Allocator.h"
29 #include "wtf/HashTableDeletedValueType.h" 29 #include "wtf/HashTableDeletedValueType.h"
30 #include "wtf/WTFExport.h" 30 #include "wtf/WTFExport.h"
31 #include "wtf/text/ASCIIFastPath.h" 31 #include "wtf/text/ASCIIFastPath.h"
32 #include "wtf/text/StringImpl.h" 32 #include "wtf/text/StringImpl.h"
33 #include "wtf/text/StringView.h"
34 #include <algorithm> 33 #include <algorithm>
35 #include <iosfwd> 34 #include <iosfwd>
36 35
37 #ifdef __OBJC__ 36 #ifdef __OBJC__
38 #include <objc/objc.h> 37 #include <objc/objc.h>
39 #endif 38 #endif
40 39
41 namespace WTF { 40 namespace WTF {
42 41
43 class CString; 42 class CString;
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 335
337 void ensure16Bit(); 336 void ensure16Bit();
338 337
339 void truncate(unsigned len); 338 void truncate(unsigned len);
340 void remove(unsigned pos, int len = 1); 339 void remove(unsigned pos, int len = 1);
341 340
342 String substring(unsigned pos, unsigned len = UINT_MAX) const; 341 String substring(unsigned pos, unsigned len = UINT_MAX) const;
343 String left(unsigned len) const { return substring(0, len); } 342 String left(unsigned len) const { return substring(0, len); }
344 String right(unsigned len) const { return substring(length() - len, len); } 343 String right(unsigned len) const { return substring(length() - len, len); }
345 344
346 StringView createView() const { return StringView(impl()); }
347 StringView createView(unsigned offset, unsigned length) const { return Strin gView(impl(), offset, length); }
348
349 // Returns a lowercase/uppercase version of the string 345 // Returns a lowercase/uppercase version of the string
350 String lower() const; 346 String lower() const;
351 String upper() const; 347 String upper() const;
352 348
353 String lower(const AtomicString& localeIdentifier) const; 349 String lower(const AtomicString& localeIdentifier) const;
354 String upper(const AtomicString& localeIdentifier) const; 350 String upper(const AtomicString& localeIdentifier) const;
355 351
356 String stripWhiteSpace() const; 352 String stripWhiteSpace() const;
357 String stripWhiteSpace(IsWhiteSpaceFunctionPtr) const; 353 String stripWhiteSpace(IsWhiteSpaceFunctionPtr) const;
358 String simplifyWhiteSpace(StripBehavior = StripExtraWhiteSpace) const; 354 String simplifyWhiteSpace(StripBehavior = StripExtraWhiteSpace) const;
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 using WTF::charactersToFloat; 705 using WTF::charactersToFloat;
710 using WTF::equal; 706 using WTF::equal;
711 using WTF::equalIgnoringCase; 707 using WTF::equalIgnoringCase;
712 using WTF::find; 708 using WTF::find;
713 using WTF::isAllSpecialCharacters; 709 using WTF::isAllSpecialCharacters;
714 using WTF::isSpaceOrNewline; 710 using WTF::isSpaceOrNewline;
715 using WTF::reverseFind; 711 using WTF::reverseFind;
716 712
717 #include "wtf/text/AtomicString.h" 713 #include "wtf/text/AtomicString.h"
718 #endif // WTFString_h 714 #endif // WTFString_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringViewTest.cpp ('k') | third_party/WebKit/Source/wtf/wtf.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698