summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-06-05 15:23:50 -0700
committerTom Sepez <tsepez@chromium.org>2015-06-05 15:23:50 -0700
commit9b440b4da2103096ae29dc7ece533128341ea1d5 (patch)
tree8d4ac4323b92cfc44e3c53f87c843dd67b76e28c /core
parent211f90e1bc5d855a2fce3e5f4f6d60d59667894e (diff)
downloadpdfium-9b440b4da2103096ae29dc7ece533128341ea1d5.tar.xz
Add move constructor for FX string types.
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1162203007
Diffstat (limited to 'core')
-rw-r--r--core/include/fxcrt/fx_string.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h
index efbe80accb..9903dad942 100644
--- a/core/include/fxcrt/fx_string.h
+++ b/core/include/fxcrt/fx_string.h
@@ -178,20 +178,22 @@ class CFX_ByteString
public:
typedef FX_CHAR value_type;
- CFX_ByteString()
- {
- m_pData = NULL;
- }
+ CFX_ByteString() : m_pData(nullptr) { }
+ // Copy constructor.
CFX_ByteString(const CFX_ByteString& str);
- CFX_ByteString(char ch);
+ // Move constructor.
+ inline CFX_ByteString(CFX_ByteString&& other) {
+ this->m_pData = other.m_pData;
+ other.m_pData = nullptr;
+ }
+ CFX_ByteString(char ch);
CFX_ByteString(FX_LPCSTR ptr)
: CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) { }
CFX_ByteString(FX_LPCSTR ptr, FX_STRSIZE len);
-
CFX_ByteString(FX_LPCBYTE ptr, FX_STRSIZE len);
CFX_ByteString(FX_BSTR bstrc);
@@ -623,13 +625,17 @@ class CFX_WideString
public:
typedef FX_WCHAR value_type;
- CFX_WideString()
- {
- m_pData = NULL;
- }
+ CFX_WideString() : m_pData(nullptr) { }
+ // Copy constructor.
CFX_WideString(const CFX_WideString& str);
+ // Move constructor.
+ inline CFX_WideString(CFX_WideString&& other) {
+ this->m_pData = other.m_pData;
+ other.m_pData = nullptr;
+ }
+
CFX_WideString(FX_LPCWSTR ptr)
: CFX_WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) { }