From c25f6d5dd597e099ddae3ea426451ad77490ad90 Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 4 Jun 2014 14:50:13 +0300 Subject: [PATCH] Copy constructor for VIncrement class. --HG-- branch : feature --- src/app/container/vincrement.cpp | 17 +++++++++++++++++ src/app/container/vincrement.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/src/app/container/vincrement.cpp b/src/app/container/vincrement.cpp index 865e7d00e..97d4aa2b9 100644 --- a/src/app/container/vincrement.cpp +++ b/src/app/container/vincrement.cpp @@ -49,6 +49,23 @@ VIncrement::VIncrement(quint32 id, qreal base, qreal ksize, qreal kheight, QStri :id(id), base(base), ksize(ksize), kheight(kheight), description(description) {} +//--------------------------------------------------------------------------------------------------------------------- +VIncrement::VIncrement(const VIncrement &incr) + :id(incr.getId()), base(incr.getBase()), ksize(incr.getKsize()), kheight(incr.getKheight()), + description(incr.getDescription()) +{} + +//--------------------------------------------------------------------------------------------------------------------- +VIncrement &VIncrement::operator=(const VIncrement &incr) +{ + this->id = incr.getId(); + this->base = incr.getBase(); + this->ksize = incr.getKsize(); + this->kheight = incr.getKheight(); + this->description = incr.getDescription(); + return *this; +} + //--------------------------------------------------------------------------------------------------------------------- qreal VIncrement::GetValue() const { diff --git a/src/app/container/vincrement.h b/src/app/container/vincrement.h index bc787e6bc..4a31efe06 100644 --- a/src/app/container/vincrement.h +++ b/src/app/container/vincrement.h @@ -39,6 +39,8 @@ class VIncrement public: VIncrement(); VIncrement(quint32 id, qreal base, qreal ksize, qreal kheight, QString description = QString()); + VIncrement(const VIncrement &incr); + VIncrement &operator=(const VIncrement &incr); quint32 getId() const; void setId(const quint32 &value); qreal getBase() const;