Drop AssOverrideParameter::omitted since it's equivalent to the type being VARDATA_NONE

This commit is contained in:
Thomas Goyne 2012-12-09 10:36:13 -08:00
parent d2a0a76ca9
commit 8cf47c38b6
5 changed files with 5 additions and 14 deletions

View file

@ -52,14 +52,12 @@ using namespace boost::adaptors;
AssOverrideParameter::AssOverrideParameter() AssOverrideParameter::AssOverrideParameter()
: classification(PARCLASS_NORMAL) : classification(PARCLASS_NORMAL)
, omitted(false)
{ {
} }
AssOverrideParameter::AssOverrideParameter(AssOverrideParameter&& o) AssOverrideParameter::AssOverrideParameter(AssOverrideParameter&& o)
: VariableData(std::move(o)) : VariableData(std::move(o))
, classification(o.classification) , classification(o.classification)
, omitted(o.omitted)
{ {
} }
@ -101,7 +99,7 @@ wxString AssDialogueBlockOverride::GetText() {
void AssDialogueBlockOverride::ProcessParameters(ProcessParametersCallback callback, void *userData) { void AssDialogueBlockOverride::ProcessParameters(ProcessParametersCallback callback, void *userData) {
for (auto tag : Tags) { for (auto tag : Tags) {
for (auto& par : tag->Params) { for (auto& par : tag->Params) {
if (par.GetType() == VARDATA_NONE || par.omitted) continue; if (par.GetType() == VARDATA_NONE) continue;
callback(tag->Name, &par, userData); callback(tag->Name, &par, userData);
@ -366,10 +364,8 @@ void AssOverrideTag::ParseParameters(const wxString &text, AssOverrideTagProto::
newparam->classification = curproto.classification; newparam->classification = curproto.classification;
// Check if it's optional and not present // Check if it's optional and not present
if (!(curproto.optional & parsFlag) || curPar >= totalPars) { if (!(curproto.optional & parsFlag) || curPar >= totalPars)
newparam->omitted = true;
continue; continue;
}
wxString curtok = paramList[curPar++]; wxString curtok = paramList[curPar++];
@ -429,7 +425,7 @@ AssOverrideTag::operator wxString() const {
// Add parameters // Add parameters
result += join(Params result += join(Params
| filtered([](AssOverrideParameter const& p) { return p.GetType() != VARDATA_NONE && !p.omitted; }) | filtered([](AssOverrideParameter const& p) { return p.GetType() != VARDATA_NONE; })
| transformed(param_str), | transformed(param_str),
wxS(",")); wxS(","));

View file

@ -73,9 +73,6 @@ public:
/// Type of parameter /// Type of parameter
AssParameterClass classification; AssParameterClass classification;
/// Is the parameter's value actually given?
bool omitted;
AssOverrideParameter(); AssOverrideParameter();
}; };

View file

@ -248,7 +248,6 @@ void set_tag(AssDialogue *line, boost::ptr_vector<AssDialogueBlock> &blocks, wxS
} }
else { else {
ovr->Tags[i]->Params[0].Set(value); ovr->Tags[i]->Params[0].Set(value);
ovr->Tags[i]->Params[0].omitted = false;
found = true; found = true;
} }
} }

View file

@ -130,7 +130,7 @@ namespace
italic = t->Params[0].Get<bool>(style_italic); italic = t->Params[0].Get<bool>(style_italic);
else if (t->Name == "\\an") else if (t->Name == "\\an")
align = t->Params[0].Get<int>(align); align = t->Params[0].Get<int>(align);
else if (t->Name == "\\a" && !t->Params[0].omitted) else if (t->Name == "\\a" && t->Params[0].GetType() != VARDATA_NONE)
align = AssStyle::SsaToAss(t->Params[0].Get<int>()); align = AssStyle::SsaToAss(t->Params[0].Get<int>());
} }
} }

View file

@ -373,7 +373,6 @@ static param_vec find_tag(boost::ptr_vector<AssDialogueBlock>& blocks, wxString
static Vector2D vec_or_bad(param_vec tag, size_t x_idx, size_t y_idx) { static Vector2D vec_or_bad(param_vec tag, size_t x_idx, size_t y_idx) {
if (!tag || if (!tag ||
tag->size() <= x_idx || tag->size() <= y_idx || tag->size() <= x_idx || tag->size() <= y_idx ||
(*tag)[x_idx].omitted || (*tag)[y_idx].omitted ||
(*tag)[x_idx].GetType() == VARDATA_NONE || (*tag)[y_idx].GetType() == VARDATA_NONE) (*tag)[x_idx].GetType() == VARDATA_NONE || (*tag)[y_idx].GetType() == VARDATA_NONE)
{ {
return Vector2D(); return Vector2D();
@ -402,7 +401,7 @@ Vector2D VisualToolBase::GetLinePosition(AssDialogue *diag) {
param_vec align_tag; param_vec align_tag;
int ovr_align = 0; int ovr_align = 0;
if ((align_tag = find_tag(blocks, "\\an")) && !(*align_tag)[0].omitted) if ((align_tag = find_tag(blocks, "\\an")) && (*align_tag)[0].GetType() != VARDATA_NONE)
ovr_align = (*align_tag)[0].Get<int>(); ovr_align = (*align_tag)[0].Get<int>();
else if ((align_tag = find_tag(blocks, "\\a"))) else if ((align_tag = find_tag(blocks, "\\a")))
ovr_align = AssStyle::SsaToAss((*align_tag)[0].Get<int>(2)); ovr_align = AssStyle::SsaToAss((*align_tag)[0].Get<int>(2));