summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2025-04-06 11:48:14 +0200
committerGravatar Nikias Bassen2025-04-06 11:48:14 +0200
commited8a73301b844bf5f7efd9cd437c9c0765a49a88 (patch)
tree803d3f9bc1b08bba8ad5f921da42f42c297a9905
parent31f1a810e5264ef970bab17d517692ef906470e1 (diff)
downloadlibplist-ed8a73301b844bf5f7efd9cd437c9c0765a49a88.tar.gz
libplist-ed8a73301b844bf5f7efd9cd437c9c0765a49a88.tar.bz2
C++: Add = operator to String class
-rw-r--r--include/plist/String.h1
-rw-r--r--src/String.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/include/plist/String.h b/include/plist/String.h
index 7e8a6e4..95f8dd1 100644
--- a/include/plist/String.h
+++ b/include/plist/String.h
@@ -35,6 +35,7 @@ public :
35 String(plist_t node, Node* parent = NULL); 35 String(plist_t node, Node* parent = NULL);
36 String(const String& s); 36 String(const String& s);
37 String& operator=(const String& s); 37 String& operator=(const String& s);
38 String& operator=(const std::string& s);
38 String& operator=(const char* s); 39 String& operator=(const char* s);
39 String(const std::string& s); 40 String(const std::string& s);
40 String(const char *s); 41 String(const char *s);
diff --git a/src/String.cpp b/src/String.cpp
index 5bae804..8daec0f 100644
--- a/src/String.cpp
+++ b/src/String.cpp
@@ -45,6 +45,13 @@ String& String::operator=(const PList::String& s)
45 return *this; 45 return *this;
46} 46}
47 47
48String& String::operator=(const std::string& s)
49{
50 plist_free(_node);
51 _node = plist_new_string(s.c_str());
52 return *this;
53}
54
48String& String::operator=(const char* s) 55String& String::operator=(const char* s)
49{ 56{
50 plist_free(_node); 57 plist_free(_node);