summaryrefslogtreecommitdiffstats
path: root/ini/ini_configobj.h
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2010-11-27 22:03:24 -0500
committerStephen Gallagher <sgallagh@redhat.com>2010-12-21 11:16:09 -0500
commitec246f748f8dcbeefd46125546364ed2aa3100ea (patch)
tree299ef0b30b5e286d129e991eaac6491010dd702d /ini/ini_configobj.h
parent5dadfb4371b8ba694b8d9431cb6789bf6de485c4 (diff)
downloadding-libs-ec246f748f8dcbeefd46125546364ed2aa3100ea.tar.gz
ding-libs-ec246f748f8dcbeefd46125546364ed2aa3100ea.tar.xz
ding-libs-ec246f748f8dcbeefd46125546364ed2aa3100ea.zip
Allow merging values
This patch is the first pass at merging functionality. It implements merging of values that belong to the same section. Patch includes: * Definition of merge flags in doxy format * Definition of the masks in internal header * Changes to parser to handle the merging of values. * Also swithed parser to not use ini_config.h as I want to switch implementation of the current interface to new interface at some point. * New unit test was created. * New config file for this unit test was added to ini.d Main code changes are in ini_parse.c
Diffstat (limited to 'ini/ini_configobj.h')
-rw-r--r--ini/ini_configobj.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/ini/ini_configobj.h b/ini/ini_configobj.h
index 21198db..88a8704 100644
--- a/ini/ini_configobj.h
+++ b/ini/ini_configobj.h
@@ -29,6 +29,7 @@
#include <stdio.h>
#include "simplebuffer.h"
+
/**
* @defgroup errorlevel Error tolerance constants
*
@@ -79,6 +80,92 @@
* @}
*/
+
+/**
+ * @defgroup collisionflags Flags that define collision resolution logic.
+ *
+ * @{
+ */
+
+/**
+ * @defgroup onesecvalue Colliding values come from one section
+ *
+ * Flags that define collision resolution logic for values in
+ * the same section.
+ * These flags should be used during parsing to handle duplicate
+ * keys in the same section of the ini file.
+ *
+ * @{
+ */
+
+/** @brief Value with same key is ovewritten */
+#define INI_MV1S_OVERWRITE 0x0000
+/** @brief Collision causes error */
+#define INI_MV1S_ERROR 0x0001
+/** @brief Second value is discarded */
+#define INI_MV1S_PRESERVE 0x0002
+/** @brief Duplicates are allowed */
+#define INI_MV1S_ALLOW 0x0003
+
+/**
+ * @}
+ */
+
+/**
+ * @defgroup twosecvalue Colliding values come from two sections
+ *
+ * Flags that define collision resolution logic between two values
+ * that come from two sections with the same name.
+ * These flags should be used during parsing to handle duplicate
+ * keys coming from the same section scattered across the ini file.
+ * These flags also can be used to specify the rules of merging
+ * values that come from two files separate configuration files.
+ *
+ * @{
+ */
+/** @brief Value with same key is ovewritten */
+#define INI_MV2S_OVERWRITE 0x0000
+/** @brief Collision causes error */
+#define INI_MV2S_ERROR 0x0010
+/** @brief Second value is discarded */
+#define INI_MV2S_PRESERVE 0x0020
+/** @brief Duplicates are allowed */
+#define INI_MV2S_ALLOW 0x0030
+
+/**
+ * @}
+ */
+
+/**
+ * @defgroup mergesec Collision in two sections
+ *
+ * Flags that define collision resolution logic between two sections.
+ * These flags should be used during parsing to handle duplicate
+ * sections scattered across the ini file.
+ * These flags also can be used to specify the rules of merging
+ * sections that come from two separate configuration files.
+ *
+ * @{
+ */
+/** @brief Sections are merged */
+#define INI_MS_MERGE 0x0000
+/** @brief Collision causes error */
+#define INI_MS_ERROR 0x0100
+/** @brief First section is discarded */
+#define INI_MS_OVERWRITE 0x0200
+/** @brief Second section is discarded */
+#define INI_MS_PRESERVE 0x0300
+/** @brief Duplicates are allowed */
+#define INI_MS_ALLOW 0x0400
+
+/**
+ * @}
+ */
+/**
+ * @}
+ */
+
+
/**
* @defgroup structures Structures
* @{