Generic: Create a copy constructor

Track tags need a copy constructor to keep library size accurate, so
create one here.
This commit is contained in:
Anna Schumaker 2014-11-29 10:48:24 -05:00
parent 4edbd69fa7
commit 44aac0dcec
3 changed files with 17 additions and 0 deletions

View File

@ -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;

View File

@ -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.
*

View File

@ -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()