mirror of https://github.com/odrling/Aegisub
Make VariableData uncopyable but moveable
This commit is contained in:
parent
482d31299b
commit
851f7f40e6
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -47,6 +47,12 @@ VariableData::VariableData() {
|
|||
value = nullptr;
|
||||
}
|
||||
|
||||
VariableData::VariableData(VariableData&& o)
|
||||
: type(o.type)
|
||||
, value(o.value)
|
||||
{
|
||||
}
|
||||
|
||||
VariableData::~VariableData() {
|
||||
DeleteValue();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
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; }
|
||||
|
|
Loading…
Reference in New Issue