@@ -177,151 +177,151 @@ bool fossil_mapof_is_empty(const fossil_mapof_t* map);
177177
178178namespace fossil {
179179
180- namespace tofu {
180+ namespace tofu {
181181
182- /* *
183- * @brief A C++ wrapper class for the fossil_mapof_t structure.
184- */
185- class MapOf {
186- public:
187182 /* *
188- * @brief Construct a new MapOf object with specified key and value types.
189- *
190- * @param key_type The type of the keys.
191- * @param value_type The type of the values.
183+ * @brief A C++ wrapper class for the fossil_mapof_t structure.
192184 */
193- MapOf (const std::string& key_type, const std::string& value_type) {
194- map = fossil_mapof_create_container (const_cast <char *>(key_type.c_str ()), const_cast <char *>(value_type.c_str ()));
195- if (map == nullptr ) {
196- throw std::runtime_error (" Failed to create map container" );
185+ class MapOf {
186+ public:
187+ /* *
188+ * @brief Construct a new MapOf object with specified key and value types.
189+ *
190+ * @param key_type The type of the keys.
191+ * @param value_type The type of the values.
192+ */
193+ MapOf (const std::string& key_type, const std::string& value_type) {
194+ map = fossil_mapof_create_container (const_cast <char *>(key_type.c_str ()), const_cast <char *>(value_type.c_str ()));
195+ if (map == nullptr ) {
196+ throw std::runtime_error (" Failed to create map container" );
197+ }
197198 }
198- }
199199
200- /* *
201- * @brief Construct a new MapOf object with default key and value types.
202- */
203- MapOf () {
204- map = fossil_mapof_create_default ();
205- if (map == nullptr ) {
206- throw std::runtime_error (" Failed to create map container" );
200+ /* *
201+ * @brief Construct a new MapOf object with default key and value types.
202+ */
203+ MapOf () {
204+ map = fossil_mapof_create_default ();
205+ if (map == nullptr ) {
206+ throw std::runtime_error (" Failed to create map container" );
207+ }
207208 }
208- }
209209
210- /* *
211- * @brief Construct a new MapOf object by copying an existing MapOf object.
212- *
213- * @param other The MapOf object to copy.
214- */
215- MapOf (const MapOf& other) {
216- map = fossil_mapof_create_copy (other.map );
217- if (map == nullptr ) {
218- throw std::runtime_error (" Failed to create map container" );
210+ /* *
211+ * @brief Construct a new MapOf object by copying an existing MapOf object.
212+ *
213+ * @param other The MapOf object to copy.
214+ */
215+ MapOf (const MapOf& other) {
216+ map = fossil_mapof_create_copy (other.map );
217+ if (map == nullptr ) {
218+ throw std::runtime_error (" Failed to create map container" );
219+ }
219220 }
220- }
221221
222- /* *
223- * @brief Construct a new MapOf object by moving an existing MapOf object.
224- *
225- * @param other The MapOf object to move.
226- */
227- MapOf (MapOf&& other) {
228- map = fossil_mapof_create_move (other.map );
229- if (map == nullptr ) {
230- throw std::runtime_error (" Failed to create map container" );
222+ /* *
223+ * @brief Construct a new MapOf object by moving an existing MapOf object.
224+ *
225+ * @param other The MapOf object to move.
226+ */
227+ MapOf (MapOf&& other) {
228+ map = fossil_mapof_create_move (other.map );
229+ if (map == nullptr ) {
230+ throw std::runtime_error (" Failed to create map container" );
231+ }
231232 }
232- }
233233
234- /* *
235- * @brief Destroy the MapOf object and free its memory.
236- */
237- ~MapOf () {
238- fossil_mapof_destroy (map);
239- }
234+ /* *
235+ * @brief Destroy the MapOf object and free its memory.
236+ */
237+ ~MapOf () {
238+ fossil_mapof_destroy (map);
239+ }
240240
241- /* *
242- * @brief Insert a key-value pair into the map.
243- *
244- * @param key The key to insert.
245- * @param value The value to insert.
246- * @return 0 on success, non-zero on failure.
247- */
248- int32_t insert (const std::string& key, const std::string& value) {
249- return fossil_mapof_insert (map, const_cast <char *>(key.c_str ()), const_cast <char *>(value.c_str ()));
250- }
241+ /* *
242+ * @brief Insert a key-value pair into the map.
243+ *
244+ * @param key The key to insert.
245+ * @param value The value to insert.
246+ * @return 0 on success, non-zero on failure.
247+ */
248+ int32_t insert (const std::string& key, const std::string& value) {
249+ return fossil_mapof_insert (map, const_cast <char *>(key.c_str ()), const_cast <char *>(value.c_str ()));
250+ }
251251
252- /* *
253- * @brief Remove a key-value pair from the map.
254- *
255- * @param key The key to remove.
256- * @return 0 on success, non-zero on failure.
257- */
258- int32_t remove (const std::string& key) {
259- return fossil_mapof_remove (map, const_cast <char *>(key.c_str ()));
260- }
252+ /* *
253+ * @brief Remove a key-value pair from the map.
254+ *
255+ * @param key The key to remove.
256+ * @return 0 on success, non-zero on failure.
257+ */
258+ int32_t remove (const std::string& key) {
259+ return fossil_mapof_remove (map, const_cast <char *>(key.c_str ()));
260+ }
261261
262- /* *
263- * @brief Check if the map contains a key.
264- *
265- * @param key The key to check.
266- * @return True if the key is found, false otherwise.
267- */
268- bool contains (const std::string& key) {
269- return fossil_mapof_contains (map, const_cast <char *>(key.c_str ()));
270- }
262+ /* *
263+ * @brief Check if the map contains a key.
264+ *
265+ * @param key The key to check.
266+ * @return True if the key is found, false otherwise.
267+ */
268+ bool contains (const std::string& key) {
269+ return fossil_mapof_contains (map, const_cast <char *>(key.c_str ()));
270+ }
271271
272- /* *
273- * @brief Get the value associated with a key in the map.
274- *
275- * @param key The key to look up.
276- * @return The value associated with the key.
277- */
278- fossil_tofu_t get (const std::string& key) {
279- return fossil_mapof_get (map, const_cast <char *>(key.c_str ()));
280- }
272+ /* *
273+ * @brief Get the value associated with a key in the map.
274+ *
275+ * @param key The key to look up.
276+ * @return The value associated with the key.
277+ */
278+ fossil_tofu_t get (const std::string& key) {
279+ return fossil_mapof_get (map, const_cast <char *>(key.c_str ()));
280+ }
281281
282- /* *
283- * @brief Set the value associated with a key in the map.
284- *
285- * @param key The key to set.
286- * @param value The value to set.
287- * @return 0 on success, non-zero on failure.
288- */
289- int32_t set (const std::string& key, const std::string& value) {
290- return fossil_mapof_set (map, const_cast <char *>(key.c_str ()), const_cast <char *>(value.c_str ()));
291- }
282+ /* *
283+ * @brief Set the value associated with a key in the map.
284+ *
285+ * @param key The key to set.
286+ * @param value The value to set.
287+ * @return 0 on success, non-zero on failure.
288+ */
289+ int32_t set (const std::string& key, const std::string& value) {
290+ return fossil_mapof_set (map, const_cast <char *>(key.c_str ()), const_cast <char *>(value.c_str ()));
291+ }
292292
293- /* *
294- * @brief Get the number of elements in the map.
295- *
296- * @return The number of elements in the map.
297- */
298- size_t size () {
299- return fossil_mapof_size (map);
300- }
293+ /* *
294+ * @brief Get the number of elements in the map.
295+ *
296+ * @return The number of elements in the map.
297+ */
298+ size_t size () {
299+ return fossil_mapof_size (map);
300+ }
301301
302- /* *
303- * @brief Check if the map is not empty.
304- *
305- * @return True if the map is not empty, false otherwise.
306- */
307- bool not_empty () {
308- return fossil_mapof_not_empty (map);
309- }
302+ /* *
303+ * @brief Check if the map is not empty.
304+ *
305+ * @return True if the map is not empty, false otherwise.
306+ */
307+ bool not_empty () {
308+ return fossil_mapof_not_empty (map);
309+ }
310310
311- /* *
312- * @brief Check if the map is empty.
313- *
314- * @return True if the map is empty, false otherwise.
315- */
316- bool is_empty () {
317- return fossil_mapof_is_empty (map);
318- }
311+ /* *
312+ * @brief Check if the map is empty.
313+ *
314+ * @return True if the map is empty, false otherwise.
315+ */
316+ bool is_empty () {
317+ return fossil_mapof_is_empty (map);
318+ }
319319
320- private:
321- fossil_mapof_t * map; // /< Pointer to the underlying C map structure.
322- };
320+ private:
321+ fossil_mapof_t * map; // /< Pointer to the underlying C map structure.
322+ };
323323
324- } // namespace tofu
324+ } // namespace tofu
325325
326326} // namespace fossil
327327
0 commit comments