diff options
Diffstat (limited to 'starts/meaning-vm/level-1/baseref.hpp')
-rw-r--r-- | starts/meaning-vm/level-1/baseref.hpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/starts/meaning-vm/level-1/baseref.hpp b/starts/meaning-vm/level-1/baseref.hpp new file mode 100644 index 0000000..2f072b6 --- /dev/null +++ b/starts/meaning-vm/level-1/baseref.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "common.hpp" +#include "funcs.hpp" + +namespace intellect { +namespace level1 { + +template <typename ref> +struct baseref : public level0::baseref<ref> +{ + baseref(concept * p) : level0::baseref<ref>(p) { } + baseref(level0::ref const & other) : baseref(other.ptr()) { } + baseref(std::string const & name) : baseref(getnamed(name)) { } + baseref(const char *name) : baseref(std::string(name)) { } + baseref(bool b) : baseref(b ? "true" : "false") { } + baseref() : baseref("nothing") { } + + bool isa(ref group) const { return level1::isa(self, group); } + bool isan(ref group) const { return isa(group); } + + std::string const & name() const { return getname(self)->data; } + operator std::string const &() const { return getname(self)->data; } + operator char const *() const { return getname(self)->data.c_str(); } + + std::string dump(ref skipmarkertype, ref skipmarkertarget); +}; + +} +} |