|
Boost : |
From: Marcin Kalicinski (kalita_at_[hidden])
Date: 2005-11-10 11:37:17
> The function boost::property_tree::xml_parser::validate_flags(int) is
> defined in a header but not a template or declared inline, causing
> multiple definition errors.
True. Additionally, some internal functions in registry_parser.hpp suffer
from the same. I'll fix it. Current regressions do not detect it, because it
only happens if you include xml parser or registry parser in more than one
translation unit. Need to add regression for it.
> Defaulting to case-insensitve matching is surprising to me. It is true
> that some formats for which parsers are supplied are case insensitive,
> but xml and (typically) command lines are not. The parsers are
> independent of the tree in any case. Is there a rationale for this
default?
Case-insensitive matching only applies to key comparisions. The keys
maintain their case during all read or write operations. So, it is going to
cause problems only if you have subkeys of the same key, which only differ
by case.
On the other hand, case-insensitive matching is easy on non-programmers, who
often write and edit scripts. When working for my previous employer I found
it impossible to persuade some of the script-writers to use correct
indentation, let alone use consistent case.
If that is a problem, one solution would be to add iptree and wiptree
typedefs that work case insensitive, while ptree and wptree work
case-sensitive.
> I would prefer if the third (bool pointer) parameter to ptree::get_d was
> optional and defaulted to 0. I would use this function in order to not
> have to care about the presence of the value and don't imagine I would
> use the flag much, if ever. I never saw a need to provide it in my own
> library.
The reason why it does not default to zero is that previous versions of get
didn't have the distinguishing letters "_b", "_d", and defaulting of
parameter caused ambiguities. Now this probably no longer applies, and it
can be made default - as soon as I make sure that expressions like that are
not ambiguous:
bool b1 = get_d("key", false, 0);
bool b2 = get_d('/', "key", false);
int i1 = get_d("key", 0, 0);
int i2 = get_d('/', "key", 0);
cheers,
Marcin Kalicinski
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk