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

Unified Diff: core/include/fxcrt/fx_string.h

Issue 1099193002: Add missing operators for CFX_WideStringC. (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 side-by-side diff with in-line comments
Download patch
Index: core/include/fxcrt/fx_string.h
diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h
index df7dd0c76241e359af3e367c400d759a9da9c463..66df6c2cc145167d6ed45b21baac9ba72ddec64f 100644
--- a/core/include/fxcrt/fx_string.h
+++ b/core/include/fxcrt/fx_string.h
@@ -7,6 +7,8 @@
#ifndef _FX_STRING_H_
#define _FX_STRING_H_
+#include <algorithm>
+
#include "fx_memory.h"
class CFX_ByteStringC;
@@ -484,7 +486,7 @@ public:
FX_CHAR m_Buffer[limit];
};
typedef CFX_StringBufTemplate<256> CFX_StringBuf256;
-class CFX_WideStringC
+class CFX_WideStringC
{
public:
typedef FX_WCHAR value_type;
@@ -606,13 +608,23 @@ public:
}
return CFX_WideStringC(m_Ptr + m_Length - count, count);
}
-protected:
- FX_LPCWSTR m_Ptr;
+ const FX_WCHAR& operator[] (int index) const
Lei Zhang 2015/04/21 22:07:56 Same as last CL, size_t ?
Tom Sepez 2015/04/22 17:06:45 Done.
+ {
+ return m_Ptr[index];
+ }
+ bool operator< (const CFX_WideStringC& that)
brucedawson 2015/04/22 10:47:12 The operator itself needs to be const.
Tom Sepez 2015/04/22 17:06:45 Done.
+ {
+ int result = wmemcmp(m_Ptr, that.m_Ptr, std::min(m_Length, that.m_Length));
Tom Sepez 2015/04/22 17:06:45 Bruce, you're OK with wmemcmp, right? No windows
+ return result < 0 || (result == 0 && m_Length < that.m_Length);
+ }
+
+protected:
+ FX_LPCWSTR m_Ptr;
FX_STRSIZE m_Length;
-private:
+private:
void* operator new (size_t) throw()
{
return NULL;
« no previous file with comments | « no previous file | core/src/fxcrt/fx_basic_wstring_unittest.cpp » ('j') | core/src/fxcrt/fx_basic_wstring_unittest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698