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

Side by Side Diff: core/fxcrt/include/fx_string.h

Issue 2060913003: Make code compile with clang_use_chrome_plugin (part II) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase 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
« no previous file with comments | « core/fxcrt/fx_xml_parser.cpp ('k') | core/fxcrt/include/fx_ucd.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 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_FXCRT_INCLUDE_FX_STRING_H_ 7 #ifndef CORE_FXCRT_INCLUDE_FX_STRING_H_
8 #define CORE_FXCRT_INCLUDE_FX_STRING_H_ 8 #define CORE_FXCRT_INCLUDE_FX_STRING_H_
9 9
10 #include <stdint.h> // For intptr_t. 10 #include <stdint.h> // For intptr_t.
(...skipping 16 matching lines...) Expand all
27 ((uint32_t)c4)) 27 ((uint32_t)c4))
28 28
29 #define FX_WSTRC(wstr) CFX_WideStringC(wstr, FX_ArraySize(wstr) - 1) 29 #define FX_WSTRC(wstr) CFX_WideStringC(wstr, FX_ArraySize(wstr) - 1)
30 30
31 // A mutable string with shared buffers using copy-on-write semantics that 31 // A mutable string with shared buffers using copy-on-write semantics that
32 // avoids the cost of std::string's iterator stability guarantees. 32 // avoids the cost of std::string's iterator stability guarantees.
33 class CFX_ByteString { 33 class CFX_ByteString {
34 public: 34 public:
35 using CharType = FX_CHAR; 35 using CharType = FX_CHAR;
36 36
37 CFX_ByteString() {} 37 CFX_ByteString();
38 CFX_ByteString(const CFX_ByteString& other) : m_pData(other.m_pData) {} 38 CFX_ByteString(const CFX_ByteString& other);
39 CFX_ByteString(CFX_ByteString&& other) { m_pData.Swap(other.m_pData); } 39 CFX_ByteString(CFX_ByteString&& other);
40 40
41 // Deliberately implicit to avoid calling on every string literal. 41 // Deliberately implicit to avoid calling on every string literal.
42 CFX_ByteString(char ch); 42 CFX_ByteString(char ch);
43 CFX_ByteString(const FX_CHAR* ptr) 43 CFX_ByteString(const FX_CHAR* ptr);
44 : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {}
45 44
46 CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len); 45 CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len);
47 CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len); 46 CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len);
48 47
49 explicit CFX_ByteString(const CFX_ByteStringC& bstrc); 48 explicit CFX_ByteString(const CFX_ByteStringC& bstrc);
50 CFX_ByteString(const CFX_ByteStringC& bstrc1, const CFX_ByteStringC& bstrc2); 49 CFX_ByteString(const CFX_ByteStringC& bstrc1, const CFX_ByteStringC& bstrc2);
51 50
52 ~CFX_ByteString(); 51 ~CFX_ByteString();
53 52
54 void clear() { m_pData.Reset(); } 53 void clear() { m_pData.Reset(); }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 const CFX_ByteString& str2) { 230 const CFX_ByteString& str2) {
232 return CFX_ByteString(str1, str2.AsStringC()); 231 return CFX_ByteString(str1, str2.AsStringC());
233 } 232 }
234 233
235 // A mutable string with shared buffers using copy-on-write semantics that 234 // A mutable string with shared buffers using copy-on-write semantics that
236 // avoids the cost of std::string's iterator stability guarantees. 235 // avoids the cost of std::string's iterator stability guarantees.
237 class CFX_WideString { 236 class CFX_WideString {
238 public: 237 public:
239 using CharType = FX_WCHAR; 238 using CharType = FX_WCHAR;
240 239
241 CFX_WideString() {} 240 CFX_WideString();
242 CFX_WideString(const CFX_WideString& other) : m_pData(other.m_pData) {} 241 CFX_WideString(const CFX_WideString& other);
243 CFX_WideString(CFX_WideString&& other) { m_pData.Swap(other.m_pData); } 242 CFX_WideString(CFX_WideString&& other);
244 243
245 // Deliberately implicit to avoid calling on every string literal. 244 // Deliberately implicit to avoid calling on every string literal.
246 CFX_WideString(FX_WCHAR ch); 245 CFX_WideString(FX_WCHAR ch);
247 CFX_WideString(const FX_WCHAR* ptr) 246 CFX_WideString(const FX_WCHAR* ptr);
248 : CFX_WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) {}
249 247
250 CFX_WideString(const FX_WCHAR* ptr, FX_STRSIZE len); 248 CFX_WideString(const FX_WCHAR* ptr, FX_STRSIZE len);
251 249
252 explicit CFX_WideString(const CFX_WideStringC& str); 250 explicit CFX_WideString(const CFX_WideStringC& str);
253 CFX_WideString(const CFX_WideStringC& str1, const CFX_WideStringC& str2); 251 CFX_WideString(const CFX_WideStringC& str1, const CFX_WideStringC& str2);
254 252
255 ~CFX_WideString(); 253 ~CFX_WideString();
256 254
257 static CFX_WideString FromLocal(const CFX_ByteStringC& str); 255 static CFX_WideString FromLocal(const CFX_ByteStringC& str);
258 static CFX_WideString FromCodePage(const CFX_ByteStringC& str, 256 static CFX_WideString FromCodePage(const CFX_ByteStringC& str,
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 } 434 }
437 435
438 FX_FLOAT FX_atof(const CFX_ByteStringC& str); 436 FX_FLOAT FX_atof(const CFX_ByteStringC& str);
439 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { 437 inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) {
440 return FX_atof(FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()).c_str()); 438 return FX_atof(FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()).c_str());
441 } 439 }
442 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); 440 void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData);
443 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); 441 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf);
444 442
445 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_ 443 #endif // CORE_FXCRT_INCLUDE_FX_STRING_H_
OLDNEW
« no previous file with comments | « core/fxcrt/fx_xml_parser.cpp ('k') | core/fxcrt/include/fx_ucd.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698