I have been trying to use the keydata class, without any success.
I have two questions (and found a bug):
1) what is the kind of path that can be given in the constructor, and what file is it going to read? The Load function seemd to do very weird things.
What is the point of determining a file name in such a complicated way from a path. Why not have the name of the file passed as an argument directly?
2) what format does the config file must respect to be read?
BUG) The bug is that the current Load function checks for the presence of a "~" in the path name to determine if it will be a /etc subdirectory of a $HOME subdirectory. However, on some systems (such as AIX), something like ~/abc is converted automatically to /home/username/abc
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Keydata is one of those really neat and odd things that I use heavily in things
like Bayonne. Essentially, the "path" is a "keypath" into a theoretical namespace of key pairs, hence one does not use "real" filepaths that may be OS dependent. The "/" path refers to "/etc" prefixed (on UNIX) directories and this is processed within the constructor. It could refer to the /config prefix on QNX, or even, gasp, a "C:\WINDOWS". Hence, a keypath of "/bayonne.d/vmhost/smtp" actually resolves to a "/etc/bayonne.d/vmhost.conf" and loads key value pairs from the [smtp] section of that .conf file.
Similarly, something like "~bayonne/smtp" path refers to a "~/.bayonnerc" and loads key pairs from the [smtp] section. This coercion occurs before the name is passed to the open call.
I actually use derived keydata based classes as global initialized objects, and they hence automatically load and parse config file entries even before "main" has started.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would recommend to actually add something like this to the keydata documentation, possibly along with an example of a rc file. It is not that obvious that the syntax is
[section_name]
key1=value1
key2=value2
...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I could undestend how it work only after looking in keydata.cpp
The automatic generated document is not good due to unclear comments or even missing (as for getSymbol). Much better in OVERVIEW.txt but also don't clear enough.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have been trying to use the keydata class, without any success.
I have two questions (and found a bug):
1) what is the kind of path that can be given in the constructor, and what file is it going to read? The Load function seemd to do very weird things.
What is the point of determining a file name in such a complicated way from a path. Why not have the name of the file passed as an argument directly?
2) what format does the config file must respect to be read?
BUG) The bug is that the current Load function checks for the presence of a "~" in the path name to determine if it will be a /etc subdirectory of a $HOME subdirectory. However, on some systems (such as AIX), something like ~/abc is converted automatically to /home/username/abc
Keydata is one of those really neat and odd things that I use heavily in things
like Bayonne. Essentially, the "path" is a "keypath" into a theoretical namespace of key pairs, hence one does not use "real" filepaths that may be OS dependent. The "/" path refers to "/etc" prefixed (on UNIX) directories and this is processed within the constructor. It could refer to the /config prefix on QNX, or even, gasp, a "C:\WINDOWS". Hence, a keypath of "/bayonne.d/vmhost/smtp" actually resolves to a "/etc/bayonne.d/vmhost.conf" and loads key value pairs from the [smtp] section of that .conf file.
Similarly, something like "~bayonne/smtp" path refers to a "~/.bayonnerc" and loads key pairs from the [smtp] section. This coercion occurs before the name is passed to the open call.
I actually use derived keydata based classes as global initialized objects, and they hence automatically load and parse config file entries even before "main" has started.
Thanks for the explaination.
I would recommend to actually add something like this to the keydata documentation, possibly along with an example of a rc file. It is not that obvious that the syntax is
[section_name]
key1=value1
key2=value2
...
This probably should be documented somewhere...
I could undestend how it work only after looking in keydata.cpp
The automatic generated document is not good due to unclear comments or even missing (as for getSymbol). Much better in OVERVIEW.txt but also don't clear enough.