forked from mia/Aegisub
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:
parent
a03b37bdef
commit
d49e59653f
2 changed files with 15 additions and 3 deletions
|
@ -233,13 +233,13 @@ wxString AssDialogue::GetSSAText () const {
|
||||||
return GetData(true);
|
return GetData(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssDialogue::ParseASSTags() {
|
std::vector<AssDialogueBlock*> AssDialogue::ParseTags() const {
|
||||||
ClearBlocks();
|
std::vector<AssDialogueBlock*> Blocks;
|
||||||
|
|
||||||
// Empty line, make an empty block
|
// Empty line, make an empty block
|
||||||
if (Text.empty()) {
|
if (Text.empty()) {
|
||||||
Blocks.push_back(new AssDialogueBlockPlain);
|
Blocks.push_back(new AssDialogueBlockPlain);
|
||||||
return;
|
return Blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drawingLevel = 0;
|
int drawingLevel = 0;
|
||||||
|
@ -304,6 +304,13 @@ void AssDialogue::ParseASSTags() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Blocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AssDialogue::ParseASSTags() {
|
||||||
|
ClearBlocks();
|
||||||
|
Blocks = ParseTags();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssDialogue::StripTags () {
|
void AssDialogue::StripTags () {
|
||||||
|
|
|
@ -178,8 +178,13 @@ public:
|
||||||
/// @param version ASS version to try first (4, 4+, ASS2)
|
/// @param version ASS version to try first (4, 4+, ASS2)
|
||||||
/// @return Did it successfully parse?
|
/// @return Did it successfully parse?
|
||||||
bool Parse(wxString data,int version=1);
|
bool Parse(wxString data,int version=1);
|
||||||
|
|
||||||
/// Parse text as ASS to generate block information
|
/// Parse text as ASS to generate block information
|
||||||
void ParseASSTags();
|
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
|
/// Clear all blocks, ALWAYS call this after you're done processing tags
|
||||||
void ClearBlocks();
|
void ClearBlocks();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue