0

Allow for multiple configuration files to be merged together

We would like to able to launch the application by giving it multiple configuration files in input, like so: barcode-poc -c /usr/share/barcode-poc/conf/barcode-poc.ini -c /home/root/humza.ini -c /home/root/fab.ini From the above example, we would like the system to parse barcode-poc.ini (let's call this A) first, then parse humza.ini and merge the parsed values from humza.ini (let's call this B) into the internal representation for barcode-poc.ini, and finally parse fab.ini and merge its parsed values (let's call this C) into the internal representation of barcode-poc.ini already merged with humza.ini. In software terms: A.merge(B); A.merge(C); From the above example ( A.merge(B) )The type of merge operation that we want to implement is defined as follows: Sections found in B but not found in A will have to be copied to A (including the keys with corresponding values defined for those sections) Keys found in both A and B will have to take the values defined in B

21st Oct 2022, 4:09 PM
Humza Ali
Humza Ali - avatar
2 odpowiedzi
+ 2
Humza Ali have you determined what you will use for internal representation? Consider using the map<,> template. It serves as a dictionary of keys with values - like .ini files, but without allowing duplicate key entries.
22nd Oct 2022, 8:14 AM
Brian
Brian - avatar
0
Brian, I have duplicate key entries such as plugin or LED etc. Currently, I am using struct stat sb: if (lstat(filepath.c_str(), &sb) == -1) return false; if ((sb.st_mode & S_IFMT) == S_IFREG) return true
24th Oct 2022, 8:02 AM
Humza Ali
Humza Ali - avatar