Loading...
Searching...
No Matches
stela.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "stela/common.hpp"
5
6namespace by {
7
62 class stelaVisitor;
64
65 class _nout stela: public instance {
66 BY(ADT(stela, instance))
67
68 typedef smap<std::string, tstr<me>, std::map> myMap;
69 typedef typename myMap::iterator iterator;
70
71 public:
77 stela(std::initializer_list<me*> subs, const std::string& name = "");
78 stela(const me& rhs, const std::string& name = "");
79 stela(const std::string& name = "");
80
81 public:
82 me& operator[](const std::string& name);
83 const me& operator[](const std::string& name) const BY_CONST_FUNC(operator[](name));
84 me& operator[](const nchar* name);
85 const me& operator[](const nchar* name) const BY_CONST_FUNC(operator[](name));
90 explicit operator nbool() const;
91
92 public:
93 me& sub(const std::string& name);
94 me& sub(const std::string* it) BY_SIDE_FUNC(it, sub(*it), *this);
95 const me& sub(const std::string& name) const BY_CONST_FUNC(sub(name))
96 const me& sub(const std::string* name) const BY_CONST_FUNC(sub(name))
97 me& sub(const nchar* name);
98 const me& sub(const nchar* name) const BY_CONST_FUNC(sub(name))
99 me& sub(nidx n);
100 const me& sub(nidx n) const BY_CONST_FUNC(sub(n))
101
102 nbool has(const std::string& name) const;
103 nbool has(const std::string* it) const BY_SIDE_FUNC(has);
104
109 void add(const stela& it);
114 void add(const stela* it) BY_SIDE_FUNC(add);
119 void add(std::initializer_list<stela*> subs);
120 void del(const stela& it);
121 void del(const stela* it) BY_SIDE_FUNC(del);
122 void del(const std::string& name);
123 void del(const std::string* it) BY_SIDE_FUNC(del);
124 void del(const nchar* name);
125
132 const std::string& getPrefix() const;
133 void setPrefix(const std::string& newPrefix);
134 void setPrefix(const nchar* newPrefix);
138 const std::string& getPostfix() const;
139 void setPostfix(const std::string& newPostfix);
140 void setPostfix(const nchar* newPostfix);
141
142 const std::string& getName() const;
143 void setName(const std::string& newName);
144 void setName(const std::string* it) BY_SIDE_FUNC(setName);
145 void setName(const nchar* newName);
146
147 ncnt len() const;
148
149 iterator begin();
150 iterator end();
151
158 virtual nint asInt() const;
165 virtual nchar asChar() const;
171 virtual const std::string& asStr() const;
178 virtual nbool asBool() const;
183 virtual nbool isExist() const;
184
185 public:
188 virtual void accept(const stelaVisitInfo& i, stelaVisitor& v);
189
190 private:
191 myMap _subs;
192 std::string _name;
193 std::string _prefix;
194 std::string _postfix;
195 };
196} // namespace by
Base class for all managed instances in memlite system.
Definition instance.hpp:41
Definition stela.hpp:63
Traversal context handed to every stelaVisitor callback.
Definition stelaVisitInfo.hpp:17
Preorder visitor for the stela AST.
Definition stelaVisitor.hpp:30
Rich logging support with polymorphic type conversion.
Definition richLog.hpp:34