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

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

Issue 1098203002: Kill CFX_StringBufTemplate. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | core/src/fxcrt/fx_basic_bstring.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 // 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 _FX_STRING_H_ 7 #ifndef _FX_STRING_H_
8 #define _FX_STRING_H_ 8 #define _FX_STRING_H_
9 9
10 #include "fx_memory.h" 10 #include "fx_memory.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 return CFX_ByteString(str1, str2); 421 return CFX_ByteString(str1, str2);
422 } 422 }
423 inline CFX_ByteString operator + (const CFX_ByteString& str1, FX_BSTR str2) 423 inline CFX_ByteString operator + (const CFX_ByteString& str1, FX_BSTR str2)
424 { 424 {
425 return CFX_ByteString(str1, str2); 425 return CFX_ByteString(str1, str2);
426 } 426 }
427 inline CFX_ByteString operator + (FX_BSTR str1, const CFX_ByteString& str2) 427 inline CFX_ByteString operator + (FX_BSTR str1, const CFX_ByteString& str2)
428 { 428 {
429 return CFX_ByteString(str1, str2); 429 return CFX_ByteString(str1, str2);
430 } 430 }
431 class CFX_StringBufBase
432 {
433 public:
434
435 CFX_StringBufBase(FX_STRSIZE limit)
436 {
437 m_Size = 0;
438 m_Limit = limit;
439 }
440
441 FX_CHAR* GetPtr() const
442 {
443 return (FX_CHAR*)(this + 1);
444 }
445
446 FX_STRSIZE GetSize() const
447 {
448 return m_Size;
449 }
450
451 void Empty()
452 {
453 m_Size = 0;
454 }
455
456 void Copy(FX_BSTR str);
457
458 void Append(FX_BSTR str);
459
460 void Append(int i, FX_DWORD flags = 0);
461
462 CFX_ByteStringC GetStringC() const
463 {
464 return CFX_ByteStringC((FX_CHAR*)(this + 1), m_Size);
465 }
466
467 CFX_ByteString GetString() const
468 {
469 return CFX_ByteString((FX_CHAR*)(this + 1), m_Size);
470 }
471 protected:
472
473 FX_STRSIZE m_Limit;
474
475 FX_STRSIZE m_Size;
476 };
477 template<FX_STRSIZE limit>
478 class CFX_StringBufTemplate : public CFX_StringBufBase
479 {
480 public:
481
482 CFX_StringBufTemplate() : CFX_StringBufBase(limit) {}
483
484 FX_CHAR m_Buffer[limit];
485 };
486 typedef CFX_StringBufTemplate<256> CFX_StringBuf256;
487 class CFX_WideStringC 431 class CFX_WideStringC
488 { 432 {
489 public: 433 public:
490 typedef FX_WCHAR value_type; 434 typedef FX_WCHAR value_type;
491 435
492 CFX_WideStringC() 436 CFX_WideStringC()
493 { 437 {
494 m_Ptr = NULL; 438 m_Ptr = NULL;
495 m_Length = 0; 439 m_Length = 0;
496 } 440 }
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); 811 CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len);
868 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) 812 inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr)
869 { 813 {
870 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); 814 return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength());
871 } 815 }
872 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr) 816 inline CFX_ByteString FX_UTF8Encode(const CFX_WideString &wsStr)
873 { 817 {
874 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); 818 return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength());
875 } 819 }
876 #endif 820 #endif
OLDNEW
« no previous file with comments | « no previous file | core/src/fxcrt/fx_basic_bstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698