Sign in to follow this  

config file layout.

This topic is 4591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know of any decent articles regarding a general format for a config file. I'm using tinyXML to load and parse my file. But I feel the whole design of the data is a little hapazard which has lead to the design of the parser being a little messy. Basically I'd just like to get a general, generic layout that I can then write a decent, compact parser.

Share this post


Link to post
Share on other sites
Write down what you want the configuration file to do. From that, you can design a compact script and parser.

For instance, in the config scripts that I use, I decided that all I really need to do is assign values to variables, and to execute other configuration scripts, so only two commands are required, "set" and "exec". From that, a simple script can be constructed like so:

set <variable> <value>
exec <other config script>

etc...

From that I managed to write a really small parser, and it works wonderfully for what I require.

So, to recap:
Write down what you want the configuration file to do. From that, you can design a compact script and parser.

Share this post


Link to post
Share on other sites
Speaking of INI files, they are really easy to work with, not to mention simle. DaRookie showed me a quick and easy INI file parser and congifuration loader that I used for quick data driven features in my current project. They are here(.cpp) and here(.h). It is not 'final' per se, but it uses a lot of interesting things that can give you ideas of what functionality to add to your parser. Very very useful though!

Share this post


Link to post
Share on other sites

This topic is 4591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this