Files
pip/doc/examples/piconfig.cpp

28 lines
584 B
C++

#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]
};