summaryrefslogtreecommitdiff
path: root/sc/source/core/data/cellvalue.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-12-05 15:09:12 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-12-06 08:58:27 +0000
commit097d12bd738467765ae9aa0f4129cf3153510241 (patch)
tree0c8e67129bf6bed09e8cb3dfc858b96995559a6d /sc/source/core/data/cellvalue.cxx
parente6928ce494339a74e5e5b1ab1d32af4adcef3e11 (diff)
coverity#1421089 seems to be really reporting missing move ctors/assignments
Change-Id: I434eebac395bbb53a0c586a43568f64ec3fb8448
Diffstat (limited to 'sc/source/core/data/cellvalue.cxx')
-rw-r--r--sc/source/core/data/cellvalue.cxx48
1 files changed, 48 insertions, 0 deletions
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx
index 81c2cdc267b7..abaaad5e8cb6 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -244,6 +244,27 @@ ScCellValue::ScCellValue( const ScCellValue& r ) : meType(r.meType), mfValue(r.m
}
}
+ScCellValue::ScCellValue(ScCellValue&& r)
+ : meType(r.meType)
+ , mfValue(r.mfValue)
+{
+ switch (r.meType)
+ {
+ case CELLTYPE_STRING:
+ mpString = r.mpString;
+ break;
+ case CELLTYPE_EDIT:
+ mpEditText = r.mpEditText;
+ break;
+ case CELLTYPE_FORMULA:
+ mpFormula = r.mpFormula;
+ break;
+ default:
+ ;
+ }
+ r.meType = CELLTYPE_NONE;
+}
+
ScCellValue::~ScCellValue()
{
clear();
@@ -492,6 +513,33 @@ ScCellValue& ScCellValue::operator= ( const ScCellValue& r )
return *this;
}
+ScCellValue& ScCellValue::operator=(ScCellValue&& rCell)
+{
+ clear();
+
+ meType = rCell.meType;
+ mfValue = rCell.mfValue;
+ switch (rCell.meType)
+ {
+ case CELLTYPE_STRING:
+ mpString = rCell.mpString;
+ break;
+ case CELLTYPE_EDIT:
+ mpEditText = rCell.mpEditText;
+ break;
+ case CELLTYPE_FORMULA:
+ mpFormula = rCell.mpFormula;
+ break;
+ default:
+ ;
+ }
+ //we don't need to reset mpString/mpEditText/mpFormula if we
+ //set meType to NONE as the ScCellValue dtor keys off the meType
+ rCell.meType = CELLTYPE_NONE;
+
+ return *this;
+}
+
ScCellValue& ScCellValue::operator= ( const ScRefCellValue& r )
{
ScCellValue aTmp(r);