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

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

Issue 20300002: Fix trailing whitespace in .cpp, .h, and .idl files (ex. Source/core) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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/dtoa/utils.h ('k') | Source/wtf/text/AtomicString.cpp » ('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) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 operator const String&() const { return m_string; } 93 operator const String&() const { return m_string; }
94 const String& string() const { return m_string; }; 94 const String& string() const { return m_string; };
95 95
96 StringImpl* impl() const { return m_string.impl(); } 96 StringImpl* impl() const { return m_string.impl(); }
97 97
98 bool is8Bit() const { return m_string.is8Bit(); } 98 bool is8Bit() const { return m_string.is8Bit(); }
99 const LChar* characters8() const { return m_string.characters8(); } 99 const LChar* characters8() const { return m_string.characters8(); }
100 const UChar* characters16() const { return m_string.characters16(); } 100 const UChar* characters16() const { return m_string.characters16(); }
101 unsigned length() const { return m_string.length(); } 101 unsigned length() const { return m_string.length(); }
102 102
103 UChar operator[](unsigned int i) const { return m_string[i]; } 103 UChar operator[](unsigned int i) const { return m_string[i]; }
104 104
105 bool contains(UChar c) const { return m_string.contains(c); } 105 bool contains(UChar c) const { return m_string.contains(c); }
106 bool contains(const LChar* s, bool caseSensitive = true) const 106 bool contains(const LChar* s, bool caseSensitive = true) const
107 { return m_string.contains(s, caseSensitive); } 107 { return m_string.contains(s, caseSensitive); }
108 bool contains(const String& s, bool caseSensitive = true) const 108 bool contains(const String& s, bool caseSensitive = true) const
109 { return m_string.contains(s, caseSensitive); } 109 { return m_string.contains(s, caseSensitive); }
110 110
111 size_t find(UChar c, size_t start = 0) const { return m_string.find(c, start ); } 111 size_t find(UChar c, size_t start = 0) const { return m_string.find(c, start ); }
112 size_t find(const LChar* s, size_t start = 0, bool caseSentitive = true) con st 112 size_t find(const LChar* s, size_t start = 0, bool caseSentitive = true) con st
113 { return m_string.find(s, start, caseSentitive); } 113 { return m_string.find(s, start, caseSentitive); }
114 size_t find(const String& s, size_t start = 0, bool caseSentitive = true) co nst 114 size_t find(const String& s, size_t start = 0, bool caseSentitive = true) co nst
115 { return m_string.find(s, start, caseSentitive); } 115 { return m_string.find(s, start, caseSentitive); }
116 116
117 bool startsWith(const String& s, bool caseSensitive = true) const 117 bool startsWith(const String& s, bool caseSensitive = true) const
118 { return m_string.startsWith(s, caseSensitive); } 118 { return m_string.startsWith(s, caseSensitive); }
119 bool startsWith(UChar character) const 119 bool startsWith(UChar character) const
120 { return m_string.startsWith(character); } 120 { return m_string.startsWith(character); }
121 template<unsigned matchLength> 121 template<unsigned matchLength>
122 bool startsWith(const char (&prefix)[matchLength], bool caseSensitive = true ) const 122 bool startsWith(const char (&prefix)[matchLength], bool caseSensitive = true ) const
123 { return m_string.startsWith<matchLength>(prefix, caseSensitive); } 123 { return m_string.startsWith<matchLength>(prefix, caseSensitive); }
124 124
125 bool endsWith(const String& s, bool caseSensitive = true) const 125 bool endsWith(const String& s, bool caseSensitive = true) const
126 { return m_string.endsWith(s, caseSensitive); } 126 { return m_string.endsWith(s, caseSensitive); }
127 bool endsWith(UChar character) const 127 bool endsWith(UChar character) const
128 { return m_string.endsWith(character); } 128 { return m_string.endsWith(character); }
129 template<unsigned matchLength> 129 template<unsigned matchLength>
130 bool endsWith(const char (&prefix)[matchLength], bool caseSensitive = true) const 130 bool endsWith(const char (&prefix)[matchLength], bool caseSensitive = true) const
131 { return m_string.endsWith<matchLength>(prefix, caseSensitive); } 131 { return m_string.endsWith<matchLength>(prefix, caseSensitive); }
132 132
133 AtomicString lower() const; 133 AtomicString lower() const;
134 AtomicString upper() const { return AtomicString(impl()->upper()); } 134 AtomicString upper() const { return AtomicString(impl()->upper()); }
135 135
136 int toInt(bool* ok = 0) const { return m_string.toInt(ok); } 136 int toInt(bool* ok = 0) const { return m_string.toInt(ok); }
137 double toDouble(bool* ok = 0) const { return m_string.toDouble(ok); } 137 double toDouble(bool* ok = 0) const { return m_string.toDouble(ok); }
138 float toFloat(bool* ok = 0) const { return m_string.toFloat(ok); } 138 float toFloat(bool* ok = 0) const { return m_string.toFloat(ok); }
139 bool percentage(int& p) const { return m_string.percentage(p); } 139 bool percentage(int& p) const { return m_string.percentage(p); }
140 140
141 bool isNull() const { return m_string.isNull(); } 141 bool isNull() const { return m_string.isNull(); }
142 bool isEmpty() const { return m_string.isEmpty(); } 142 bool isEmpty() const { return m_string.isEmpty(); }
143 143
144 static void remove(StringImpl*); 144 static void remove(StringImpl*);
145 145
146 #if USE(CF) 146 #if USE(CF)
147 AtomicString(CFStringRef s) : m_string(add(s)) { } 147 AtomicString(CFStringRef s) : m_string(add(s)) { }
148 #endif 148 #endif
149 #ifdef __OBJC__ 149 #ifdef __OBJC__
150 AtomicString(NSString* s) : m_string(add((CFStringRef)s)) { } 150 AtomicString(NSString* s) : m_string(add((CFStringRef)s)) { }
151 operator NSString*() const { return m_string; } 151 operator NSString*() const { return m_string; }
152 #endif 152 #endif
153 // AtomicString::fromUTF8 will return a null string if 153 // AtomicString::fromUTF8 will return a null string if
154 // the input data contains invalid UTF-8 sequences. 154 // the input data contains invalid UTF-8 sequences.
155 static AtomicString fromUTF8(const char*, size_t); 155 static AtomicString fromUTF8(const char*, size_t);
156 static AtomicString fromUTF8(const char*); 156 static AtomicString fromUTF8(const char*);
157 157
158 #ifndef NDEBUG 158 #ifndef NDEBUG
159 void show() const; 159 void show() const;
160 #endif 160 #endif
161 161
162 private: 162 private:
163 // The explicit constructors with AtomicString::ConstructFromLiteral must be used for literals. 163 // The explicit constructors with AtomicString::ConstructFromLiteral must be used for literals.
164 AtomicString(ASCIILiteral); 164 AtomicString(ASCIILiteral);
165 165
166 String m_string; 166 String m_string;
167 167
168 static PassRefPtr<StringImpl> add(const LChar*); 168 static PassRefPtr<StringImpl> add(const LChar*);
169 ALWAYS_INLINE static PassRefPtr<StringImpl> add(const char* s) { return add( reinterpret_cast<const LChar*>(s)); }; 169 ALWAYS_INLINE static PassRefPtr<StringImpl> add(const char* s) { return add( reinterpret_cast<const LChar*>(s)); };
170 static PassRefPtr<StringImpl> add(const LChar*, unsigned length); 170 static PassRefPtr<StringImpl> add(const LChar*, unsigned length);
171 static PassRefPtr<StringImpl> add(const UChar*, unsigned length); 171 static PassRefPtr<StringImpl> add(const UChar*, unsigned length);
172 ALWAYS_INLINE static PassRefPtr<StringImpl> add(const char* s, unsigned leng th) { return add(reinterpret_cast<const LChar*>(s), length); }; 172 ALWAYS_INLINE static PassRefPtr<StringImpl> add(const char* s, unsigned leng th) { return add(reinterpret_cast<const LChar*>(s), length); };
173 static PassRefPtr<StringImpl> add(const UChar*, unsigned length, unsigned ex istingHash); 173 static PassRefPtr<StringImpl> add(const UChar*, unsigned length, unsigned ex istingHash);
174 static PassRefPtr<StringImpl> add(const UChar*); 174 static PassRefPtr<StringImpl> add(const UChar*);
175 static PassRefPtr<StringImpl> add(StringImpl*, unsigned offset, unsigned len gth); 175 static PassRefPtr<StringImpl> add(StringImpl*, unsigned offset, unsigned len gth);
176 ALWAYS_INLINE static PassRefPtr<StringImpl> add(StringImpl* r) 176 ALWAYS_INLINE static PassRefPtr<StringImpl> add(StringImpl* r)
177 { 177 {
178 if (!r || r->isAtomic()) 178 if (!r || r->isAtomic())
179 return r; 179 return r;
180 return addSlowCase(r); 180 return addSlowCase(r);
181 } 181 }
182 static PassRefPtr<StringImpl> addFromLiteralData(const char* characters, uns igned length); 182 static PassRefPtr<StringImpl> addFromLiteralData(const char* characters, uns igned length);
183 static PassRefPtr<StringImpl> addSlowCase(StringImpl*); 183 static PassRefPtr<StringImpl> addSlowCase(StringImpl*);
184 #if USE(CF) 184 #if USE(CF)
185 static PassRefPtr<StringImpl> add(CFStringRef); 185 static PassRefPtr<StringImpl> add(CFStringRef);
186 #endif 186 #endif
187 187
188 static AtomicString fromUTF8Internal(const char*, const char*); 188 static AtomicString fromUTF8Internal(const char*, const char*);
189 }; 189 };
190 190
191 inline bool operator==(const AtomicString& a, const AtomicString& b) { return a. impl() == b.impl(); } 191 inline bool operator==(const AtomicString& a, const AtomicString& b) { return a. impl() == b.impl(); }
192 WTF_EXPORT bool operator==(const AtomicString&, const LChar*); 192 WTF_EXPORT bool operator==(const AtomicString&, const LChar*);
193 inline bool operator==(const AtomicString& a, const char* b) { return WTF::equal (a.impl(), reinterpret_cast<const LChar*>(b)); } 193 inline bool operator==(const AtomicString& a, const char* b) { return WTF::equal (a.impl(), reinterpret_cast<const LChar*>(b)); }
194 inline bool operator==(const AtomicString& a, const Vector<UChar>& b) { return a .impl() && equal(a.impl(), b.data(), b.size()); } 194 inline bool operator==(const AtomicString& a, const Vector<UChar>& b) { return a .impl() && equal(a.impl(), b.data(), b.size()); }
195 inline bool operator==(const AtomicString& a, const String& b) { return equal(a. impl(), b.impl()); } 195 inline bool operator==(const AtomicString& a, const String& b) { return equal(a. impl(), b.impl()); }
196 inline bool operator==(const LChar* a, const AtomicString& b) { return b == a; } 196 inline bool operator==(const LChar* a, const AtomicString& b) { return b == a; }
197 inline bool operator==(const String& a, const AtomicString& b) { return equal(a. impl(), b.impl()); } 197 inline bool operator==(const String& a, const AtomicString& b) { return equal(a. impl(), b.impl()); }
198 inline bool operator==(const Vector<UChar>& a, const AtomicString& b) { return b == a; } 198 inline bool operator==(const Vector<UChar>& a, const AtomicString& b) { return b == a; }
199 199
200 inline bool operator!=(const AtomicString& a, const AtomicString& b) { return a. impl() != b.impl(); } 200 inline bool operator!=(const AtomicString& a, const AtomicString& b) { return a. impl() != b.impl(); }
201 inline bool operator!=(const AtomicString& a, const LChar* b) { return !(a == b) ; } 201 inline bool operator!=(const AtomicString& a, const LChar* b) { return !(a == b) ; }
202 inline bool operator!=(const AtomicString& a, const char* b) { return !(a == b); } 202 inline bool operator!=(const AtomicString& a, const char* b) { return !(a == b); }
203 inline bool operator!=(const AtomicString& a, const String& b) { return !equal(a .impl(), b.impl()); } 203 inline bool operator!=(const AtomicString& a, const String& b) { return !equal(a .impl(), b.impl()); }
204 inline bool operator!=(const AtomicString& a, const Vector<UChar>& b) { return ! (a == b); } 204 inline bool operator!=(const AtomicString& a, const Vector<UChar>& b) { return ! (a == b); }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 using WTF::textAtom; 260 using WTF::textAtom;
261 using WTF::commentAtom; 261 using WTF::commentAtom;
262 using WTF::starAtom; 262 using WTF::starAtom;
263 using WTF::xmlAtom; 263 using WTF::xmlAtom;
264 using WTF::xmlnsAtom; 264 using WTF::xmlnsAtom;
265 using WTF::xlinkAtom; 265 using WTF::xlinkAtom;
266 #endif 266 #endif
267 267
268 #include "wtf/text/StringConcatenate.h" 268 #include "wtf/text/StringConcatenate.h"
269 #endif // AtomicString_h 269 #endif // AtomicString_h
OLDNEW
« no previous file with comments | « Source/wtf/dtoa/utils.h ('k') | Source/wtf/text/AtomicString.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698