summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-02-08 19:37:30 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-02-08 19:37:30 +0000
commit222c18d18afe76228775c0d73004e9c77bea611e (patch)
treeed35ad3b6c517842271ae8c816888d0ee328e198 /libs
parentea63af333e2bb159666c42b364aedcda8f40c4ef (diff)
add copy constructor for PBD::ID
git-svn-id: svn://localhost/ardour2/branches/3.0@6650 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/pbd/id.cc14
-rw-r--r--libs/pbd/pbd/id.h4
2 files changed, 17 insertions, 1 deletions
diff --git a/libs/pbd/id.cc b/libs/pbd/id.cc
index 25c96c305e..b96863b0fa 100644
--- a/libs/pbd/id.cc
+++ b/libs/pbd/id.cc
@@ -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)
{
diff --git a/libs/pbd/pbd/id.h b/libs/pbd/pbd/id.h
index d25ca81ef0..7a32a29002 100644
--- a/libs/pbd/pbd/id.h
+++ b/libs/pbd/pbd/id.h
@@ -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;