summaryrefslogtreecommitdiffstats
path: root/raul/Symbol.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-12 15:56:21 +0000
committerDavid Robillard <d@drobilla.net>2012-08-12 15:56:21 +0000
commit6ec0c7c6c4bb341926c45db99e7287cce91a8da2 (patch)
tree9166b13d686364856923ba97f9cd2dd85513a74f /raul/Symbol.hpp
parent37c7755e38037cfa359e9b3bbee9bd17d9606d73 (diff)
downloadraul-6ec0c7c6c4bb341926c45db99e7287cce91a8da2.tar.gz
raul-6ec0c7c6c4bb341926c45db99e7287cce91a8da2.tar.bz2
raul-6ec0c7c6c4bb341926c45db99e7287cce91a8da2.zip
Stricter symbol construction and conversion.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@4670 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul/Symbol.hpp')
-rw-r--r--raul/Symbol.hpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/raul/Symbol.hpp b/raul/Symbol.hpp
index c2efbdc..469a4cf 100644
--- a/raul/Symbol.hpp
+++ b/raul/Symbol.hpp
@@ -45,7 +45,7 @@ public:
* It is a fatal error to construct a Symbol from an invalid string,
* use is_valid first to check.
*/
- Symbol(const std::basic_string<char>& symbol)
+ explicit Symbol(const std::basic_string<char>& symbol)
: _str(g_intern_string(symbol.c_str()))
{
assert(is_valid(symbol));
@@ -56,12 +56,17 @@ public:
* It is a fatal error to construct a Symbol from an invalid string,
* use is_valid first to check.
*/
- Symbol(const char* csymbol)
+ explicit Symbol(const char* csymbol)
: _str(g_intern_string(csymbol))
{
assert(is_valid(csymbol));
}
+ Symbol& operator=(const Symbol& other) {
+ _str = other._str;
+ return *this;
+ }
+
inline const char* c_str() const { return _str; }
inline bool operator==(const Symbol& other) const {
@@ -78,7 +83,7 @@ public:
static bool is_valid(const std::basic_string<char>& symbol);
- static std::string symbolify(const std::basic_string<char>& str);
+ static Raul::Symbol symbolify(const std::basic_string<char>& str);
private:
const char* _str;