diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-07-14 13:56:35 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-07-14 13:56:35 +0200 |
| commit | e56e6df99cd89b0aa6e0bf8fda723f39ede41806 (patch) | |
| tree | ed2feeb0a9fd595f95524c96af2e8551680dfe31 | |
| parent | d2b7c2442da9363b13f884bd0c47fb757cb0f005 (diff) | |
| download | Project-Tick-e56e6df99cd89b0aa6e0bf8fda723f39ede41806.tar.gz Project-Tick-e56e6df99cd89b0aa6e0bf8fda723f39ede41806.zip | |
Add C string constructor to tag_string
| -rw-r--r-- | include/tag_string.h | 2 | ||||
| -rw-r--r-- | src/tag_string.cpp | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/tag_string.h b/include/tag_string.h index f4476993e3..846650e507 100644 --- a/include/tag_string.h +++ b/include/tag_string.h @@ -35,6 +35,7 @@ public: tag_string(const std::string& str); tag_string(std::string&& str = ""); + tag_string(const char* str); operator std::string&(); operator const std::string&() const; @@ -42,6 +43,7 @@ public: tag_string& operator=(const std::string& str); tag_string& operator=(std::string&& str); + tag_string& operator=(const char* str); void set(const std::string& str); void set(std::string&& str); diff --git a/src/tag_string.cpp b/src/tag_string.cpp index 6bd1465e84..e4f714d0b3 100644 --- a/src/tag_string.cpp +++ b/src/tag_string.cpp @@ -30,6 +30,10 @@ tag_string::tag_string(std::string&& str): value(std::move(str)) {} +tag_string::tag_string(const char* str): + value(std::string(str)) +{} + tag_string::operator std::string&() { return value; @@ -57,6 +61,12 @@ tag_string& tag_string::operator=(std::string&& str) return *this; } +tag_string& tag_string::operator=(const char* str) +{ + value = std::string(str); + return *this; +} + void tag_string::set(const std::string& str) { value = str; |
