diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/properties.cc | 24 | ||||
-rw-r--r-- | src/properties.h | 18 |
2 files changed, 42 insertions, 0 deletions
diff --git a/src/properties.cc b/src/properties.cc index c9263cb..ad40adc 100644 --- a/src/properties.cc +++ b/src/properties.cc @@ -14,10 +14,34 @@ Properties::Properties() { } +Properties::Properties(const Properties & other) +{ + assign(other); +} + Properties::~Properties() { } +void Properties::assign(const Properties & other) +{ + properties_comment = other.properties_comment; + + properties_comments.clear(); + for (Comments::const_iterator i = properties_comments.constBegin(); i != properties_comments.constEnd(); ++i) { + set_comment(i.key(), i.value()); + } + + properties_label = other.properties_label; + properties_name = other.properties_name; + + properties_location = other.properties_location; + properties_color = other.properties_color; + + properties_info = other.properties_info; + properties_values = other.properties_values; +} + void Properties::add_value(const QString &key, const QString &value, const QString &comment) { if (comment.size()) diff --git a/src/properties.h b/src/properties.h index efde85b..89c9c93 100644 --- a/src/properties.h +++ b/src/properties.h @@ -26,6 +26,11 @@ class Properties public: Properties(); + /** + * @brief copy constructor + * */ + Properties(const Properties & other); + virtual ~Properties(); /* ---- inspectors ---- */ @@ -89,6 +94,19 @@ public: /* ---- mutators ---- */ /** + * @brief assign all values of another Properties instance to this instance + * */ + void assign(const Properties & other); + + /** + * @brief assignment operator + * */ + inline Properties & operator=(const Properties & other) { + assign(other); + return *this; + } + + /** * @brief set the comments string of this object * */ inline void set_comment(const QString &text) { |