Make ASS tag parsing ~50% faster.

Originally committed to SVN as r4429.
This commit is contained in:
Thomas Goyne 2010-06-04 03:07:58 +00:00
parent f001651865
commit 88f6bca9d7
2 changed files with 290 additions and 390 deletions

View file

@ -34,9 +34,6 @@
/// @ingroup subs_storage /// @ingroup subs_storage
/// ///
////////////
// Includes
#include "config.h" #include "config.h"
#ifndef AGI_PRE #ifndef AGI_PRE
@ -47,24 +44,17 @@
#include "ass_dialogue.h" #include "ass_dialogue.h"
#include "ass_override.h" #include "ass_override.h"
/// @brief Constructor
/// @brief Constructor AssOverrideParameter //////////////////////
///
AssOverrideParameter::AssOverrideParameter () { AssOverrideParameter::AssOverrideParameter () {
classification = PARCLASS_NORMAL; classification = PARCLASS_NORMAL;
ommited = false; ommited = false;
} }
/// @brief Destructor /// @brief Destructor
///
AssOverrideParameter::~AssOverrideParameter () { AssOverrideParameter::~AssOverrideParameter () {
DeleteValue(); DeleteValue();
} }
/// @brief Copy /// @brief Copy
/// @param param /// @param param
/// ///
@ -82,7 +72,6 @@ void AssOverrideParameter::CopyFrom (const AssOverrideParameter &param) {
ommited = param.ommited; ommited = param.ommited;
} }
/// @brief DOCME /// @brief DOCME
/// @param param /// @param param
/// ///
@ -90,17 +79,11 @@ void AssOverrideParameter::operator= (const AssOverrideParameter &param) {
CopyFrom(param); CopyFrom(param);
} }
/// @brief Constructor
/// @brief Constructor AssDialogueBlockOverride //////////////////////
///
AssDialogueBlockOverride::AssDialogueBlockOverride () { AssDialogueBlockOverride::AssDialogueBlockOverride () {
} }
/// @brief Destructor /// @brief Destructor
///
AssDialogueBlockOverride::~AssDialogueBlockOverride () { AssDialogueBlockOverride::~AssDialogueBlockOverride () {
for (size_t i=0;i<Tags.size();i++) { for (size_t i=0;i<Tags.size();i++) {
delete Tags[i]; delete Tags[i];
@ -108,8 +91,6 @@ AssDialogueBlockOverride::~AssDialogueBlockOverride () {
Tags.clear(); Tags.clear();
} }
/// @brief Read tags /// @brief Read tags
/// ///
void AssDialogueBlockOverride::ParseTags () { void AssDialogueBlockOverride::ParseTags () {
@ -151,8 +132,6 @@ void AssDialogueBlockOverride::ParseTags () {
} }
} }
/// @brief Get Text representation /// @brief Get Text representation
/// @return /// @return
/// ///
@ -164,26 +143,20 @@ wxString AssDialogueBlockOverride::GetText () {
return text; return text;
} }
void AssDialogueBlockOverride::ProcessParameters(AssDialogueBlockOverride::ProcessParametersCallback callback,void *userData) { void AssDialogueBlockOverride::ProcessParameters(AssDialogueBlockOverride::ProcessParametersCallback callback,void *userData) {
AssOverrideTag *curTag;
AssOverrideParameter *curPar;
// Find tags
for (std::vector<AssOverrideTag*>::iterator cur=Tags.begin();cur!=Tags.end();cur++) { for (std::vector<AssOverrideTag*>::iterator cur=Tags.begin();cur!=Tags.end();cur++) {
int n = 0; int n = 0;
curTag = *cur; AssOverrideTag *curTag = *cur;
// Find parameters // Find parameters
for (std::vector<AssOverrideParameter*>::iterator curParam=curTag->Params.begin();curParam!=curTag->Params.end();curParam++) { for (std::vector<AssOverrideParameter*>::iterator curParam=curTag->Params.begin();curParam!=curTag->Params.end();curParam++) {
curPar = *curParam; AssOverrideParameter *curPar = *curParam;
if (curPar->GetType() != VARDATA_NONE && curPar->ommited == false) { if (curPar->GetType() != VARDATA_NONE && curPar->ommited == false) {
// Do callback // Do callback
(*callback)(curTag->Name,n,curPar,userData); (*callback)(curTag->Name,n,curPar,userData);
// Go recursive if it's a block parameter // Go recursive if it's a block parameter
//if (curPar->classification == VARDATA_BLOCK) {
if (curPar->GetType() == VARDATA_BLOCK) { if (curPar->GetType() == VARDATA_BLOCK) {
curPar->AsBlock()->ProcessParameters(callback,userData); curPar->AsBlock()->ProcessParameters(callback,userData);
} }
@ -194,9 +167,7 @@ void AssDialogueBlockOverride::ProcessParameters(AssDialogueBlockOverride::Proce
} }
} }
/// @brief Constructor
/// @brief Constructor AssOverrideParamProto //////////////////////////
/// @param _type /// @param _type
/// @param opt /// @param opt
/// @param classi /// @param classi
@ -207,37 +178,24 @@ AssOverrideParamProto::AssOverrideParamProto (VariableDataType _type,int opt,ASS
classification = classi; classification = classi;
} }
/// @brief Destructor /// @brief Destructor
///
AssOverrideParamProto::~AssOverrideParamProto() { AssOverrideParamProto::~AssOverrideParamProto() {
} }
/// DOCME /// DOCME
std::list<AssOverrideTagProto> AssOverrideTagProto::proto; std::vector<AssOverrideTagProto> AssOverrideTagProto::proto;
/// DOCME /// DOCME
bool AssOverrideTagProto::loaded = false; bool AssOverrideTagProto::loaded = false;
/// @brief Constructor /// @brief Constructor
///
AssOverrideTagProto::AssOverrideTagProto() { AssOverrideTagProto::AssOverrideTagProto() {
} }
/// @brief Destructor /// @brief Destructor
///
AssOverrideTagProto::~AssOverrideTagProto() { AssOverrideTagProto::~AssOverrideTagProto() {
} }
/// @brief Load prototypes /// @brief Load prototypes
/// @return /// @return
/// ///
@ -245,377 +203,358 @@ void AssOverrideTagProto::LoadProtos () {
if (loaded) return; if (loaded) return;
loaded = true; loaded = true;
proto.resize(56);
int i = 0;
// Longer tag names must appear before shorter tag names
// \alpha // \alpha
proto.push_back(AssOverrideTagProto()); proto[i].name = _T("\\alpha");
proto.back().name = _T("\\alpha"); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT));
// \bord<depth> // \bord<depth>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\bord"); proto[i].name = _T("\\bord");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
// \xbord<depth> // \xbord<depth>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\xbord"); proto[i].name = _T("\\xbord");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
// \ybord<depth> // \ybord<depth>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\ybord"); proto[i].name = _T("\\ybord");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
// \shad<depth> // \shad<depth>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\shad"); proto[i].name = _T("\\shad");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
// \xshad<depth> // \xshad<depth>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\xshad"); proto[i].name = _T("\\xshad");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
// \yshad<depth> // \yshad<depth>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\yshad"); proto[i].name = _T("\\yshad");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
// \fade(<a1>,<a2>,<a3>,<t1>,<t2>,<t3>,<t4>) // \fade(<a1>,<a2>,<a3>,<t1>,<t2>,<t3>,<t4>)
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\fade"); proto[i].name = _T("\\fade");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_RELATIVE_TIME_START)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_RELATIVE_TIME_START));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_RELATIVE_TIME_START)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_RELATIVE_TIME_START));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_RELATIVE_TIME_START)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_RELATIVE_TIME_START));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_RELATIVE_TIME_START)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_RELATIVE_TIME_START));
// \move(<x1>,<y1>,<x2>,<y2>[,<t1>,<t2>]) // \move(<x1>,<y1>,<x2>,<y2>[,<t1>,<t2>])
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\move"); proto[i].name = _T("\\move");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_6,PARCLASS_RELATIVE_TIME_START)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_6,PARCLASS_RELATIVE_TIME_START));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_6,PARCLASS_RELATIVE_TIME_START)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_6,PARCLASS_RELATIVE_TIME_START));
// If these are rearranged, keep rect clip and vector clip adjacent in this order
// \clip(<x1>,<y1>,<x2>,<y2>) // \clip(<x1>,<y1>,<x2>,<y2>)
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\clip"); proto[i].name = _T("\\clip");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
// \clip([<scale>,]<some drawings>) // \clip([<scale>,]<some drawings>)
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\clip"); proto[i].name = _T("\\clip");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_2,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_2,PARCLASS_NORMAL));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_DRAWING)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_DRAWING));
// \iclip(<x1>,<y1>,<x2>,<y2>) // \iclip(<x1>,<y1>,<x2>,<y2>)
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\iclip"); proto[i].name = _T("\\iclip");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
// \iclip([<scale>,]<some drawings>) // \iclip([<scale>,]<some drawings>)
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\iclip"); proto[i].name = _T("\\iclip");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_2,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_2,PARCLASS_NORMAL));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_DRAWING)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_DRAWING));
// \fscx<percent> // \fscx<percent>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\fscx"); proto[i].name = _T("\\fscx");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_RELATIVE_SIZE_X)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_RELATIVE_SIZE_X));
// \fscy<percent> // \fscy<percent>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\fscy"); proto[i].name = _T("\\fscy");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_RELATIVE_SIZE_Y)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_RELATIVE_SIZE_Y));
// \pos(<x>,<y>) // \pos(<x>,<y>)
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\pos"); proto[i].name = _T("\\pos");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
// \org(<x>,<y>) // \org(<x>,<y>)
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\org"); proto[i].name = _T("\\org");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
// \pbo<y> // \pbo<y>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\pbo"); proto[i].name = _T("\\pbo");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
// \fad(<t1>,<t2>) // \fad(<t1>,<t2>)
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\fad"); proto[i].name = _T("\\fad");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_RELATIVE_TIME_START)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_RELATIVE_TIME_START));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_RELATIVE_TIME_END)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_RELATIVE_TIME_END));
// \fsp<pixels> // \fsp<pixels>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\fsp"); proto[i].name = _T("\\fsp");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
// \frx<degrees> // \frx<degrees>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\frx"); proto[i].name = _T("\\frx");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \fry<degrees> // \fry<degrees>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\fry"); proto[i].name = _T("\\fry");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \frz<degrees> // \frz<degrees>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\frz"); proto[i].name = _T("\\frz");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \fr<degrees> // \fr<degrees>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\fr"); proto[i].name = _T("\\fr");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \fax<factor> // \fax<factor>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\fax"); proto[i].name = _T("\\fax");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \fay<factor> // \fay<factor>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\fay"); proto[i].name = _T("\\fay");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \1c&H<bbggrr>& // \1c&H<bbggrr>&
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\1c"); proto[i].name = _T("\\1c");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \2c&H<bbggrr>& // \2c&H<bbggrr>&
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\2c"); proto[i].name = _T("\\2c");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \3c&H<bbggrr>& // \3c&H<bbggrr>&
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\3c"); proto[i].name = _T("\\3c");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \4c&H<bbggrr>& // \4c&H<bbggrr>&
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\4c"); proto[i].name = _T("\\4c");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \1a&H<aa>& // \1a&H<aa>&
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\1a"); proto[i].name = _T("\\1a");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \2a&H<aa>& // \2a&H<aa>&
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\2a"); proto[i].name = _T("\\2a");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \3a&H<aa>& // \3a&H<aa>&
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\3a"); proto[i].name = _T("\\3a");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \4a&H<aa>& // \4a&H<aa>&
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\4a"); proto[i].name = _T("\\4a");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \fe<charset> // \fe<charset>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\fe"); proto[i].name = _T("\\fe");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \ko<duration> // \ko<duration>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\ko"); proto[i].name = _T("\\ko");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_KARAOKE)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_KARAOKE));
// \kf<duration> // \kf<duration>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\kf"); proto[i].name = _T("\\kf");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_KARAOKE)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_KARAOKE));
// \be<strength> // \be<strength>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\be"); proto[i].name = _T("\\be");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \blur<strength> // \blur<strength>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\blur"); proto[i].name = _T("\\blur");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \fn<name> // \fn<name>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\fn"); proto[i].name = _T("\\fn");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \fs+<size> // \fs+<size>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\fs+"); proto[i].name = _T("\\fs+");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \fs-<size> // \fs-<size>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\fs-"); proto[i].name = _T("\\fs-");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \fs<size> // \fs<size>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\fs"); proto[i].name = _T("\\fs");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
// \an<alignment> // \an<alignment>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\an"); proto[i].name = _T("\\an");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \c&H<bbggrr>& // \c&H<bbggrr>&
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\c"); proto[i].name = _T("\\c");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \b<0/1/weight> // \b<0/1/weight>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\b"); proto[i].name = _T("\\b");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_1,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_1,PARCLASS_NORMAL));
proto.back().params.back().defaultValue.SetBool(false); proto[i].params.back().defaultValue.SetBool(false);
// \i<0/1> // \i<0/1>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\i"); proto[i].name = _T("\\i");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_BOOL,OPTIONAL_1,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_BOOL,OPTIONAL_1,PARCLASS_NORMAL));
proto.back().params.back().defaultValue.SetBool(false); proto[i].params.back().defaultValue.SetBool(false);
// \u<0/1> // \u<0/1>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\u"); proto[i].name = _T("\\u");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_BOOL,OPTIONAL_1,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_BOOL,OPTIONAL_1,PARCLASS_NORMAL));
proto.back().params.back().defaultValue.SetBool(false); proto[i].params.back().defaultValue.SetBool(false);
// \s<0/1> // \s<0/1>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\s"); proto[i].name = _T("\\s");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_BOOL,OPTIONAL_1,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_BOOL,OPTIONAL_1,PARCLASS_NORMAL));
proto.back().params.back().defaultValue.SetBool(false); proto[i].params.back().defaultValue.SetBool(false);
// \a<alignment> // \a<alignment>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\a"); proto[i].name = _T("\\a");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \k<duration> // \k<duration>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\k"); proto[i].name = _T("\\k");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_KARAOKE)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_KARAOKE));
// \K<duration> // \K<duration>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\K"); proto[i].name = _T("\\K");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_KARAOKE)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_KARAOKE));
// \q<0-3> // \q<0-3>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\q"); proto[i].name = _T("\\q");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \p<n> // \p<n>
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\p"); proto[i].name = _T("\\p");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_NORMAL));
// \r[<name>] // \r[<name>]
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\r"); proto[i].name = _T("\\r");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,OPTIONAL_1,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_TEXT,OPTIONAL_1,PARCLASS_NORMAL));
// \t([<t1>,<t2>,][<accel>,]<style modifiers>) // \t([<t1>,<t2>,][<accel>,]<style modifiers>)
proto.push_back(AssOverrideTagProto()); i++;
proto.back().name = _T("\\t"); proto[i].name = _T("\\t");
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_3 | OPTIONAL_4,PARCLASS_RELATIVE_TIME_START)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_3 | OPTIONAL_4,PARCLASS_RELATIVE_TIME_START));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_3 | OPTIONAL_4,PARCLASS_RELATIVE_TIME_START)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_3 | OPTIONAL_4,PARCLASS_RELATIVE_TIME_START));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,OPTIONAL_2 | OPTIONAL_4,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_FLOAT,OPTIONAL_2 | OPTIONAL_4,PARCLASS_NORMAL));
proto.back().params.push_back(AssOverrideParamProto(VARDATA_BLOCK,NOT_OPTIONAL,PARCLASS_NORMAL)); proto[i].params.push_back(AssOverrideParamProto(VARDATA_BLOCK,NOT_OPTIONAL,PARCLASS_NORMAL));
} }
/// @brief Constructor
/// @brief Constructor AssOverrideTag //////////////////////////
///
AssOverrideTag::AssOverrideTag () { AssOverrideTag::AssOverrideTag () {
valid = false; valid = false;
} }
/// @brief Destructor /// @brief Destructor
///
AssOverrideTag::~AssOverrideTag () { AssOverrideTag::~AssOverrideTag () {
Clear(); Clear();
} }
/// @brief Clear /// @brief Clear
///
void AssOverrideTag::Clear() { void AssOverrideTag::Clear() {
for (std::vector<AssOverrideParameter*>::iterator cur=Params.begin();cur!=Params.end();cur++) { for (std::vector<AssOverrideParameter*>::iterator cur=Params.begin();cur!=Params.end();cur++) {
delete *cur; delete *cur;
} }
Params.clear(); Params.clear();
Params.reserve(6);
valid = false; valid = false;
} }
/// @brief Parses text and sets tag /// @brief Parses text and sets tag
/// @param text /// @param text
///
void AssOverrideTag::SetText (const wxString &text) { void AssOverrideTag::SetText (const wxString &text) {
// Determine name // Determine name
Name = _T(""); for (AssOverrideTagProto::iterator cur=AssOverrideTagProto::proto.begin();cur!=AssOverrideTagProto::proto.end();cur++) {
AssOverrideTagProto *proto; if (text.StartsWith(cur->name)) {
for (std::list<AssOverrideTagProto>::iterator cur=AssOverrideTagProto::proto.begin();cur!=AssOverrideTagProto::proto.end();cur++) { Name = cur->name;
proto = &(*cur); ParseParameters(text.Mid(Name.length()), cur);
if (text.Left(proto->name.length()) == proto->name) {
Name = proto->name;
break;
}
}
// Set tag name
if (!Name.empty()) {
ParseParameters(text.Mid(Name.length()));
valid = true; valid = true;
return;
}
} }
// Junk tag // Junk tag
else {
Name = text; Name = text;
valid = false; valid = false;
}
} }
/// @brief Checks if it is valid /// @brief Checks if it is valid
/// @return /// @return
/// ///
@ -623,17 +562,15 @@ bool AssOverrideTag::IsValid() {
return valid; return valid;
} }
/// @brief Parses the parameters for the ass override tag /// @brief Parses the parameters for the ass override tag
/// @param text All text between the name and the next \ or the end of the override block /// @param text All text between the name and the next \ or the end of the override block
/// ///
void AssOverrideTag::ParseParameters(const wxString &text) { void AssOverrideTag::ParseParameters(const wxString &text, AssOverrideTagProto::iterator proto) {
// Clear first
Clear(); Clear();
// Tokenize text, attempting to find all parameters // Tokenize text, attempting to find all parameters
wxArrayString paramList; wxArrayString paramList;
paramList.reserve(6);
wxString work; wxString work;
{ {
@ -656,19 +593,22 @@ void AssOverrideTag::ParseParameters(const wxString &text) {
// (Next ')' is achieved when parDepth == 0) // (Next ')' is achieved when parDepth == 0)
start = ++i; start = ++i;
while (i < textlen && parDepth > 0) { while (i < textlen && parDepth > 0) {
if (text[i] == _T('(')) parDepth++; wxChar c = text[i];
if (text[i] == _T(')')) parDepth--;
// parDepth 1 is where we start, and the tag-level we're interested in parsing on // parDepth 1 is where we start, and the tag-level we're interested in parsing on
if (text[i] == _T(',') && parDepth == 1) break; if (c == L',' && parDepth == 1) break;
if (c == _T('(')) parDepth++;
else if (c == _T(')')) {
parDepth--;
if (parDepth < 0) { if (parDepth < 0) {
wxLogWarning(_T("Unmatched parenthesis near '%s'!\nTag-parsing incomplete."), text.SubString(i, 10).c_str()); wxLogWarning(_T("Unmatched parenthesis near '%s'!\nTag-parsing incomplete."), text.SubString(i, 10).c_str());
goto end_tokenizing; goto end_tokenizing;
} }
if (parDepth == 0) { else if (parDepth == 0) {
// We just ate the paranthesis ending this parameter block // We just ate the paranthesis ending this parameter block
// Make sure it doesn't get included in the parameter text // Make sure it doesn't get included in the parameter text
break; break;
} }
}
i++; i++;
} }
// i now points to the first character not member of this parameter // i now points to the first character not member of this parameter
@ -702,25 +642,9 @@ end_tokenizing:
case 7: parsFlag = OPTIONAL_7; break; case 7: parsFlag = OPTIONAL_7; break;
} }
// Find prototype // vector (i)clip is the second clip prototype in the list
bool clipOnce = true, iclipOnce = true; if ((Name == _T("\\clip") || Name == _T("\\iclip")) && totalPars != 4) {
AssOverrideTagProto *proto = NULL; ++proto;
for (std::list<AssOverrideTagProto>::iterator cur=AssOverrideTagProto::proto.begin();cur!=AssOverrideTagProto::proto.end();cur++) {
if (Name == (*cur).name) {
if (Name == _T("\\clip") && totalPars != 4 && clipOnce) {
clipOnce = false;
continue;
}
if (Name == _T("\\iclip") && totalPars != 4 && iclipOnce) {
iclipOnce = false;
continue;
}
proto = &(*cur);
break;
}
}
if (proto == NULL) {
throw _T("Couldn't find tag prototype while parsing.");
} }
// Get parameters // Get parameters
@ -811,10 +735,7 @@ end_tokenizing:
} }
} }
/// @brief Get string /// @brief Get string
///
wxString AssOverrideTag::ToString() { wxString AssOverrideTag::ToString() {
// Start with name // Start with name
wxString result = Name; wxString result = Name;
@ -846,5 +767,3 @@ wxString AssOverrideTag::ToString() {
if (parenthesis) result += _T(")"); if (parenthesis) result += _T(")");
return result; return result;
} }

View file

@ -34,25 +34,14 @@
/// @ingroup subs_storage /// @ingroup subs_storage
/// ///
///////////
// Headers
#ifndef AGI_PRE #ifndef AGI_PRE
#include <list>
#include <vector> #include <vector>
#endif #endif
#include "variable_data.h" #include "variable_data.h"
//////////////
// Prototypes
class AssDialogueBlockOverride; class AssDialogueBlockOverride;
/// DOCME /// DOCME
enum ASS_ParameterClass { enum ASS_ParameterClass {
@ -87,61 +76,6 @@ enum ASS_ParameterClass {
PARCLASS_DRAWING PARCLASS_DRAWING
}; };
/// DOCME
/// @class AssOverrideParameter
/// @brief DOCME
///
/// DOCME
class AssOverrideParameter : public VariableData {
public:
/// DOCME
ASS_ParameterClass classification;
/// DOCME
bool ommited;
AssOverrideParameter();
~AssOverrideParameter();
void operator= (const AssOverrideParameter &param);
void CopyFrom (const AssOverrideParameter &param);
};
/// DOCME
/// @class AssOverrideTag
/// @brief DOCME
///
/// DOCME
class AssOverrideTag {
private:
/// DOCME
bool valid;
public:
/// DOCME
wxString Name;
/// DOCME
std::vector <AssOverrideParameter*> Params;
AssOverrideTag();
~AssOverrideTag();
bool IsValid();
void ParseParameters(const wxString &text);
void Clear();
void SetText(const wxString &text);
wxString ToString();
};
/// DOCME /// DOCME
enum ASS_ParameterOptional { enum ASS_ParameterOptional {
@ -173,6 +107,26 @@ enum ASS_ParameterOptional {
OPTIONAL_7 = 0x40 OPTIONAL_7 = 0x40
}; };
/// DOCME
/// @class AssOverrideParameter
/// @brief DOCME
///
/// DOCME
class AssOverrideParameter : public VariableData {
public:
/// DOCME
ASS_ParameterClass classification;
/// DOCME
bool ommited;
AssOverrideParameter();
~AssOverrideParameter();
void operator= (const AssOverrideParameter &param);
void CopyFrom (const AssOverrideParameter &param);
};
/// DOCME /// DOCME
/// @class AssOverrideParamProto /// @class AssOverrideParamProto
@ -198,7 +152,6 @@ public:
~AssOverrideParamProto(); ~AssOverrideParamProto();
}; };
/// DOCME /// DOCME
/// @class AssOverrideTagProto /// @class AssOverrideTagProto
/// @brief DOCME /// @brief DOCME
@ -206,7 +159,6 @@ public:
/// DOCME /// DOCME
class AssOverrideTagProto { class AssOverrideTagProto {
public: public:
/// DOCME /// DOCME
wxString name; wxString name;
@ -214,14 +166,43 @@ public:
std::vector<AssOverrideParamProto> params; std::vector<AssOverrideParamProto> params;
/// DOCME /// DOCME
static std::list<AssOverrideTagProto> proto; static std::vector<AssOverrideTagProto> proto;
/// DOCME /// DOCME
static bool loaded; static bool loaded;
static void LoadProtos(); static void LoadProtos();
typedef std::vector<AssOverrideTagProto>::iterator iterator;
AssOverrideTagProto(); AssOverrideTagProto();
~AssOverrideTagProto(); ~AssOverrideTagProto();
}; };
/// DOCME
/// @class AssOverrideTag
/// @brief DOCME
///
/// DOCME
class AssOverrideTag {
private:
/// DOCME
bool valid;
public:
/// DOCME
wxString Name;
/// DOCME
std::vector <AssOverrideParameter*> Params;
AssOverrideTag();
~AssOverrideTag();
bool IsValid();
void ParseParameters(const wxString &text, AssOverrideTagProto::iterator proto);
void Clear();
void SetText(const wxString &text);
wxString ToString();
};