git-svn-id: svn://db.shs.com.ru/pip@6 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
27
doc/examples/piconfig.cpp
Normal file
27
doc/examples/piconfig.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "pip.h"
|
||||
|
||||
|
||||
void _() {
|
||||
|
||||
//! [PIConfig::Entry]
|
||||
/* "example.conf"
|
||||
a = 1
|
||||
s0.a = A
|
||||
s0.b = B
|
||||
*/
|
||||
PIConfig conf("example.conf", PIIODevice::ReadOnly);
|
||||
PIConfig::Entry ce = conf.getValue("a");
|
||||
int a = ce; // a = 1
|
||||
PIString A = ce; // A = "1"
|
||||
ce = conf.getValue("s0");
|
||||
piCout << ce.childCount(); // 2
|
||||
A = ce.getValue("b"); // A = "B"
|
||||
A = conf.getValue("s0.a"); // A = "A"
|
||||
//! [PIConfig::Entry]
|
||||
//! [fullName]
|
||||
PIConfig conf("example.conf", PIIODevice::ReadOnly);
|
||||
piCout << conf.getValue("a.b.c").name(); // "c"
|
||||
piCout << conf.getValue("a.b.c").fullName(); // "a.b.c"
|
||||
//! [fullName]
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user