ConfigFile::addArray (type)

From King Arthur's Gold Wiki
Revision as of 16:55, 29 September 2012 by Shadlington (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Adds the given key with a semicolon-delimited list of values of a particular type to the ConfigFile. The type is specified by the specific method name used.


In order to use this method you must create an array<T> of the required type, add the necessary values to it and then pass it to this method. The array will then be converted into a semicolon-delimited list with the same values as were in the array<T>.

void addArray_f32( const string &in key, const array<f32> &in value )
void addArray_u8( const string &in key, const array<u8> &in value )
void addArray_s8( const string &in key, const array<s8> &in value )
void addArray_u16( const string &in key, const array<u16> &in value )
void addArray_s16( const string &in key, const array<s16> &in value )
void addArray_u32( const string &in key, const array<u32> &in value )
void addArray_s32( const string &in key, const array<s32> &in value )
void addArray_bool( const string &in key, const array<bool> &in value )
void addArray_string( const string &in key, const array<string> &in value )

Example of usage, adding "testkey = test1; test2; test3" to the file Rules/TestRules/TEST.cfg:

ConfigFile config( "Rules/TestRules/TEST" );
 
array<string> test;
test.push_back("test1");
test.push_back("test2");
test.push_back("test3");
 
config.addArray_string("testkey", test);config.saveFile();

Object method of: ConfigFile