diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/String.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/String.cpp b/src/String.cpp index 2ddc28b..326aa7f 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 | ||
| 48 | String& String::operator=(const char* s) | ||
| 49 | { | ||
| 50 | plist_free(_node); | ||
| 51 | _node = plist_new_string(s); | ||
| 52 | return *this; | ||
| 53 | } | ||
| 54 | |||
| 48 | String::String(const std::string& s) : Node(PLIST_STRING) | 55 | String::String(const std::string& s) : Node(PLIST_STRING) |
| 49 | { | 56 | { |
| 50 | plist_set_string_val(_node, s.c_str()); | 57 | plist_set_string_val(_node, s.c_str()); |
| @@ -66,10 +73,8 @@ void String::SetValue(const std::string& s) | |||
| 66 | 73 | ||
| 67 | std::string String::GetValue() const | 74 | std::string String::GetValue() const |
| 68 | { | 75 | { |
| 69 | char* s = NULL; | 76 | const char* s = plist_get_string_ptr(_node, NULL); |
| 70 | plist_get_string_val(_node, &s); | ||
| 71 | std::string ret = s ? s : ""; | 77 | std::string ret = s ? s : ""; |
| 72 | delete s; | ||
| 73 | return ret; | 78 | return ret; |
| 74 | } | 79 | } |
| 75 | 80 | ||
