diff options
-rw-r--r-- | raul/Atom.hpp | 24 | ||||
-rw-r--r-- | raul/Path.hpp | 2 |
2 files changed, 20 insertions, 6 deletions
diff --git a/raul/Atom.hpp b/raul/Atom.hpp index 34be9d6..de543f6 100644 --- a/raul/Atom.hpp +++ b/raul/Atom.hpp @@ -46,11 +46,11 @@ public: BLOB }; - Atom() : _type(NIL), _blob_val(0) {} - Atom(int32_t val) : _type(INT), _int_val(val) {} - Atom(float val) : _type(FLOAT), _float_val(val) {} - Atom(bool val) : _type(BOOL), _bool_val(val) {} - Atom(const char* val) : _type(STRING), _string_val(strdup(val)) {} + Atom() : _type(NIL), _blob_val(0) {} + Atom(int32_t val) : _type(INT), _int_val(val) {} + Atom(float val) : _type(FLOAT), _float_val(val) {} + Atom(bool val) : _type(BOOL), _bool_val(val) {} + Atom(const char* val) : _type(STRING), _string_val(strdup(val)) {} Atom(Type t, const std::string& val) : _type(t), _string_val(strdup(val.c_str())) {} @@ -191,4 +191,18 @@ private: } // namespace Raul +static inline std::ostream& operator<<(std::ostream& os, const Raul::Atom& atom) +{ + switch (atom.type()) { + case Raul::Atom::NIL: return os << "(nil)"; + case Raul::Atom::INT: return os << atom.get_int32(); + case Raul::Atom::FLOAT: return os << atom.get_float(); + case Raul::Atom::BOOL: return os << atom.get_bool(); + case Raul::Atom::URI: return os << atom.get_uri(); + case Raul::Atom::STRING: return os << atom.get_string(); + case Raul::Atom::BLOB: return os << atom.get_blob(); + } + return os; +} + #endif // RAUL_ATOM_HPP diff --git a/raul/Path.hpp b/raul/Path.hpp index 0b287c3..b549f88 100644 --- a/raul/Path.hpp +++ b/raul/Path.hpp @@ -156,7 +156,7 @@ public: return "/"; } else { assert(length() > base.length()); - return substr(base.length()); + return substr(base.length() - 1); } } |