summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/level-1/baseref.hpp
blob: 2f072b617b940158d80bc55853a1b5a318e89cbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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);
};

}
}