diff --git a/aegisub/src/ass_override.cpp b/aegisub/src/ass_override.cpp index e83ccff4f..21d239e13 100644 --- a/aegisub/src/ass_override.cpp +++ b/aegisub/src/ass_override.cpp @@ -56,18 +56,13 @@ AssOverrideParameter::AssOverrideParameter() { } -AssOverrideParameter::AssOverrideParameter(const AssOverrideParameter ¶m) -: VariableData(param) -, classification(param.classification) -, omitted(param.omitted) +AssOverrideParameter::AssOverrideParameter(AssOverrideParameter&& o) +: VariableData(std::move(o)) +, classification(o.classification) +, omitted(o.omitted) { } -void AssOverrideParameter::operator=(const AssOverrideParameter ¶m) { - DeleteValue(); - new(this) AssOverrideParameter(param); -} - // From ass_dialogue.h AssDialogueBlockOverride::~AssDialogueBlockOverride() { delete_clear(Tags); @@ -117,7 +112,7 @@ void AssDialogueBlockOverride::ProcessParameters(ProcessParametersCallback callb } } -AssOverrideParamProto::AssOverrideParamProto(VariableDataType type,int opt,AssParameterClass classi) +AssOverrideParamProto::AssOverrideParamProto(VariableDataType type, int opt, AssParameterClass classi) : optional(opt) , type(type) , classification(classi) diff --git a/aegisub/src/ass_override.h b/aegisub/src/ass_override.h index a739a026a..95e9cdc84 100644 --- a/aegisub/src/ass_override.h +++ b/aegisub/src/ass_override.h @@ -68,6 +68,8 @@ enum AssParameterOptional { /// A single parameter to an override tag class AssOverrideParameter : public VariableData { public: + AssOverrideParameter(AssOverrideParameter&&); + /// Type of parameter AssParameterClass classification; @@ -75,8 +77,6 @@ public: bool omitted; AssOverrideParameter(); - AssOverrideParameter(const AssOverrideParameter&); - void operator=(const AssOverrideParameter ¶m); }; /// Prototype of a single override parameter diff --git a/aegisub/src/variable_data.cpp b/aegisub/src/variable_data.cpp index c1873fb03..da2b35d30 100644 --- a/aegisub/src/variable_data.cpp +++ b/aegisub/src/variable_data.cpp @@ -47,6 +47,12 @@ VariableData::VariableData() { value = nullptr; } +VariableData::VariableData(VariableData&& o) +: type(o.type) +, value(o.value) +{ +} + VariableData::~VariableData() { DeleteValue(); } diff --git a/aegisub/src/variable_data.h b/aegisub/src/variable_data.h index ec91da2ce..fcbc9d08f 100644 --- a/aegisub/src/variable_data.h +++ b/aegisub/src/variable_data.h @@ -34,6 +34,8 @@ #pragma once +#include + namespace agi { struct Color; } class wxString; @@ -49,7 +51,7 @@ enum VariableDataType { class AssDialogueBlockOverride; -class VariableData { +class VariableData : private boost::noncopyable { private: union { void *value; @@ -68,6 +70,7 @@ protected: public: VariableData(); + VariableData(VariableData&& o); virtual ~VariableData(); VariableDataType GetType() const { return type; }