add copy constructor for PBD::ID

git-svn-id: svn://localhost/ardour2/branches/3.0@6650 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2010-02-08 19:37:30 +00:00
parent ea63af333e
commit 222c18d18a
2 changed files with 17 additions and 1 deletions

View File

@@ -48,6 +48,11 @@ ID::ID ()
_id = _counter++;
}
ID::ID (const ID& other)
{
_id = other._id;
}
ID::ID (string str)
{
string_assign (str);
@@ -85,6 +90,15 @@ ID::operator= (string str)
return *this;
}
ID&
ID::operator= (const ID& other)
{
if (&other != this) {
_id = other._id;
}
return *this;
}
ostream&
operator<< (ostream& ostr, const ID& _id)
{

View File

@@ -31,7 +31,8 @@ class ID {
public:
ID ();
ID (std::string);
ID (const ID&);
bool operator== (const ID& other) const {
return _id == other._id;
}
@@ -43,6 +44,7 @@ class ID {
bool operator== (const std::string&) const;
ID& operator= (std::string);
ID& operator= (const ID&);
bool operator< (const ID& other) const {
return _id < other._id;