AssKaraoke can safely take a const AssDialogue*

This commit is contained in:
Niels Martin Hansen 2015-01-13 23:56:29 +01:00
parent 68781a95b2
commit f0a5abad01
2 changed files with 6 additions and 6 deletions

View file

@ -39,11 +39,11 @@ std::string AssKaraoke::Syllable::GetText(bool k_tag) const {
return ret;
}
AssKaraoke::AssKaraoke(AssDialogue *line, bool auto_split, bool normalize) {
AssKaraoke::AssKaraoke(const AssDialogue *line, bool auto_split, bool normalize) {
if (line) SetLine(line, auto_split, normalize);
}
void AssKaraoke::SetLine(AssDialogue *line, bool auto_split, bool normalize) {
void AssKaraoke::SetLine(const AssDialogue *line, bool auto_split, bool normalize) {
syls.clear();
Syllable syl;
syl.start_time = line->Start;
@ -87,7 +87,7 @@ void AssKaraoke::SetLine(AssDialogue *line, bool auto_split, bool normalize) {
AnnounceSyllablesChanged();
}
void AssKaraoke::ParseSyllables(AssDialogue *line, Syllable &syl) {
void AssKaraoke::ParseSyllables(const AssDialogue *line, Syllable &syl) {
for (auto& block : line->ParseTags()) {
std::string text = block->GetText();

View file

@ -46,17 +46,17 @@ private:
bool no_announce = false;
agi::signal::Signal<> AnnounceSyllablesChanged;
void ParseSyllables(AssDialogue *line, Syllable &syl);
void ParseSyllables(const AssDialogue *line, Syllable &syl);
public:
/// Constructor
/// @param line Initial line
/// @param auto_split Should the line automatically be split on spaces if there are no k tags?
/// @param normalize Should the total duration of the syllables be forced to equal the line duration?
AssKaraoke(AssDialogue *line = nullptr, bool auto_split = false, bool normalize = true);
AssKaraoke(const AssDialogue *line = nullptr, bool auto_split = false, bool normalize = true);
/// Parse a dialogue line
void SetLine(AssDialogue *line, bool auto_split = false, bool normalize = true);
void SetLine(const AssDialogue *line, bool auto_split = false, bool normalize = true);
/// Add a split before character pos in syllable syl_idx
void AddSplit(size_t syl_idx, size_t pos);