Converter Series: Stealing My Own Code (Configuration)

I continue the process of stealing my own code with a clever bit that allows me to read in a configuration file. This will allow users to specify some options, and pass in information that I need to know.

Inside the program, all this configuration is stored in a singleton, which allows me to access it from anywhere without too much overhead. I just have to include configuration.h, and then call Configuration::getWhateverItemICareAbout() and I get the current setting of the item I want.

I know that I’ll need all kinds of information from both CK2 and EU3, so I put the install locations for both in the config file. Then I add code that tests if those locations exist, and spits out an error message otherwise. Because it’s best to catch errors often, and if I don’t spit out a clear error message about that, people of the forums will bug me forever over something they forgot to configure.

Relevant repository links:
Add configuration file and relating code

Leave a Reply

XHTML: You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>