Kaydet (Commit) 097d12bd authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1421089 seems to be really reporting missing move ctors/assignments

Change-Id: I434eebac395bbb53a0c586a43568f64ec3fb8448
üst e6928ce4
...@@ -44,6 +44,7 @@ struct SC_DLLPUBLIC ScCellValue ...@@ -44,6 +44,7 @@ struct SC_DLLPUBLIC ScCellValue
ScCellValue( double fValue ); ScCellValue( double fValue );
ScCellValue( const svl::SharedString& rString ); ScCellValue( const svl::SharedString& rString );
ScCellValue( const ScCellValue& r ); ScCellValue( const ScCellValue& r );
ScCellValue( ScCellValue&& r );
~ScCellValue(); ~ScCellValue();
void clear(); void clear();
...@@ -84,6 +85,7 @@ struct SC_DLLPUBLIC ScCellValue ...@@ -84,6 +85,7 @@ struct SC_DLLPUBLIC ScCellValue
bool equalsWithoutFormat( const ScCellValue& r ) const; bool equalsWithoutFormat( const ScCellValue& r ) const;
ScCellValue& operator= ( const ScCellValue& r ); ScCellValue& operator= ( const ScCellValue& r );
ScCellValue& operator= ( ScCellValue&& r );
ScCellValue& operator= ( const ScRefCellValue& r ); ScCellValue& operator= ( const ScRefCellValue& r );
void swap( ScCellValue& r ); void swap( ScCellValue& r );
......
...@@ -244,6 +244,27 @@ ScCellValue::ScCellValue( const ScCellValue& r ) : meType(r.meType), mfValue(r.m ...@@ -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() ScCellValue::~ScCellValue()
{ {
clear(); clear();
...@@ -492,6 +513,33 @@ ScCellValue& ScCellValue::operator= ( const ScCellValue& r ) ...@@ -492,6 +513,33 @@ ScCellValue& ScCellValue::operator= ( const ScCellValue& r )
return *this; 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& ScCellValue::operator= ( const ScRefCellValue& r )
{ {
ScCellValue aTmp(r); ScCellValue aTmp(r);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment