mirror of https://github.com/odrling/Aegisub
Don't return a const std::string from GetData
It has zero benefit and forces an extra copy.
This commit is contained in:
parent
ac25d10d74
commit
9f6124220a
|
@ -63,10 +63,6 @@ AssEntry *AssAttachment::Clone() const {
|
||||||
return new AssAttachment(*this);
|
return new AssAttachment(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string AssAttachment::GetEntryData() const {
|
|
||||||
return entry_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t AssAttachment::GetSize() const {
|
size_t AssAttachment::GetSize() const {
|
||||||
auto header_end = entry_data.get().find('\n');
|
auto header_end = entry_data.get().find('\n');
|
||||||
return entry_data.get().size() - header_end - 1;
|
return entry_data.get().size() - header_end - 1;
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
/// @param raw If false, remove the SSA filename mangling
|
/// @param raw If false, remove the SSA filename mangling
|
||||||
std::string GetFileName(bool raw=false) const;
|
std::string GetFileName(bool raw=false) const;
|
||||||
|
|
||||||
const std::string GetEntryData() const override;
|
std::string GetEntryData() const override { return entry_data; }
|
||||||
AssEntryGroup Group() const override { return group; }
|
AssEntryGroup Group() const override { return group; }
|
||||||
AssEntry *Clone() const override;
|
AssEntry *Clone() const override;
|
||||||
|
|
||||||
|
|
|
@ -177,14 +177,6 @@ std::string AssDialogue::GetData(bool ssa) const {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string AssDialogue::GetEntryData() const {
|
|
||||||
return GetData(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string AssDialogue::GetSSAText() const {
|
|
||||||
return GetData(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::auto_ptr<boost::ptr_vector<AssDialogueBlock>> AssDialogue::ParseTags() const {
|
std::auto_ptr<boost::ptr_vector<AssDialogueBlock>> AssDialogue::ParseTags() const {
|
||||||
boost::ptr_vector<AssDialogueBlock> Blocks;
|
boost::ptr_vector<AssDialogueBlock> Blocks;
|
||||||
|
|
||||||
|
|
|
@ -167,10 +167,10 @@ public:
|
||||||
|
|
||||||
/// Update the text of the line from parsed blocks
|
/// Update the text of the line from parsed blocks
|
||||||
void UpdateText(boost::ptr_vector<AssDialogueBlock>& blocks);
|
void UpdateText(boost::ptr_vector<AssDialogueBlock>& blocks);
|
||||||
const std::string GetEntryData() const override;
|
std::string GetEntryData() const override { return GetData(false); }
|
||||||
|
|
||||||
/// Get the line as SSA rather than ASS
|
/// Get the line as SSA rather than ASS
|
||||||
std::string GetSSAText() const override;
|
std::string GetSSAText() const override { return GetData(true); }
|
||||||
/// Does this line collide with the passed line?
|
/// Does this line collide with the passed line?
|
||||||
bool CollidesWith(const AssDialogue *target) const;
|
bool CollidesWith(const AssDialogue *target) const;
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
std::string const& GroupHeader(bool ssa=false) const;
|
std::string const& GroupHeader(bool ssa=false) const;
|
||||||
|
|
||||||
/// @brief Get this line's raw entry data in ASS format
|
/// @brief Get this line's raw entry data in ASS format
|
||||||
virtual const std::string GetEntryData() const=0;
|
virtual std::string GetEntryData() const=0;
|
||||||
|
|
||||||
/// Get this line in SSA format
|
/// Get this line in SSA format
|
||||||
virtual std::string GetSSAText() const { return GetEntryData(); }
|
virtual std::string GetSSAText() const { return GetEntryData(); }
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
|
|
||||||
AssEntry *Clone() const override { return new AssInfo(*this); }
|
AssEntry *Clone() const override { return new AssInfo(*this); }
|
||||||
AssEntryGroup Group() const override { return AssEntryGroup::INFO; }
|
AssEntryGroup Group() const override { return AssEntryGroup::INFO; }
|
||||||
const std::string GetEntryData() const override { return key + ": " + value; }
|
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 GetSSAText() const override { return boost::iequals(key, "scripttype: v4.00+") ? "ScriptType: v4.00" : GetEntryData(); }
|
||||||
|
|
||||||
std::string Key() const { return key; }
|
std::string Key() const { return key; }
|
||||||
|
|
|
@ -77,7 +77,7 @@ public:
|
||||||
AssStyle();
|
AssStyle();
|
||||||
AssStyle(std::string const& data, int version=1);
|
AssStyle(std::string const& data, int version=1);
|
||||||
|
|
||||||
const std::string GetEntryData() const override { return data; }
|
std::string GetEntryData() const override { return data; }
|
||||||
std::string GetSSAText() const override;
|
std::string GetSSAText() const override;
|
||||||
AssEntryGroup Group() const override { return AssEntryGroup::STYLE; }
|
AssEntryGroup Group() const override { return AssEntryGroup::STYLE; }
|
||||||
AssEntry *Clone() const override;
|
AssEntry *Clone() const override;
|
||||||
|
|
Loading…
Reference in New Issue