Add a version of ParseASSTags that returns the blocks rather than mutating the line

Originally committed to SVN as r6626.
This commit is contained in:
Thomas Goyne 2012-03-28 23:58:50 +00:00
parent a03b37bdef
commit d49e59653f
2 changed files with 15 additions and 3 deletions

View File

@ -233,13 +233,13 @@ wxString AssDialogue::GetSSAText () const {
return GetData(true);
}
void AssDialogue::ParseASSTags() {
ClearBlocks();
std::vector<AssDialogueBlock*> AssDialogue::ParseTags() const {
std::vector<AssDialogueBlock*> Blocks;
// Empty line, make an empty block
if (Text.empty()) {
Blocks.push_back(new AssDialogueBlockPlain);
return;
return Blocks;
}
int drawingLevel = 0;
@ -304,6 +304,13 @@ void AssDialogue::ParseASSTags() {
}
}
}
return Blocks;
}
void AssDialogue::ParseASSTags() {
ClearBlocks();
Blocks = ParseTags();
}
void AssDialogue::StripTags () {

View File

@ -178,8 +178,13 @@ public:
/// @param version ASS version to try first (4, 4+, ASS2)
/// @return Did it successfully parse?
bool Parse(wxString data,int version=1);
/// Parse text as ASS to generate block information
void ParseASSTags();
/// Parse text as ASS and return block information
std::vector<AssDialogueBlock*> ParseTags() const;
/// Clear all blocks, ALWAYS call this after you're done processing tags
void ClearBlocks();