Add copy constructor to AssDialogue and use it in Clone

Originally committed to SVN as r4561.
This commit is contained in:
Thomas Goyne 2010-06-22 00:03:11 +00:00
parent fe9aa56d10
commit 8756dc1800
2 changed files with 17 additions and 17 deletions

View file

@ -65,6 +65,21 @@ AssDialogue::AssDialogue()
for (int i=0;i<4;i++) Margin[i] = 0; for (int i=0;i<4;i++) Margin[i] = 0;
} }
AssDialogue::AssDialogue(AssDialogue const& that)
: Comment(that.Comment)
, Layer(that.Layer)
, Start(that.Start)
, End(that.End)
, Style(that.Style)
, Actor(that.Actor)
, Effect(that.Effect)
, Text(that.Text)
{
group = that.group;
Valid = that.Valid;
for (int i=0;i<4;i++) Margin[i] = that.Margin[i];
}
/// @brief DOCME /// @brief DOCME
/// @param _data /// @param _data
/// @param version /// @param version
@ -750,23 +765,7 @@ wxString AssDialogue::GetStrippedText() const {
/// @brief Clone /// @brief Clone
/// @return /// @return
AssEntry *AssDialogue::Clone() const { AssEntry *AssDialogue::Clone() const {
// Create clone return new AssDialogue(*this);
AssDialogue *final = new AssDialogue();
// Copy data
final->group = group;
final->Valid = Valid;
final->Actor = Actor;
final->Comment = Comment;
final->Effect = Effect;
final->Layer = Layer;
for (int i=0;i<4;i++) final->Margin[i] = Margin[i];
final->Start = Start;
final->End = End;
final->Style = Style;
final->Text = Text;
return final;
} }
/// @brief Constructor AssDialogueBlock /// @brief Constructor AssDialogueBlock

View file

@ -257,6 +257,7 @@ public:
AssEntry *Clone() const; AssEntry *Clone() const;
AssDialogue(); AssDialogue();
AssDialogue(AssDialogue const&);
AssDialogue(wxString data,int version=1); AssDialogue(wxString data,int version=1);
~AssDialogue(); ~AssDialogue();
}; };