|
From: Anjan <roc...@gm...> - 2008-12-19 18:07:18
|
yes this will be useful :)
On Fri, Dec 19, 2008 at 9:20 PM, Bibek Shrestha <bib...@gm...>wrote:
> There is a properties reader in src/fe/nn/cpp
> filereader.h and filereader.cpp
>
>
> With it you can save settings in any configuration format as
>
>
> keyname = valuename
>
>
> line without the character '=' are ignored
> line starting with # are automatically taken as comment whether it has '='
> or not
>
>
> Usage
> #include 'filereader.h'
> #include <iostream>
> #include <boost/lexical_cast.hpp>
> int main()
> {
> fileReader.loadFile("/temp/rtftr.cfg");
> fileReader.getProperty("nn_test_network_filename");
> #returns the value of key named "nn_test_network_filename"
>
>
> std::cout << fileReader.getProperty("abcd");
>
>
> # changing into float
> std::cout << 2 +
> lexical_cast<float>(fileReader.getProperty("someintegervalue"));
> }
> ------------------------------------
>
>
> Note that the values are obtained as std::string so if integers are passed
> through configuration file, they should be converted from string to integer
>
>
> Changing is easy from boost's lexical cast
>
>
> Also note to use proper format names for keys, for example see the attached
> configuration file. A proper place to put all configuration is
> /temp/rtftr.cfg
>
>
> Cheers
> --
> Bibek Shrestha
> bib...@gm...
> 9841 825 925
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Rtftr-devel mailing list
> Rtf...@li...
> https://lists.sourceforge.net/lists/listinfo/rtftr-devel
>
>
--
Anjan Nepal
GPO Box 11458
Registered Linux User #395963
|