Devirtualize AssEntry::GetEntryData
This commit is contained in:
parent
3d35ba894c
commit
bacbd8c2bf
6 changed files with 11 additions and 14 deletions
|
@ -46,7 +46,8 @@ public:
|
|||
/// @param raw If false, remove the SSA filename mangling
|
||||
std::string GetFileName(bool raw=false) const;
|
||||
|
||||
std::string GetEntryData() const override { return entry_data; }
|
||||
std::string const& GetEntryData() const { return entry_data; }
|
||||
std::string const& GetSSAText() const { return entry_data; }
|
||||
AssEntryGroup Group() const override { return group; }
|
||||
|
||||
AssAttachment(AssAttachment const& rgt);
|
||||
|
|
|
@ -170,10 +170,10 @@ public:
|
|||
|
||||
/// Update the text of the line from parsed blocks
|
||||
void UpdateText(boost::ptr_vector<AssDialogueBlock>& blocks);
|
||||
std::string GetEntryData() const override { return GetData(false); }
|
||||
std::string GetEntryData() const { return GetData(false); }
|
||||
|
||||
/// Get the line as SSA rather than ASS
|
||||
std::string GetSSAText() const override { return GetData(true); }
|
||||
std::string GetSSAText() const { return GetData(true); }
|
||||
/// Does this line collide with the passed line?
|
||||
bool CollidesWith(const AssDialogue *target) const;
|
||||
|
||||
|
|
|
@ -57,10 +57,4 @@ public:
|
|||
|
||||
/// ASS or SSA Section header for this entry's group
|
||||
std::string const& GroupHeader(bool ssa=false) const;
|
||||
|
||||
/// @brief Get this line's raw entry data in ASS format
|
||||
virtual std::string GetEntryData() const=0;
|
||||
|
||||
/// Get this line in SSA format
|
||||
virtual std::string GetSSAText() const { return GetEntryData(); }
|
||||
};
|
||||
|
|
|
@ -27,8 +27,8 @@ public:
|
|||
AssInfo(std::string key, std::string value) : key(std::move(key)), value(std::move(value)) { }
|
||||
|
||||
AssEntryGroup Group() const override { return AssEntryGroup::INFO; }
|
||||
std::string GetEntryData() const override { return key + ": " + value; }
|
||||
std::string GetSSAText() const override { return boost::iequals(key, "scripttype: v4.00+") ? "ScriptType: v4.00" : GetEntryData(); }
|
||||
std::string GetEntryData() const { return key + ": " + value; }
|
||||
std::string GetSSAText() const { return boost::iequals(key, "scripttype: v4.00+") ? "ScriptType: v4.00" : GetEntryData(); }
|
||||
|
||||
std::string Key() const { return key; }
|
||||
std::string Value() const { return value; }
|
||||
|
|
|
@ -77,8 +77,8 @@ public:
|
|||
AssStyle();
|
||||
AssStyle(std::string const& data, int version=1);
|
||||
|
||||
std::string GetEntryData() const override { return data; }
|
||||
std::string GetSSAText() const override;
|
||||
std::string const& GetEntryData() const { return data; }
|
||||
std::string GetSSAText() const ;
|
||||
AssEntryGroup Group() const override { return AssEntryGroup::STYLE; }
|
||||
|
||||
/// Convert an ASS alignment to the equivalent SSA alignment
|
||||
|
|
|
@ -147,14 +147,15 @@ namespace Automation4 {
|
|||
lua_newtable(L);
|
||||
|
||||
set_field(L, "section", e->GroupHeader());
|
||||
set_field(L, "raw", e->GetEntryData());
|
||||
|
||||
if (AssInfo *info = dynamic_cast<AssInfo*>(e)) {
|
||||
set_field(L, "raw", info->GetEntryData());
|
||||
set_field(L, "key", info->Key());
|
||||
set_field(L, "value", info->Value());
|
||||
set_field(L, "class", "info");
|
||||
}
|
||||
else if (AssDialogue *dia = dynamic_cast<AssDialogue*>(e)) {
|
||||
set_field(L, "raw", dia->GetEntryData());
|
||||
set_field(L, "comment", dia->Comment);
|
||||
|
||||
set_field(L, "layer", dia->Layer);
|
||||
|
@ -176,6 +177,7 @@ namespace Automation4 {
|
|||
set_field(L, "class", "dialogue");
|
||||
}
|
||||
else if (AssStyle *sty = dynamic_cast<AssStyle*>(e)) {
|
||||
set_field(L, "raw", sty->GetEntryData());
|
||||
set_field(L, "name", sty->name);
|
||||
|
||||
set_field(L, "fontname", sty->font);
|
||||
|
|
Loading…
Reference in a new issue