Home » Community » U++ community news and announcements » .ini file helpers
Re: .ini file helpers [message #36837 is a reply to message #36834] |
Tue, 10 July 2012 23:03   |
|
mirek wrote on Tue, 10 July 2012 22:19 |
dolik.rce wrote on Tue, 10 July 2012 15:14 | 1) INI_DOUBLE is missing.
|
Well, seemed sort of unnecessary...
| Well, at my work many different things is configured using configuration files, including doubles, arrays and other weird things
mirek wrote on Tue, 10 July 2012 22:19 |
dolik.rce wrote on Tue, 10 July 2012 15:14 |
2) Once you call GetIniKey, the file is loaded and it is not possible to reload configuration. In a daemons/services, it is often desirable to reload config without restarting.
|
Fair enough, even if I cannot really imagine when I would want to change config (something you do usually a couple of times per month, at most) without restarting. You would have to code your daemon really carefully to allow this... 
| It is quite common, just look at how many initscripts in /etc/init.d of any linux distro have a reload option 
mirek wrote on Tue, 10 July 2012 22:19 | INI_* are just top-level encapsulation for GetIniKey.
| Could you please explain that? I don't see any relation between these two things. (Maybe I'm just blind )
mirek wrote on Tue, 10 July 2012 22:19 | How about this:
void ReloadIniFile()
{
s_ini_loaded = false;
}
void SetIniFile(const char *name) {
Mutex::Lock __(sMtx);
strcpy(sIniFile, name);
ReloadIniFile();
}
| Ok, that would work too 
mirek wrote on Tue, 10 July 2012 22:19 | IME, guessing value types is difficult AND wrong...
| Ok, I take that back. We don't have to guess, we know what the type is At least where programmer tells us with INI_* macro. And if he tells us, it would be IMHO much more logical to serve it to him already converted to correct type.[/quote]
mirek wrote on Tue, 10 July 2012 22:19 | INI_DOUBLE added.
BTW, I feel like we would rather need INI_INT64 and make it understand 'K', 'M', 'G' ('T') (like buffer=16M). Adding to RM for now...
| I think the functions for suffixes are good idea. Also, allowing hexadecimal numbers would be nice 
Honza
|
|
|
Goto Forum:
Current Time: Wed Apr 30 09:36:43 CEST 2025
Total time taken to generate the page: 0.00913 seconds
|