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
51 class _nout stela: public instance {
52 BY(ME(stela, instance), CLONE(me), INIT_META(stela))
53
54 typedef std::map<std::string, tstr<me>> myMap;
55 typedef myMap::iterator iterator;
56
57 public:
63 stela(std::initializer_list<me*> subs, const std::string& name = "");
64 stela(const me& rhs, const std::string& name = "");
65 stela(const std::string& name = "");
66
67 public:
68 me& operator[](const std::string& name);
69 const me& operator[](const std::string& name) const BY_CONST_FUNC(operator[](name));
70 me& operator[](const nchar* name);
71 const me& operator[](const nchar* name) const BY_CONST_FUNC(operator[](name));
76 explicit operator nbool() const;
77
78 public:
79 me& sub(const std::string& name);
80 me& sub(const std::string* it) BY_SIDE_FUNC(it, sub(*it), *this);
81 const me& sub(const std::string& name) const BY_CONST_FUNC(sub(name))
82 const me& sub(const std::string* name) const BY_CONST_FUNC(sub(name))
83 me& sub(const nchar* name);
84 const me& sub(const nchar* name) const BY_CONST_FUNC(sub(name))
85 me& sub(nidx n);
86 const me& sub(nidx n) const BY_CONST_FUNC(sub(n))
87
88 nbool has(const std::string& name) const;
89 nbool has(const std::string* it) const BY_SIDE_FUNC(has);
90
95 void add(const stela& it);
100 void add(const stela* it) BY_SIDE_FUNC(add);
105 void add(std::initializer_list<stela*> subs);
106 void del(const stela& it);
107 void del(const stela* it) BY_SIDE_FUNC(del);
108 void del(const std::string& name);
109 void del(const std::string* it) BY_SIDE_FUNC(del);
110 void del(const nchar* name);
111
112 const std::string& getName() const;
113 void setName(const std::string& newName);
114 void setName(const std::string* it) BY_SIDE_FUNC(setName);
115 void setName(const nchar* newName);
116
117 ncnt len() const;
118
119 iterator begin();
120 iterator end();
121
122 const type& getType() const override;
123
130 virtual nint asInt() const;
137 virtual nchar asChar() const;
143 virtual const std::string& asStr() const;
150 virtual nbool asBool() const;
155 virtual nbool isExist() const;
156
157 private:
158 myMap _subs;
159 std::string _name;
160 };
161} // namespace by