diff --git a/core/tags/generic.cpp b/core/tags/generic.cpp index 5e76f145..7b639921 100644 --- a/core/tags/generic.cpp +++ b/core/tags/generic.cpp @@ -12,6 +12,11 @@ GenericTag :: GenericTag(const std::string &name) { } +GenericTag :: GenericTag(const GenericTag &tag) + : _name(tag._name), _lower(tag._lower) +{ +} + const std::string GenericTag :: primary_key() const { return _name; diff --git a/include/core/tags/generic.h b/include/core/tags/generic.h index 90eab757..d003a57e 100644 --- a/include/core/tags/generic.h +++ b/include/core/tags/generic.h @@ -35,6 +35,13 @@ public: */ GenericTag(const std::string &); + /** + * Generic tag copy constructor. + * + * @param tag The tag that should be copied. + */ + GenericTag(const GenericTag &); + /** * Called to access the generic tag's primary key. * diff --git a/tests/core/tags/generic.cpp b/tests/core/tags/generic.cpp index 73877535..27e12328 100644 --- a/tests/core/tags/generic.cpp +++ b/tests/core/tags/generic.cpp @@ -30,6 +30,11 @@ static void test_generic_tag() test_equal(tag.name(), (std::string)"Generic Tag"); test_equal(tag.lowercase(), (std::string)"generic tag"); test_equal(tag.primary_key(), (std::string)"Generic Tag"); + + tag = GenericTag(tag); + test_equal(tag.name(), (std::string)"Generic Tag"); + test_equal(tag.lowercase(), (std::string)"generic tag"); + test_equal(tag.primary_key(), (std::string)"Generic Tag"); } static void test_generic_tag_comparison()