Does Juce have built in support for parsing .ini files?


#1

Hi all:

I need to create a command line program for parsing files that use the .ini format. For those of you who are not familiar with this format (like, say, me until this weekend), each line has a parameter with an associated name and parameter, in this format:

Any comments in the .ini format are preceded by a semicolon.

I know that there are a few open-source solutions out there for parsing such files, but if the support is already present in Juce, or if it is easy to create using existing Juce classes, that would be great to know. I am finishing up my first commercial plugin, and the above is essential for getting the plugin out the door (I am going to use Share-It, which uses a command line utility that stores user info in the above format). Any help at this point will be gratefully received.

Thanks,

Sean Costello


#2

Very easy with Juce strings. Something like:

Read the file to a string,
Split the string into an array by tokens (carriage return or new line probably) (makes a string per line),
ignore anything starting with a semi-colon,
split each line by the ‘=’ token - every array with more than one will have two pieces, key and value.

Bruce