本文整理汇总了C++中ConfigArray::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigArray::Name方法的具体用法?C++ ConfigArray::Name怎么用?C++ ConfigArray::Name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigArray
的用法示例。
在下文中一共展示了ConfigArray::Name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestCommandLine
void TestCommandLine(const ConfigParameters& configBase)
{
// commandLine=[
ConfigParameters config(configBase("commandline"));
ConfigParameters stringTests(config("stringTests"));
ConfigParameters unicodeTests(stringTests("unicodeTests"));
ConfigParameters arrayTests(config("arrayTests"));
ConfigParameters dictTests(config("dictTests"));
// # config file parsing, basic types
// int=20
int i = config("int", "5555");
// cout << i << endl;
i = config("nothere", "1234");
// cout << i << endl;
// long=8100000
long l = config(L"long", "5555");
// cout << l << endl;
l = config("nothere", "1234");
// size_t=12345678901234
// should get the same thing asking from a double nested config
l = unicodeTests(L"long", "5555");
// cout << l << endl;
l = unicodeTests("nothere", "1234");
// size_t=12345678901234
size_t s = config("size_t", "5555");
// cout << s << endl;
s = config(L"nothere", "1234");
// get stuff from base level config (3 levels down)
string type = unicodeTests("type");
string command = unicodeTests("command");
// boolTrue=t
bool bt = config("boolTrue");
// boolFalse=f
bool bf = config("boolFalse");
// boolImpliedTrue
bool bit = config("boolImpliedTrue");
bit;
bool bif = config.Exists(L"boolImpliedFalse");
bif;
bf = config("nothere", "false");
// cout << bf << endl;
// float=1234.5678
float f = config("float", "555.555");
// cout << f << endl;
f = config("nothere", "1.234");
// double=1.23456e-99
double d = config("double", "555.555");
// cout << d << endl;
d = stringTests("nothere", "1.2345");
// string=string1
std::string str = stringTests("string");
str = stringTests(L"nothere", "default");
// cout << str << endl;
str = stringTests("nothere", "defString");
// cout << str << endl;
// stringQuotes="This is a string with quotes"
str = stringTests("stringQuotes");
// wstring=東京
std::wstring wstr = unicodeTests("wstring");
wstr = (std::wstring) unicodeTests(L"nothere", L"newValue");
// wcout << wstr << endl;
wstr = (std::wstring) unicodeTests("nothere", L"defWstring");
// wstringQuotes="東京に行きましょう. 明日"
std::wstring wstrQuotes = unicodeTests("wstringQuotes");
//
// #array tests
// arrayEmpty={}
ConfigArray arrayEmpty = arrayTests("arrayEmpty");
// arraySingle=hello
ConfigArray arraySingle = arrayTests("arraySingle");
// arrayMultiple=hello;there
ConfigArray arrayMultiple = arrayTests(L"arrayMultiple");
// arrayMultipleBraces={hello:there:with:braces}
ConfigArray arrayMultipleBraces = arrayTests("arrayMultipleBraces");
// arrayMultiple = arrayTests("nothere", arrayMultipleBraces); - no longer supported, can add if we need it
// arrayMultipleSeparatorBraces={|hello|there|with|custom|separator|and|braces}
ConfigArray arrayMultipleSeparatorBraces = arrayTests("arrayMultipleSeparatorBraces");
// arrayQuotedStrings={
// "c:\path with spaces\file.txt"
// "d:\data\Jan 21 1999.my file.txt"
// }
ConfigArray arrayQuotedStrings = arrayTests("arrayQuotedStrings");
str = arrayQuotedStrings[0];
str = arrayQuotedStrings[1];
// arrayRepeat=1*1:2*2:3*3
ConfigArray arrayRepeat = arrayTests("arrayRepeat");
// arrayHetro={string;明日;123;1.234e56;True;dict=first=1;second=2}
ConfigArray arrayHetro = arrayTests("arrayHetro");
str = arrayHetro[0];
wstr = (std::wstring) arrayHetro[1];
i = arrayHetro[2];
d = arrayHetro[3];
bt = arrayHetro[4];
ConfigParameters dict(arrayHetro[5]);
std::string name = dict.Name();
// arrayNested={|1:2:3|first:second:third|t:f:t|{|identical*2|separator*1|nested*3}}
ConfigArray arrayNested = arrayTests(L"arrayNested");
name = arrayNested.Name();
//.........这里部分代码省略.........