Fix AssAttachment::Clone

This commit is contained in:
Thomas Goyne 2013-12-11 07:55:17 -08:00
parent 5776e058eb
commit fc7bf8f1b0
2 changed files with 9 additions and 3 deletions

View file

@ -25,6 +25,13 @@
#include <boost/range/iterator_range.hpp>
#include <fstream>
AssAttachment::AssAttachment(AssAttachment const& rgt)
: entry_data(rgt.entry_data)
, filename(rgt.filename)
, group(rgt.group)
{
}
AssAttachment::AssAttachment(std::string const& header, AssEntryGroup group)
: entry_data(header + "\r\n")
, filename(header.substr(10))
@ -53,9 +60,7 @@ AssAttachment::AssAttachment(agi::fs::path const& name, AssEntryGroup group)
}
AssEntry *AssAttachment::Clone() const {
auto clone = new AssAttachment(filename, group);
clone->entry_data = entry_data;
return clone;
return new AssAttachment(*this);
}
const std::string AssAttachment::GetEntryData() const {

View file

@ -50,6 +50,7 @@ public:
AssEntryGroup Group() const override { return group; }
AssEntry *Clone() const override;
AssAttachment(AssAttachment const& rgt);
AssAttachment(std::string const& header, AssEntryGroup group);
AssAttachment(agi::fs::path const& name, AssEntryGroup group);
};