acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_property_object_impl.h
1#pragma once
2
3
4//inline property_object::property_object(const property_object & propertyobject) :
5// ::PARTICLE(propertyobject),
6// ::particle(propertyobject),
7// ::element(propertyobject),
8// ::matter(propertyobject),
9// m_ppropertyset(propertyobject.m_ppropertyset)
10//{
11//
12//}
13//inline bool property_object::has_property(const atom & atom) const { return m_ppropertyset && m_ppropertyset->has_property(atom); }
14//inline property * property_object::lookup_property(const atom& atom) const { return m_ppropertyset ? m_ppropertyset->find(atom) : nullptr; }
15//inline bool property_object::erase_key(const atom & atom) { return m_ppropertyset && m_ppropertyset->erase_by_name(atom); }
16//inline ::property_set & property_object::get_property_set() { defer_propset(); return *m_ppropertyset; }
17//inline const ::property_set & property_object::get_property_set() const { ((property_object *)this)->defer_propset(); return *m_ppropertyset; }
18//
19//
20//inline bool property_object::contains(const ::property_set & set) const
21//{
22//
23// if (set.is_empty())
24// {
25//
26// return true;
27//
28// }
29//
30// if (m_ppropertyset.is_null())
31// {
32//
33// return false;
34//
35// }
36//
37// return m_ppropertyset->contains(set);
38//
39//}
40//
41//inline void property_object::defer_propset() { system()->defer_construct_newø(m_ppropertyset); }
42//
43//
44//
45//inline property * property_object::find_property(const atom & atom) const
46//{
47//
48// if (!m_ppropertyset)
49// {
50//
51// return nullptr;
52//
53// }
54//
55// return m_ppropertyset->find(atom);
56//
57//}
58//
59//
60//inline string property_object::find_string(const ::atom & atom, const_char_pointer pszDefault) const
61//{
62//
63// if (!m_ppropertyset)
64// {
65//
66// return pszDefault;
67//
68// }
69//
70// auto pproperty = m_ppropertyset->find(atom);
71//
72// if (!pproperty)
73// {
74//
75// return pszDefault;
76//
77// }
78//
79// return pproperty->string(scopedstrDefault);
80//
81//}
82//
83//
84//inline ::i32 property_object::find_int(const ::atom & atom, ::i32 iDefault) const
85//{
86//
87// if (!m_ppropertyset)
88// {
89//
90// return iDefault;
91//
92// }
93//
94// auto pproperty = m_ppropertyset->find(atom);
95//
96// if (!pproperty)
97// {
98//
99// return iDefault;
100//
101// }
102//
103// return pproperty->::i32(iDefault);
104//
105//}
106//
107//
108//inline ::u32 property_object::find_u32(const ::atom & atom, ::u32 iDefault) const
109//{
110//
111// if (!m_ppropertyset)
112// {
113//
114// return iDefault;
115//
116// }
117//
118// auto pproperty = m_ppropertyset->find(atom);
119//
120// if (!pproperty)
121// {
122//
123// return iDefault;
124//
125// }
126//
127// return pproperty->::u32(iDefault);
128//
129//}
130//
131//
132//template < typename TYPE > inline TYPE & property_object::get_cast(const ::atom & atom, TYPE * pDefault)
133//{
134//
135// return payload(atom).get_cast <TYPE>(pDefault);
136//
137//}
138//
139//
140//inline ::payload & property_object::payload(const atom & atom)
141//{
142//
143// auto & set = get_property_set();
144//
145// return set.get(atom);
146//
147//}
148//
149//
150//inline bool property_object::is_true(const ::atom & atom, bool bDefault) const
151//{
152//
153// return m_ppropertyset && payload(atom).is_true(bDefault);
154//
155//}
156//
157//
158//inline bool property_object::is_false(const ::atom& atom) const
159//{
160//
161// return !is_true(atom);
162//
163//}
164//
165//
172//
173//
174//inline ::payload & property_object::operator[](const ::atom & atom) { return payload(atom); }
175//
176//inline ::payload property_object::operator[](const ::atom & atom) const { return find_property(atom); }
177//
178//inline ::payload property_object::payload(const ::atom & atom) const { return find_property(atom); }
179//
180//inline ::payload property_object::payload(const ::atom & atom, const ::payload & payloadDefault) const { return operator()(atom, payloadDefault); }
181//
182//inline ::payload property_object::operator()(const ::atom & atom) const { return find_payload(atom, ::error_not_found); }
183//
184//inline ::payload property_object::operator()(const ::atom & atom, const ::payload & payloadDefault) const { return find_payload(atom, payloadDefault); }
185//
186//inline ::payload property_object::find_payload(const ::atom & atom) const { return find_payload(atom, ::error_not_found); }
187//
188//inline ::payload property_object::find_payload(const ::atom & atom, const ::payload & payloadDefault) const
189//{
190//
191// auto pproperty = find_property(atom);
192//
193// if (!pproperty)
194// {
195//
196// return payloadDefault;
197//
198// }
199//
200// return pproperty;
201//
202//}
203//
204//inline ::payload property_object::attribute(const ::atom & atom) { return payload(atom); }
205//
206//inline ::property * property_object::find_attribute(const ::atom & atom) { return find_property(atom); }
207//
208//template < typename TYPE >
209//inline bool property_object::find_attribute(const ::atom & atom, TYPE & t)
210//{
211//
212// auto p = find_property(atom);
213//
214// if (!p)
215// {
216//
217// return false;
218//
219// }
220//
221// t = *p;
222//
223// return true;
224//
225//}
226//
227//
228//inline ::payload & property_object::get_object(const ::atom & atom)
229//{
230//
231// auto pproperty = &payload(atom);
232//
233// if (!pproperty)
234// {
235//
236// throw ::exception(error_resource);
237//
238// }
239//
240// return *pproperty;
241//
242//}
243//inline ::payload & property_object::topic(const ::atom& atom)
244//{
245//
246// auto property = fetch_property(atom);
247//
248// if (!property)
249// {
250//
251// throw ::exception(error_resource);
252//
253// }
254//
255// return *property.m_pproperty;
256//
257//}
258//
259//
260//
261//inline material_object::material_object(const material_object & materialobject) :
262// ::PARTICLE(materialobject),
263// ::particle(materialobject),
264// ::element(materialobject),
265// ::matter(materialobject),
266// ::property_object(materialobject),
267// m_pmapPropertyProcedure(materialobject.m_pmapPropertyProcedure),
268// m_pia(materialobject.m_pia)
269//{
270//
271//}
272//
273//
274//inline ::i64_array_base & material_object::idarray() const { system()->defer_construct_newø(((material_object *)this)->m_pia); return *m_pia; }
275//
276//
277//