Re: xml parsing



Hey,

>> I have something for you if you didn't get lucky with the Glib::KeyFile.
> looks like I just did get lucky.

Good. There is no issue with KeyFile if it satisfies your needs.

> Probably the KeyFile will work fine for me but I am curious.  Why did
> you make your own class?  Did you add something that KeyFile does not
> offer?

Yes, KeyFile uses a "flat" model of the file. There is no hierarchy in
it. You can create groups and add key/values to it. But you cannot add
groups to groups, and if your configuration grows you probably notice
that the flat model doesn't give you the freedom you need/want to have.

The other "feature" with my class is that all sections and values are
reference pointered, so you can store a value in a variable,

  ConfValuePtr value = conf.get_value("sec.subsec.key1");

and change the config value later on by just assigning a new value

  value->set("amazing!");

and this will be reflected/saved to configuration, NO NEED to access the
whole configuration model, e.g. by doing:

  conf.set_value("sec.subsec.key1", "amazing");

No additional lookups required, etc. It's just another approach. If you
are lucky with KeyFile, stick to it. There is nothing bad with it.

I really like the simplicity INI files, and with hierarchies of
sections/groups you can archive nearly as complex structures as with XML
without the bloat. But that are just my $0.02, many people like XML.

Regards,
Simon


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]