mirror of https://github.com/odrling/Aegisub
Simplify and speed up AssFile's copy constructor and assignment operator.
Originally committed to SVN as r4565.
This commit is contained in:
parent
7958f85ef3
commit
a40b9c4b91
|
@ -33,8 +33,6 @@
|
|||
/// @brief Class for dialogue lines in subtitles
|
||||
/// @ingroup subs_storage
|
||||
|
||||
////////////
|
||||
// Includes
|
||||
#include "config.h"
|
||||
|
||||
#ifndef AGI_PRE
|
||||
|
@ -66,7 +64,8 @@ AssDialogue::AssDialogue()
|
|||
}
|
||||
|
||||
AssDialogue::AssDialogue(AssDialogue const& that)
|
||||
: Comment(that.Comment)
|
||||
: AssEntry()
|
||||
, Comment(that.Comment)
|
||||
, Layer(that.Layer)
|
||||
, Start(that.Start)
|
||||
, End(that.End)
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#ifndef AGI_PRE
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <list>
|
||||
|
||||
|
@ -450,18 +451,18 @@ void AssFile::LoadDefault (bool defline) {
|
|||
loaded = true;
|
||||
}
|
||||
|
||||
AssFile::AssFile (AssFile &from) {
|
||||
using std::list;
|
||||
|
||||
// Copy standard variables
|
||||
AssFile::AssFile (const AssFile &from) {
|
||||
filename = from.filename;
|
||||
loaded = from.loaded;
|
||||
Modified = from.Modified;
|
||||
|
||||
// Copy lines
|
||||
for (list<AssEntry*>::iterator cur=from.Line.begin();cur!=from.Line.end();cur++) {
|
||||
Line.push_back((*cur)->Clone());
|
||||
std::transform(from.Line.begin(), from.Line.end(), std::back_inserter(Line), std::mem_fun(&AssEntry::Clone));
|
||||
}
|
||||
AssFile& AssFile::operator=(AssFile from) {
|
||||
filename = from.filename;
|
||||
loaded = from.loaded;
|
||||
Modified = from.Modified;
|
||||
std::swap(Line, from.Line);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void AssFile::InsertStyle (AssStyle *style) {
|
||||
|
|
|
@ -90,7 +90,8 @@ public:
|
|||
bool loaded;
|
||||
|
||||
AssFile();
|
||||
AssFile(AssFile &from);
|
||||
AssFile(const AssFile &from);
|
||||
AssFile& operator=(AssFile from);
|
||||
~AssFile();
|
||||
|
||||
/// Does the file have unsaved changes?
|
||||
|
|
Loading…
Reference in New Issue