From 8eedbed6e1f5b59e9714d7f857f486d8cf5f9434 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 11 May 2023 13:44:57 +0200 Subject: [PATCH] Allow copy-construction of Font. --- src/lib/font.cc | 18 ++++++++++++++++++ src/lib/font.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/src/lib/font.cc b/src/lib/font.cc index f3fbc6897..955a2ad1c 100644 --- a/src/lib/font.cc +++ b/src/lib/font.cc @@ -44,6 +44,24 @@ Font::Font (cxml::NodePtr node) } +Font::Font(Font const& other) + : _id(other._id) + , _content(other._content) +{ + +} + + +Font& Font::operator=(Font const& other) +{ + if (&other != this) { + _id = other._id; + _content = other._content; + } + return *this; +} + + void Font::as_xml (xmlpp::Node* node) { diff --git a/src/lib/font.h b/src/lib/font.h index 0afd873e1..12a14aba4 100644 --- a/src/lib/font.h +++ b/src/lib/font.h @@ -54,6 +54,9 @@ public: _content.data = data; } + Font(Font const& other); + Font& operator=(Font const& other); + void as_xml (xmlpp::Node* node); std::string id () const { -- 2.30.2