GCC Code Coverage Report


Directory: src/gate/
File: src/gate/directories.h
Date: 2026-03-20 22:56:14
Exec Total Coverage
Lines: 0 1 0.0%
Functions: 0 2 0.0%
Branches: 0 7 0.0%

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 /** @file
30 * @brief Abstract interface for directory providers
31 * @ingroup gatecore
32 */
33
34 #ifndef GATE_DIRECTORIES_H_INCLUDED
35 #define GATE_DIRECTORIES_H_INCLUDED
36
37 #include "gate/gate_core_api.h"
38 #include "gate/objects.h"
39 #include "gate/values.h"
40 #include "gate/delegates.h"
41 #include "gate/streams.h"
42 #include "gate/maps.h"
43
44 #if defined(__cplusplus)
45 extern "C" {
46 #endif
47
48 #define GATE_INTERFACE_NAME_DIRECTORYCLASS GATE_INTERFACE_NAME_OBJECT GATE_INTERFACE_NAME_SEPARATOR "directory_class"
49
50 #define GATE_DIRECTORY_PROPERTY_FLAG_OPTIONAL 0x0001
51
52 typedef struct gate_directory_propertydef_class
53 {
54 gate_type_id_t data_type;
55 gate_string_t name;
56 gate_uint32_t flags;
57 } gate_directory_propertydef_t;
58
59
60 GATE_CORE_API gate_directory_propertydef_t* GATE_CALL gate_directory_propertydef_create(
61 gate_directory_propertydef_t* propdef,
62 gate_type_id_t type,
63 gate_string_t const* name,
64 gate_uint32_t flags
65 );
66
67
68 GATE_CORE_API void GATE_CALL gate_directory_propertydef_release(
69 gate_directory_propertydef_t* propdef
70 );
71
72
73 /** @brief directory class instances can contain child directory entries */
74 #define GATE_DIRECTORY_CLASS_FLAG_CONTAINER 0x0001
75
76 /** @brief directory class instances can contain streams */
77 #define GATE_DIRECTORY_CLASS_FLAG_STREAMS 0x0002
78
79 /** @brief directory class instances can be dynamically created */
80 #define GATE_DIRECTORY_CLASS_FLAG_CREATABLE 0x0004
81
82 GATE_INTERFACE(gate_directory_class)
83 {
84 GATE_METHOD0(char const*, get_interface_name);
85 GATE_METHOD0(void, release);
86 GATE_METHOD0(int, retain);
87
88 GATE_METHOD1(gate_result_t, uid, gate_string_t * return_uid);
89 GATE_METHOD1(gate_result_t, name, gate_string_t * return_name);
90 GATE_METHOD1(gate_result_t, flags, gate_uint32_t * return_flags);
91
92 GATE_METHOD1(gate_result_t, get_properties_count, gate_size_t * return_count);
93 GATE_METHOD2(gate_result_t, get_property, gate_size_t index, gate_directory_propertydef_t * return_prop_def);
94 GATE_METHOD2(gate_result_t, find_property, gate_string_t const* name, gate_directory_propertydef_t * return_prop_def);
95
96 GATE_METHOD1(gate_result_t, get_superior_classes_count, gate_size_t * return_count);
97 GATE_METHOD2(gate_result_t, get_superior_class_uid, gate_size_t index, gate_string_t * return_class_uid);
98
99 GATE_METHOD1(gate_result_t, get_containment_classes_count, gate_size_t * return_count);
100 GATE_METHOD2(gate_result_t, get_containment_class_uid, gate_size_t index, gate_string_t * return_class_uid);
101 };
102
103 #define gate_directory_class_uid(obj, return_uid) (obj)->vtbl->uid((obj), return_uid)
104 #define gate_directory_class_name(obj, return_name) (obj)->vtbl->name((obj), return_name)
105 #define gate_directory_class_flags(obj, return_flags) (obj)->vtbl->flags((obj), return_flags)
106
107 #define gate_directory_class_get_properties_count(obj, return_count) (obj)->vtbl->get_properties_count((obj), return_count)
108 #define gate_directory_class_get_property(obj, index, return_prop_def) (obj)->vtbl->get_property((obj), index, return_prop_def)
109 #define gate_directory_class_find_property(obj, name, return_prop_def) (obj)->vtbl->find_property((obj), name, return_prop_def)
110
111 #define gate_directory_class_get_superior_classes_count(obj, return_count) (obj)->vtbl->get_superior_classes_count((obj), return_count)
112 #define gate_directory_class_get_superior_class_uid(obj, index, return_class_uid) (obj)->vtbl->get_superior_class_uid((obj), index, return_class_uid)
113
114 #define gate_directory_class_get_containment_classes_count(obj, return_count) (obj)->vtbl->get_containment_classes_count((obj), return_count)
115 #define gate_directory_class_get_containment_class_uid(obj, index, return_class_uid) (obj)->vtbl->get_containment_class_uid((obj), index, return_class_uid)
116
117
118
119
120 #define GATE_INTERFACE_NAME_DIRECTORYENTRY GATE_INTERFACE_NAME_OBJECT GATE_INTERFACE_NAME_SEPARATOR "directory_entry"
121
122 GATE_INTERFACE(gate_directory_entry)
123 {
124 GATE_METHOD0(char const*, get_interface_name);
125 GATE_METHOD0(void, release);
126 GATE_METHOD0(int, retain);
127
128 GATE_METHOD1(gate_result_t, entry_uid, gate_string_t * return_entry_uid);
129 GATE_METHOD1(gate_result_t, class_uid, gate_string_t * return_class_uid);
130
131 GATE_METHOD1(gate_result_t, path, gate_string_t * return_path);
132 GATE_METHOD1(gate_result_t, name, gate_string_t * return_name);
133 GATE_METHOD1(gate_result_t, parent_path, gate_string_t * return_parent);
134
135 GATE_METHOD2(gate_result_t, get_property, gate_string_t const* prop_name, gate_value_t * return_value);
136 GATE_METHOD2(gate_result_t, set_property, gate_string_t const* prop_name, gate_value_t const* value);
137 GATE_METHOD0(gate_result_t, refresh_properties);
138 };
139
140 #define gate_directory_entry_entry_uid(obj, return_entry_uid) (obj)->vtbl->entry_uid((obj), return_entry_uid)
141 #define gate_directory_entry_class_uid(obj, return_class_uid) (obj)->vtbl->class_uid((obj), return_class_uid)
142
143 #define gate_directory_entry_path(obj, return_path) (obj)->vtbl->path((obj), return_path)
144 #define gate_directory_entry_name(obj, return_name) (obj)->vtbl->name((obj), return_name)
145 #define gate_directory_entry_parent_path(obj, return_parent) (obj)->vtbl->parent_path((obj), return_parent)
146
147 #define gate_directory_entry_get_property(obj, prop_name, return_value) (obj)->vtbl->get_property((obj), prop_name, return_value)
148 #define gate_directory_entry_set_property(obj, prop_name, value) (obj)->vtbl->set_property((obj), prop_name, value)
149 #define gate_directory_entry_refresh_properties(obj) (obj)->vtbl->refresh_properties((obj))
150
151
152 #define GATE_INTERFACE_NAME_DIRECTORYPROVIDER GATE_INTERFACE_NAME_OBJECT GATE_INTERFACE_NAME_SEPARATOR "directory_provider"
153
154
155 GATE_DELEGATE_DECLARE_3(gate_directory_search_cb,
156 gate_directory_entry_t* /* found entry */,
157 gate_bool_t* /* cancel_search */,
158 void* /* cb_param */);
159
160 GATE_INTERFACE(gate_directory_provider)
161 {
162 GATE_METHOD0(char const*, get_interface_name);
163 GATE_METHOD0(void, release);
164 GATE_METHOD0(int, retain);
165
166 GATE_METHOD1(gate_result_t, provider_name, gate_string_t * return_name);
167 GATE_METHOD1(gate_result_t, get_classes_count, gate_size_t * return_count);
168 GATE_METHOD2(gate_result_t, get_class, gate_size_t index, gate_directory_class_t * *return_class_ptr);
169 GATE_METHOD2(gate_result_t, find_class, gate_string_t const* class_uid, gate_directory_class_t * *return_class_ptr);
170
171 GATE_METHOD2(gate_result_t, get_entry_by_path, gate_string_t const* path, gate_directory_entry_t * *return_entry_ptr);
172 GATE_METHOD2(gate_result_t, get_entry_by_uid, gate_string_t const* uid, gate_directory_entry_t * *return_entry_ptr);
173
174 GATE_METHOD5(gate_result_t, search_entries, gate_directory_entry_t * search_root, gate_string_t const* query, gate_uint32_t search_flags,
175 gate_delegate_t const* callback, void* callback_param);
176
177 GATE_METHOD4(gate_result_t, get_child_entry, gate_directory_entry_t * parent,
178 gate_string_t const* class_uid, gate_string_t const* child_name,
179 gate_directory_entry_t * *return_entry_ptr);
180
181 GATE_METHOD6(gate_result_t, create_entry, gate_directory_entry_t * parent,
182 gate_string_t const* class_uid, gate_string_t const* child_name,
183 gate_map_t const* propname_to_value_map, gate_stream_t * stream_to_copy,
184 gate_directory_entry_t * *return_entry_ptr);
185
186 GATE_METHOD1(gate_result_t, delete_entry, gate_directory_entry_t * entry);
187
188 GATE_METHOD5(gate_result_t, copy_entry, gate_directory_entry_t * source, gate_directory_entry_t * target_container,
189 gate_string_t const* new_name, gate_uint32_t copy_flags,
190 gate_directory_entry_t * *return_entry_ptr);
191
192 GATE_METHOD5(gate_result_t, move_entry, gate_directory_entry_t * source, gate_directory_entry_t * target_container,
193 gate_string_t const* new_name, gate_uint32_t move_flags,
194 gate_directory_entry_t * *return_entry_ptr);
195
196 GATE_METHOD4(gate_result_t, open_stream, gate_directory_entry_t * source, gate_string_t const* stream_name, gate_uint32_t open_flags,
197 gate_stream_t * *return_stream);
198
199 };
200
201
202 #define gate_directory_provider_provider_name(obj, return_name) \
203 (obj)->vtbl->provider_name((obj), return_name)
204
205 #define gate_directory_provider_get_classes_count(obj, return_count) \
206 (obj)->vtbl->get_classes_count((obj), return_count)
207
208 #define gate_directory_provider_get_class(obj, index, return_class_ptr) \
209 (obj)->vtbl->get_class((obj), index, return_class_ptr)
210
211 #define gate_directory_provider_find_class(obj, class_uid, return_class_ptr) \
212 (obj)->vtbl->find_class((obj), class_uid, return_class_ptr)
213
214 #define gate_directory_provider_get_entry_by_path(obj, path, return_entry_ptr) \
215 (obj)->vtbl->get_entry_by_path((obj), path, return_entry_ptr)
216
217 #define gate_directory_provider_get_entry_by_uid(obj, uid, return_entry_ptr) \
218 (obj)->vtbl->get_entry_by_uid((obj), uid, return_entry_ptr)
219
220 #define gate_directory_provider_search_entries(obj, search_root, query, search_flags, callback, callback_param) \
221 (obj)->vtbl->search_entries((obj), search_root, query, search_flags, callback, callback_param)
222
223 #define gate_directory_provider_get_child_entry(obj, parent, class_uid, child_name, return_entry_ptr) \
224 (obj)->vtbl->get_child_entry((obj), parent, class_uid, child_name, return_entry_ptr)
225
226 #define gate_directory_provider_create_entry(obj, parent, class_uid, child_name, propname_to_value_map, stream_to_copy, return_entry_ptr) \
227 (obj)->vtbl->create_entry((obj), parent, class_uid, child_name, propname_to_value_map, stream_to_copy, return_entry_ptr)
228
229 #define gate_directory_provider_delete_entry(obj, entry) \
230 (obj)->vtbl->delete_entry((obj), entry)
231
232 #define gate_directory_provider_copy_entry(obj, source, target_container, new_name, copy_flags, return_entry_ptr) \
233 (obj)->vtbl->copy_entry((obj), source, target_container, new_name, copy_flags, return_entry_ptr)
234
235 #define gate_directory_provider_move_entry(obj, source, target_container, new_name, move_flags, return_entry_ptr) \
236 (obj)->vtbl->move_entry((obj), source, target_container, new_name, move_flags, return_entry_ptr)
237
238 #define gate_directory_provider_open_stream(obj, source, stream_name, open_flags, return_stream) \
239 (obj)->vtbl->open_stream((obj), source, stream_name, open_flags, return_stream)
240
241
242
243 #if defined(__cplusplus)
244 }
245 #endif
246
247 #endif
248
249