GCC Code Coverage Report


Directory: src/gate/
File: src/gate/cxx_directories.cpp
Date: 2026-12-03 19:36:00
Exec Total Coverage
Lines: 395 409 96.6%
Functions: 74 76 97.4%
Branches: 209 396 52.8%

Line Branch Exec Source
1 /* GATE PROJECT LICENSE:
2 +----------------------------------------------------------------------------+
3 | Copyright (c) 2018-2026, Stefan Meislinger <sm@opengate.at> |
4 | All rights reserved. |
5 | |
6 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met:|
8 | |
9 | 1. Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. |
11 | 2. Redistributions in binary form must reproduce the above copyright |
12 | notice, this list of conditions and the following disclaimer in the |
13 | documentation and/or other materials provided with the distribution. |
14 | |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"|
16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
25 | THE POSSIBILITY OF SUCH DAMAGE. |
26 +----------------------------------------------------------------------------+
27 */
28
29 #include "gate/directories.hpp"
30 #include "gate/exceptions.hpp"
31 #include "gate/utilities.hpp"
32
33 namespace gate
34 {
35
36 enumint_t const DirectoryPropertyDef::Flag_Optional = GATE_DIRECTORY_PROPERTY_FLAG_OPTIONAL;
37
38 5 DirectoryPropertyDef::DirectoryPropertyDef()
39 {
40 5 gate_mem_clear(&this->impl, sizeof(this->impl));
41 5 }
42
43 1 DirectoryPropertyDef::DirectoryPropertyDef(gate_directory_propertydef_t const& src)
44 {
45
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 if (NULL == gate_directory_propertydef_create(&this->impl, src.data_type, &src.name, src.flags))
46 {
47 ✗ GATEXX_RAISE_ERROR(results::OutOfMemory);
48 }
49 1 }
50 1 DirectoryPropertyDef::DirectoryPropertyDef(DirectoryPropertyDef const& src)
51 {
52
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 if (NULL == gate_directory_propertydef_create(&this->impl, src.impl.data_type, &src.impl.name, src.impl.flags))
53 {
54 ✗ GATEXX_RAISE_ERROR(results::OutOfMemory);
55 }
56 1 }
57 4 DirectoryPropertyDef::DirectoryPropertyDef(gate_type_id_t dataType, String const& name, enumint_t flags)
58 {
59
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
4 if (NULL == gate_directory_propertydef_create(&this->impl, dataType, name.c_impl(), flags))
60 {
61 ✗ GATEXX_RAISE_ERROR(results::OutOfMemory);
62 }
63 4 }
64 3 DirectoryPropertyDef& DirectoryPropertyDef::operator=(DirectoryPropertyDef const& src)
65 {
66
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (this != &src)
67 {
68 3 String::assign(this->impl.name, src.impl.name);
69 3 this->impl.data_type = src.impl.data_type;
70 3 this->impl.flags = src.impl.flags;
71 }
72 3 return *this;
73 }
74 22 DirectoryPropertyDef::~DirectoryPropertyDef() noexcept
75 {
76 11 gate_directory_propertydef_release(&this->impl);
77 11 }
78
79 2 gate_type_id_t DirectoryPropertyDef::Type() const
80 {
81 2 return this->impl.data_type;
82 }
83 2 String DirectoryPropertyDef::Name() const
84 {
85 2 return String::duplicate(this->impl.name);
86 }
87 2 enumint_t DirectoryPropertyDef::Flags() const
88 {
89 2 return this->impl.flags;
90 }
91 5 gate_directory_propertydef_t* DirectoryPropertyDef::c_impl()
92 {
93 5 return &this->impl;
94 }
95 6 gate_directory_propertydef_t const* DirectoryPropertyDef::c_impl() const
96 {
97 6 return &this->impl;
98 }
99
100
101
102
103
104
105 enumint_t const DirectoryClass::Flag_Container = GATE_DIRECTORY_CLASS_FLAG_CONTAINER;
106 enumint_t const DirectoryClass::Flag_Streams = GATE_DIRECTORY_CLASS_FLAG_STREAMS;
107 enumint_t const DirectoryClass::Flag_Creatable = GATE_DIRECTORY_CLASS_FLAG_CREATABLE;
108
109 3 DirectoryClass DirectoryClass::create(
110 String const& uid, String const& name, enumint_t flags,
111 DirectoryPropertyDef const* propDefs, size_t propDefsCount,
112 String const* superiorUids, size_t superiorUidsCount,
113 String const* containmentUids, size_t containmentUidsCount)
114 {
115
5/6
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
8 gate_directory_class_t* const ptr_class = gate_directory_class_create(
116 uid.c_impl(), name.c_impl(), flags,
117 3 (propDefs != NULL) ? propDefs->c_impl() : NULL, propDefsCount,
118 1 (superiorUids != NULL) ? superiorUids->c_impl() : NULL, superiorUidsCount,
119 1 (containmentUids != NULL) ? containmentUids->c_impl() : NULL, containmentUidsCount);
120
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 if (NULL == ptr_class)
121 {
122 ✗ GATEXX_RAISE_ERROR(results::OutOfMemory);
123 }
124 3 return DirectoryClass(ptr_class);
125 }
126
127 ✗ DirectoryClass::DirectoryClass()
128 ✗ : object_impl_t(NULL)
129 {
130 ✗ }
131
132 5 DirectoryClass::DirectoryClass(gate_directory_class_t* dir_class)
133 5 : object_impl_t(dir_class)
134 {
135 5 }
136 3 DirectoryClass::DirectoryClass(DirectoryClass const& src)
137 3 : object_impl_t(src)
138 {
139 3 }
140
141 2 String DirectoryClass::Uid() const
142 {
143 2 gate_string_t tmp = GATE_STRING_INIT_EMPTY;
144
1/2
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
2 result_t result = gate_directory_class_uid(this->c_impl(), &tmp);
145
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
2 GATEXX_CHECK_ERROR(result);
146 4 return String::createFrom(tmp);
147 }
148 1 String DirectoryClass::Name() const
149 {
150 1 gate_string_t tmp = GATE_STRING_INIT_EMPTY;
151
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t result = gate_directory_class_name(this->c_impl(), &tmp);
152
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
153 2 return String::createFrom(tmp);
154 }
155 1 enumint_t DirectoryClass::Flags() const
156 {
157 1 enumint_t flags = 0;
158
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t result = gate_directory_class_flags(this->c_impl(), &flags);
159
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
160 1 return flags;
161 }
162
163 1 size_t DirectoryClass::getPropertiesCount() const
164 {
165 1 size_t count = 0;
166
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t result = gate_directory_class_get_properties_count(this->c_impl(), &count);
167
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
168 1 return count;
169 }
170 2 DirectoryPropertyDef DirectoryClass::getProperty(size_t index) const
171 {
172 2 DirectoryPropertyDef def;
173
1/2
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 result_t result = gate_directory_class_get_property(this->c_impl(), index, def.c_impl());
174
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 GATEXX_CHECK_ERROR(result);
175 1 return def;
176 }
177 2 DirectoryPropertyDef DirectoryClass::findProperty(String const& name) const
178 {
179 2 DirectoryPropertyDef def;
180
1/2
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
2 result_t result = gate_directory_class_find_property(this->c_impl(), name.c_impl(), def.c_impl());
181
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 GATEXX_CHECK_EXCEPTION(result);
182 1 return def;
183 }
184
185 1 size_t DirectoryClass::getSuperiorClassesCount() const
186 {
187 1 size_t count = 0;
188
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t result = gate_directory_class_get_superior_classes_count(this->c_impl(), &count);
189
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
190 1 return count;
191 }
192 2 String DirectoryClass::getSuperiorClassUid(size_t index) const
193 {
194 2 gate_string_t tmp = GATE_STRING_INIT_EMPTY;
195
1/2
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
2 result_t result = gate_directory_class_get_superior_class_uid(this->c_impl(), index, &tmp);
196
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 GATEXX_CHECK_ERROR(result);
197 2 return String::createFrom(tmp);
198 }
199
200 1 size_t DirectoryClass::getContainmentClassesCount() const
201 {
202 1 size_t count = 0;
203
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t result = gate_directory_class_get_containment_classes_count(this->c_impl(), &count);
204
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
205 1 return count;
206 }
207 2 String DirectoryClass::getContainmentClassUid(size_t index) const
208 {
209 2 gate_string_t tmp = GATE_STRING_INIT_EMPTY;
210
1/2
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
2 result_t result = gate_directory_class_get_containment_class_uid(this->c_impl(), index, &tmp);
211
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 GATEXX_CHECK_ERROR(result);
212 2 return String::createFrom(tmp);
213 }
214
215
216
217
218
219 42 DirectoryEntry::DirectoryEntry(gate_directory_entry_t* dir_entry)
220 42 : object_impl_t(dir_entry)
221 {
222 42 }
223 65 DirectoryEntry::DirectoryEntry(DirectoryEntry const& src)
224 65 : object_impl_t(src)
225 {
226 65 }
227
228 1 String DirectoryEntry::EntryUid() const
229 {
230 1 gate_string_t tmp = GATE_STRING_INIT_EMPTY;
231
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t result = gate_directory_entry_entry_uid(this->c_impl(), &tmp);
232
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
233 2 return String::createFrom(tmp);
234 }
235 1 String DirectoryEntry::ClassUid() const
236 {
237 1 gate_string_t tmp = GATE_STRING_INIT_EMPTY;
238
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t result = gate_directory_entry_class_uid(this->c_impl(), &tmp);
239
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
240 2 return String::createFrom(tmp);
241 }
242
243 1 String DirectoryEntry::Path() const
244 {
245 1 gate_string_t tmp = GATE_STRING_INIT_EMPTY;
246
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t result = gate_directory_entry_path(this->c_impl(), &tmp);
247
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
248 2 return String::createFrom(tmp);
249 }
250 1 String DirectoryEntry::Name() const
251 {
252 1 gate_string_t tmp = GATE_STRING_INIT_EMPTY;
253
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t result = gate_directory_entry_name(this->c_impl(), &tmp);
254
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
255 2 return String::createFrom(tmp);
256 }
257 1 String DirectoryEntry::ParentPath() const
258 {
259 1 gate_string_t tmp = GATE_STRING_INIT_EMPTY;
260
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t result = gate_directory_entry_parent_path(this->c_impl(), &tmp);
261
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
262 2 return String::createFrom(tmp);
263 }
264
265 3 Value DirectoryEntry::getProperty(String const& propName) const
266 {
267 3 Value value;
268
1/2
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
3 result_t result = gate_directory_entry_get_property(this->c_impl(), propName.c_impl(), value.c_impl());
269
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
3 GATEXX_CHECK_EXCEPTION(result);
270 2 return value;
271 }
272 1 void DirectoryEntry::setProperty(String const& propName, Value const& value)
273 {
274 1 result_t result = gate_directory_entry_set_property(this->c_impl(), propName.c_impl(), value.c_impl());
275
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 GATEXX_CHECK_EXCEPTION(result);
276 1 }
277 1 void DirectoryEntry::refreshProperties()
278 {
279 1 result_t result = gate_directory_entry_refresh_properties(this->c_impl());
280
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 GATEXX_CHECK_ERROR(result);
281 ✗ }
282
283 11 DirectoryEntry DirectoryEntry::create(
284 gate_directory_provider_t* provider,
285 String const& entryUid,
286 String const& classUid,
287 String const& name,
288 String const& path,
289 String const& parentPath,
290 Map<String, Value> const& properties)
291 {
292
1/2
✓ Branch 1 taken 11 times.
✗ Branch 2 not taken.
11 gate_map_t strvalue_map = util::convertStringValueMap(properties);
293
1/2
✓ Branch 6 taken 11 times.
✗ Branch 7 not taken.
11 gate_directory_entry_t* ptrEntry = gate_directory_entry_create(provider,
294 entryUid.c_impl(),
295 classUid.c_impl(),
296 name.c_impl(),
297 path.c_impl(),
298 parentPath.c_impl(),
299 &strvalue_map
300 );
301
1/2
✓ Branch 1 taken 11 times.
✗ Branch 2 not taken.
11 gate_map_destroy(&strvalue_map);
302
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
11 if(ptrEntry == NULL)
303 {
304 ✗ GATEXX_RAISE_ERROR(results::OutOfMemory);
305 }
306 22 return DirectoryEntry(ptrEntry);
307 }
308
309 24 DirectoryEntry DirectoryEntry::retainEntry(gate_directory_entry_t* ptrEntry)
310 {
311 24 DirectoryEntry entry(ptrEntry);
312
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 gate_object_retain(ptrEntry);
313 24 return entry;
314 }
315
316
317
318
319
320
321 10 DirectoryProvider::DirectoryProvider(gate_directory_provider_t* dir_prov)
322 10 : object_impl_t(dir_prov)
323 {
324 10 }
325 30 DirectoryProvider::DirectoryProvider(DirectoryProvider const& src)
326 30 : object_impl_t(src)
327 {
328 30 }
329
330 1 String DirectoryProvider::ProviderName()
331 {
332 1 gate_string_t tmp = GATE_STRING_INIT_EMPTY;
333
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t result = gate_directory_provider_provider_name(this->c_impl(), &tmp);
334
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
335 2 return String::createFrom(tmp);
336 }
337
338 1 size_t DirectoryProvider::getClassesCount()
339 {
340 1 size_t ret = 0;
341
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t result = gate_directory_provider_get_classes_count(this->c_impl(), &ret);
342
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
343 1 return ret;
344 }
345 1 DirectoryClass DirectoryProvider::getClass(size_t index)
346 {
347 1 gate_directory_class_t* ptr_class = NULL;
348
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 result_t result = gate_directory_provider_get_class(this->c_impl(), index, &ptr_class);
349
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_ERROR(result);
350 2 return DirectoryClass(ptr_class);
351 }
352 1 DirectoryClass DirectoryProvider::findClass(String const& classUid)
353 {
354 1 gate_directory_class_t* ptr_class = NULL;
355
1/2
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 result_t result = gate_directory_provider_find_class(this->c_impl(), classUid.c_impl(), &ptr_class);
356
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_EXCEPTION(result);
357 2 return DirectoryClass(ptr_class);
358 }
359
360 2 DirectoryEntry DirectoryProvider::getEntry(String const& entryPath)
361 {
362 2 gate_directory_entry_t* ptr_entry = NULL;
363
1/2
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 result_t result = gate_directory_provider_get_entry_by_path(this->c_impl(), entryPath.c_impl(), &ptr_entry);
364
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 GATEXX_CHECK_EXCEPTION(result);
365 2 return DirectoryEntry(ptr_entry);
366 }
367 2 DirectoryEntry DirectoryProvider::getEntryByUid(String const& entryUid)
368 {
369 2 gate_directory_entry_t* ptr_entry = NULL;
370
1/2
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 result_t result = gate_directory_provider_get_entry_by_uid(this->c_impl(), entryUid.c_impl(), &ptr_entry);
371
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 GATEXX_CHECK_EXCEPTION(result);
372 2 return DirectoryEntry(ptr_entry);
373 }
374
375 struct GATE_API_LOCAL search_callback_dispatcher_param
376 {
377 DirectoryProvider::SearchDelegate const* ptrDelegate;
378 void* ptrParam;
379 };
380
381 1 static gate_bool_t GATE_CALL search_callback_dispatcher(gate_directory_entry_t* ptr_entry, void* param)
382 {
383 1 struct search_callback_dispatcher_param* dispParam = (struct search_callback_dispatcher_param*)param;
384 1 gate_bool_t ret = true;
385 1 DirectoryEntry entry(ptr_entry);
386
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate_object_retain(ptr_entry);
387
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
1 GATEXX_TRY_CATCHALL(
388 {
389 dispParam->ptrDelegate->invoke(&entry, &ret, dispParam->ptrParam);
390 },
391 {
392 ret = false;
393 }
394 );
395 2 return ret;
396 }
397
398
399 2 void DirectoryProvider::searchEntries(DirectoryEntry root, String const& query, enumint_t searchFlags,
400 SearchDelegate const& callback, void* callbackParam)
401 {
402 result_t result;
403 struct search_callback_dispatcher_param dispParam;
404 2 dispParam.ptrDelegate = &callback;
405 2 dispParam.ptrParam = callbackParam;
406
407
1/2
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
2 result = gate_directory_provider_search_entries(
408 this->c_impl(), root.c_impl(), query.c_impl(), searchFlags,
409 &search_callback_dispatcher, &dispParam);
410
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 GATEXX_CHECK_EXCEPTION(result);
411 1 }
412
413 2 bool DirectoryProvider::hasChild(DirectoryEntry root, String const& classUid, String const& name, Optional<DirectoryEntry>* ptrEntry)
414 {
415 2 result_t result = gate_directory_provider_get_child_entry(this->c_impl(), root.c_impl(), classUid.c_impl(), name.c_impl(), NULL);
416 2 return GATE_SUCCEEDED(result);
417 }
418 2 DirectoryEntry DirectoryProvider::getChild(DirectoryEntry root, String const& classUid, String const& name)
419 {
420 2 gate_directory_entry_t* ptr_entry = NULL;
421
1/2
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
2 result_t result = gate_directory_provider_get_child_entry(this->c_impl(), root.c_impl(), classUid.c_impl(), name.c_impl(), &ptr_entry);
422
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 GATEXX_CHECK_EXCEPTION(result);
423 2 return DirectoryEntry(ptr_entry);
424 }
425
426 2 DirectoryEntry DirectoryProvider::createEntry(DirectoryEntry parent, String const& classUid, String const& childName,
427 Map<String, Value> const& properties, Stream* optionalStream)
428 {
429 2 gate_directory_entry_t* ptr_entry = NULL;
430
2/4
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
2 result_t result = gate_directory_provider_create_entry(this->c_impl(), parent.c_impl(), classUid.c_impl(),
431 childName.c_impl(), properties.c_impl(),
432 (optionalStream ? optionalStream->c_impl() : NULL),
433 &ptr_entry);
434
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 GATEXX_CHECK_EXCEPTION(result);
435 2 return DirectoryEntry(ptr_entry);
436 }
437 2 void DirectoryProvider::deleteEntry(DirectoryEntry entry)
438 {
439 2 result_t result = gate_directory_provider_delete_entry(this->c_impl(), entry.c_impl());
440
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 GATEXX_CHECK_EXCEPTION(result);
441 1 }
442 2 DirectoryEntry DirectoryProvider::copyEntry(DirectoryEntry source, DirectoryEntry targetContainer, String const& newName, enumint_t copyFlags)
443 {
444 2 gate_directory_entry_t* ptr_entry = NULL;
445
1/2
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
2 result_t result = gate_directory_provider_copy_entry(this->c_impl(), source.c_impl(), targetContainer.c_impl(),
446 newName.c_impl(), copyFlags, &ptr_entry);
447
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 GATEXX_CHECK_EXCEPTION(result);
448 2 return DirectoryEntry(ptr_entry);
449 }
450 2 DirectoryEntry DirectoryProvider::moveEntry(DirectoryEntry source, DirectoryEntry targetContainer, String const& newName, enumint_t moveFlags)
451 {
452 2 gate_directory_entry_t* ptr_entry = NULL;
453
1/2
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
2 result_t result = gate_directory_provider_move_entry(this->c_impl(), source.c_impl(), targetContainer.c_impl(),
454 newName.c_impl(), moveFlags, &ptr_entry);
455
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 GATEXX_CHECK_EXCEPTION(result);
456 2 return DirectoryEntry(ptr_entry);
457 }
458
459 2 Map<String, Value> DirectoryProvider::readProperties(DirectoryEntry source, Array<String> const& names)
460 {
461 2 gate_map_t strvalueMap = GATE_INIT_EMPTY;
462
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 gate_arraylist_t rawNameList = util::convertStringArray(names);
463
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 GenericArrayList nameList = GenericArrayList::createFrom(rawNameList);
464
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 GenericArray nameArray = nameList.toArray();
465
1/2
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
2 result_t result = gate_directory_provider_read_properties(this->c_impl(), source.c_impl(), nameArray.c_impl(), &strvalueMap);
466
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 GATEXX_CHECK_EXCEPTION(result);
467 2 util::ScopeExit deferredCleanup(&gate_map_destructor, &strvalueMap);
468
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Map<String, Value> ret = util::convertStringValueMap(strvalueMap);
469 2 return ret;
470 }
471
472 2 void DirectoryProvider::writeProperties(DirectoryEntry source, Map<String, Value> const& propMap)
473 {
474
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 gate_map_t strvalueMap = util::convertStringValueMap(propMap);
475 4 util::ScopeExit deferredCleanup(&gate_map_destructor, &strvalueMap);
476
477
1/2
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 result_t result = gate_directory_provider_write_properties(this->c_impl(), source.c_impl(), &strvalueMap);
478
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 GATEXX_CHECK_EXCEPTION(result);
479 1 }
480
481 2 Stream DirectoryProvider::openStream(DirectoryEntry source, String const& streamName, enumint_t openFlags)
482 {
483 2 gate_stream_t* ptr_stream = NULL;
484
1/2
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
2 result_t result = gate_directory_provider_open_stream(this->c_impl(), source.c_impl(), streamName.c_impl(),
485 openFlags, &ptr_stream);
486
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 GATEXX_CHECK_EXCEPTION(result);
487
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 return Stream(ptr_stream);
488 }
489
490
491
492 2 DirectoryProviderFactory::DirectoryProviderFactory()
493 2 : ptrProvider(NULL)
494 {
495 2 }
496
497 ✗ DirectoryProviderFactory::~DirectoryProviderFactory() noexcept
498 {
499 ✗ }
500
501 2 void DirectoryProviderFactory::setProviderName(String const& name)
502 {
503 2 this->providerName = name;
504 2 }
505
506 2 void DirectoryProviderFactory::setProviderClasses(Array<DirectoryClass> const& classes)
507 {
508 2 this->providerClasses = classes;
509 2 }
510
511 10 Result<DirectoryProvider> DirectoryProviderFactory::tryCreateProvider()
512 {
513
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
10 if (this->ptrProvider == NULL)
514 {
515 2 DirectoryProviderFactory* ptrFactory = this;
516
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 ArrayList<gate_directory_class_t*> classPtrs;
517
2/2
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2 times.
4 GATEXX_ENUMERATE(const DirectoryClass, e, this->providerClasses.enumerate())
518 {
519
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
2 classPtrs.add(e->c_impl());
520 }
521
1/2
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 this->ptrProvider = gate_directory_provider_base_create(
522 this->providerName.c_impl(),
523 classPtrs.getItemPtr(0),
524 classPtrs.length(),
525 &ptrFactory, sizeof(ptrFactory),
526 &disp_init,
527 &disp_uninit,
528 &disp_entry_by_path,
529 &disp_entry_by_uid,
530 &disp_search,
531 &disp_child,
532 &disp_create,
533 &disp_delete,
534 &disp_copy,
535 &disp_move,
536 &disp_readprops,
537 &disp_writeprops,
538 &disp_open);
539
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (this->ptrProvider == NULL)
540 {
541 ✗ return makeErrResult(results::OutOfMemory);
542 }
543 }
544 else
545 {
546
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 gate_object_retain(this->ptrProvider);
547 }
548 10 DirectoryProvider ret(this->ptrProvider);
549
2/4
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
10 return makeOk(ret);
550 }
551
552 24 DirectoryProviderFactory* DirectoryProviderFactory::getSelf(void* internalBlock)
553 {
554 24 DirectoryProviderFactory* self = NULL;
555
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 gate_mem_copy(&self, internalBlock, sizeof(self));
556 24 return self;
557 }
558
559 2 gate_result_t DirectoryProviderFactory::disp_init(gate_directory_provider_t* provider, void* internal_block)
560 {
561 2 return results::Ok;
562 }
563
564 2 gate_result_t DirectoryProviderFactory::disp_uninit(gate_directory_provider_t* provider, void* internal_block)
565 {
566 2 return results::Ok;
567 }
568
569 2 gate_result_t DirectoryProviderFactory::disp_entry_by_path(
570 gate_directory_provider_t* provider, void* internal_block,
571 gate_string_t const* path, gate_directory_entry_t** ptr_entry)
572 {
573
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 DirectoryProviderFactory* const self = getSelf(internal_block);
574 4 String strPath = String::duplicate(*path);
575
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 Result<DirectoryEntry> result = self->tryGetEntry(strPath);
576
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
2 if (result.hasError())
577 {
578 1 return result.error();
579 }
580 else
581 {
582
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (ptr_entry != NULL)
583 {
584 1 *ptr_entry = result.value().c_impl();
585
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate_object_retain(*ptr_entry);
586 }
587 1 return results::Ok;
588 }
589 }
590
591 2 gate_result_t DirectoryProviderFactory::disp_entry_by_uid(
592 gate_directory_provider_t* provider, void* internal_block,
593 gate_string_t const* uid, gate_directory_entry_t** ptr_entry)
594 {
595
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 DirectoryProviderFactory* const self = getSelf(internal_block);
596 4 String strUid = String::duplicate(*uid);
597
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 Result<DirectoryEntry> result = self->tryGetEntryByUid(strUid);
598
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
2 if (result.hasError())
599 {
600 1 return result.error();
601 }
602 else
603 {
604
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (ptr_entry != NULL)
605 {
606 1 *ptr_entry = result.value().c_impl();
607
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate_object_retain(*ptr_entry);
608 }
609 1 return results::Ok;
610 }
611 }
612
613 struct disp_search_param
614 {
615 gate_directory_search_callback_t callback;
616 void* callback_param;
617 };
618
619 1 static void disp_search_callback(DirectoryEntry* entry, bool* continueSearch, void* param)
620 {
621 1 struct disp_search_param* ptrParam = (struct disp_search_param*)param;
622 1 *continueSearch = ptrParam->callback(entry->c_impl(), ptrParam->callback_param);
623 1 }
624
625 2 gate_result_t DirectoryProviderFactory::disp_search(
626 gate_directory_provider_t* provider, void* internal_block,
627 gate_directory_entry_t* search_root, gate_string_t const* query, gate_enumint_t search_flags,
628 gate_directory_search_callback_t callback, void* callback_param)
629 {
630
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 DirectoryProviderFactory* const self = getSelf(internal_block);
631
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 DirectoryEntry searchRoot = DirectoryEntry::retainEntry(search_root);
632
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 String strQuery(*query);
633 struct disp_search_param search_params;
634 2 search_params.callback = callback;
635 2 search_params.callback_param = callback_param;
636
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 DirectoryProvider::SearchDelegate callbackDelegate(&disp_search_callback);
637
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
4 VoidResult result = self->trySearchEntries(searchRoot, strQuery, search_flags, callbackDelegate, &search_params);
638
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
2 if (result.hasError())
639 {
640 1 return result.error();
641 }
642 else
643 {
644 1 return results::Ok;
645 }
646 }
647
648 4 gate_result_t DirectoryProviderFactory::disp_child(
649 gate_directory_provider_t* provider, void* internal_block,
650 gate_directory_entry_t* search_root, gate_string_t const* class_uid,
651 gate_string_t const* child_name, gate_directory_entry_t** return_entry_ptr)
652 {
653
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 DirectoryProviderFactory* const self = getSelf(internal_block);
654
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
8 DirectoryEntry searchRoot = DirectoryEntry::retainEntry(search_root);
655 8 String strClassUid = String::duplicate(*class_uid);
656 8 String strChildName = String::duplicate(*child_name);
657
1/2
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
8 Result<DirectoryEntry> result = self->tryGetChild(searchRoot, strClassUid, strChildName);
658
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
4 if (result.hasError())
659 {
660 2 return result.error();
661 }
662 else
663 {
664
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 if (return_entry_ptr != NULL)
665 {
666 2 DirectoryEntry entry = result.value();
667 1 *return_entry_ptr = entry.c_impl();
668
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate_object_retain(*return_entry_ptr);
669 }
670 2 return results::Ok;
671 }
672 }
673
674 2 gate_result_t DirectoryProviderFactory::disp_create(
675 gate_directory_provider_t* provider, void* internal_block,
676 gate_directory_entry_t* parent, gate_string_t const* class_uid,
677 gate_string_t const* child_name, gate_map_t const* propname_to_value_map,
678 gate_stream_t* stream_to_copy, gate_directory_entry_t** return_entry_ptr)
679 {
680
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 DirectoryProviderFactory* const self = getSelf(internal_block);
681
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 DirectoryEntry parentEntry = DirectoryEntry::retainEntry(parent);
682 4 String strClassUid = String::duplicate(*class_uid);
683 4 String strChildName = String::duplicate(*child_name);
684 4 Map<String, Value> strvalMap;
685
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (propname_to_value_map != NULL)
686 {
687
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 strvalMap = util::convertStringValueMap(*propname_to_value_map);
688 }
689 4 Stream entryStream = NullStream();
690
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (stream_to_copy != NULL)
691 {
692 ✗ entryStream = Stream(stream_to_copy);
693 ✗ gate_object_retain(stream_to_copy);
694 }
695 Result<DirectoryEntry> result = self->tryCreateEntry(
696 parentEntry, strClassUid, strChildName, strvalMap,
697
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
4 stream_to_copy == NULL ? NULL : &entryStream);
698
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
2 if (result.hasError())
699 {
700 1 return result.error();
701 }
702 else
703 {
704
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (return_entry_ptr != NULL)
705 {
706 2 DirectoryEntry entry = result.value();
707 1 *return_entry_ptr = entry.c_impl();
708
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate_object_retain(*return_entry_ptr);
709 }
710 1 return results::Ok;
711 }
712 }
713
714 2 gate_result_t DirectoryProviderFactory::disp_delete(
715 gate_directory_provider_t* provider, void* internal_block,
716 gate_directory_entry_t* entry)
717 {
718
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 DirectoryProviderFactory* const self = getSelf(internal_block);
719
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 DirectoryEntry deleteEntry = DirectoryEntry::retainEntry(entry);
720
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
4 VoidResult result = self->tryDeleteEntry(deleteEntry);
721
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
2 if (result.hasError())
722 {
723 1 return result.error();
724 }
725 else
726 {
727 1 return results::Ok;
728 }
729 }
730
731 2 gate_result_t DirectoryProviderFactory::disp_copy(
732 gate_directory_provider_t* provider, void* internal_block,
733 gate_directory_entry_t* source, gate_directory_entry_t* target_container,
734 gate_string_t const* new_name, gate_enumint_t copy_flags,
735 gate_directory_entry_t** return_entry_ptr)
736 {
737
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 DirectoryProviderFactory* const self = getSelf(internal_block);
738
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 DirectoryEntry sourceEntry = DirectoryEntry::retainEntry(source);
739
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 DirectoryEntry targetContainer = DirectoryEntry::retainEntry(target_container);
740 4 String newName = String::duplicate(*new_name);
741
1/2
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
6 Result<DirectoryEntry> result = self->tryCopyEntry(sourceEntry, targetContainer, newName, copy_flags);
742
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
2 if (result.hasError())
743 {
744 1 return result.error();
745 }
746 else
747 {
748 1 *return_entry_ptr = result.value().c_impl();
749
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate_object_retain(*return_entry_ptr);
750 1 return results::Ok;
751 }
752 }
753
754 2 gate_result_t DirectoryProviderFactory::disp_move(
755 gate_directory_provider_t* provider, void* internal_block,
756 gate_directory_entry_t* source, gate_directory_entry_t* target_container,
757 gate_string_t const* new_name, gate_enumint_t move_flags,
758 gate_directory_entry_t** return_entry_ptr)
759 {
760
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 DirectoryProviderFactory* const self = getSelf(internal_block);
761
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 DirectoryEntry sourceEntry = DirectoryEntry::retainEntry(source);
762
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 DirectoryEntry targetContainer = DirectoryEntry::retainEntry(target_container);
763 4 String newName = String::duplicate(*new_name);
764
1/2
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
6 Result<DirectoryEntry> result = self->tryMoveEntry(sourceEntry, targetContainer, newName, move_flags);
765
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
2 if (result.hasError())
766 {
767 1 return result.error();
768 }
769 else
770 {
771 1 *return_entry_ptr = result.value().c_impl();
772
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate_object_retain(*return_entry_ptr);
773 1 return results::Ok;
774 }
775 }
776
777 2 gate_result_t DirectoryProviderFactory::disp_readprops(
778 gate_directory_provider_t* provider, void* internal_block,
779 gate_directory_entry_t* source, gate_array_t const* prop_names,
780 gate_map_t* out_str_value_map)
781 {
782
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 DirectoryProviderFactory* const self = getSelf(internal_block);
783
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 DirectoryEntry sourceEntry = DirectoryEntry::retainEntry(source);
784
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 ArrayList<String> listPropNames = util::convertStringArray(*prop_names);
785
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
6 Result<Map<String, Value> > result = self->tryReadProperties(sourceEntry, listPropNames.toArray());
786
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
2 if (result.hasError())
787 {
788 1 return result.error();
789 }
790 else
791 {
792
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (out_str_value_map)
793 {
794
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 *out_str_value_map = util::convertStringValueMap(result.value());
795 }
796 1 return results::Ok;
797 }
798 }
799
800 2 gate_result_t DirectoryProviderFactory::disp_writeprops(
801 gate_directory_provider_t* provider, void* internal_block,
802 gate_directory_entry_t* source, gate_map_t const* str_value_map)
803 {
804
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 DirectoryProviderFactory* const self = getSelf(internal_block);
805
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 DirectoryEntry sourceEntry = DirectoryEntry::retainEntry(source);
806
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 Map<String, Value> propsMap = util::convertStringValueMap(*str_value_map);
807
808
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
4 VoidResult result = self->tryWriteProperties(sourceEntry, propsMap);
809
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
2 if (result.hasError())
810 {
811 1 return result.error();
812 }
813 else
814 {
815 1 return results::Ok;
816 }
817 }
818
819 2 gate_result_t DirectoryProviderFactory::disp_open(
820 gate_directory_provider_t* provider, void* internal_block,
821 gate_directory_entry_t* source, gate_string_t const* stream_name,
822 gate_enumint_t open_flags, gate_stream_t** return_stream)
823 {
824
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 DirectoryProviderFactory* const self = getSelf(internal_block);
825
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 DirectoryEntry sourceEntry = DirectoryEntry::retainEntry(source);
826 4 String streamName = String::duplicate(*stream_name);
827
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
4 Result<Stream> result = self->tryOpenStream(sourceEntry, streamName, open_flags);
828
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
2 if (result.hasError())
829 {
830 1 return result.error();
831 }
832 else
833 {
834 1 *return_stream = result.value().c_impl();
835
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate_object_retain(*return_stream);
836 1 return results::Ok;
837 }
838 }
839
840 } // end of namespace gate
841