![]() |
PIP 5.6.1
Platform-Independent Primitives
|
Node of the parsed configuration tree. More...
#include <piconfig.h>
Public Member Functions | |
| Entry () | |
| Constructs an empty detached entry. | |
| Entry * | parent () const |
Returns parent entry, or 0 for the root and default placeholder entries. | |
| int | childCount () const |
| Returns direct children count. | |
| Branch & | children () const |
| Returns direct children as PIConfig::Branch. | |
| Entry * | child (const int index) const |
| Returns direct child at position "index". | |
| Entry * | findChild (const PIString &name) |
| Returns first direct child named "name". | |
| const Entry * | findChild (const PIString &name) const |
| Returns first direct child named "name". | |
| bool | isLeaf () const |
| Returns true when the entry has no children. | |
| const PIString & | name () const |
| Returns local entry name without parent prefix. | |
| const PIString & | value () const |
| Returns raw stored value. | |
| const PIString & | type () const |
| Returns one-letter stored type mark. | |
| const PIString & | comment () const |
| Returns inline comment stored after the type mark. | |
| const PIString & | fullName () const |
| Returns full dotted name as it appears in the tree. More... | |
| Entry & | setName (const PIString &value) |
| Sets local name to "value" and returns this entry. | |
| Entry & | setType (const PIString &value) |
| Sets stored type mark to "value" and returns this entry. | |
| Entry & | setComment (const PIString &value) |
| Sets inline comment to "value" and returns this entry. | |
| Entry & | setValue (const PIString &value) |
| Sets raw stored value to "value" and returns this entry. | |
| Entry & | setValue (const PIStringList &value) |
| Stores string list value and marks entry type as "l". | |
| Entry & | setValue (const char *value) |
| Stores C-string value and marks entry type as "s". | |
| Entry & | setValue (const bool value) |
| Stores boolean value and marks entry type as "b". | |
| Entry & | setValue (const char value) |
| Stores character value and marks entry type as "s". | |
| Entry & | setValue (const short value) |
| Stores numeric value and marks entry type as "n". | |
| Entry & | setValue (const int value) |
| Stores numeric value and marks entry type as "n". | |
| Entry & | setValue (const long value) |
| Stores numeric value and marks entry type as "n". | |
| Entry & | setValue (const uchar value) |
| Stores numeric value and marks entry type as "n". | |
| Entry & | setValue (const ushort value) |
| Stores numeric value and marks entry type as "n". | |
| Entry & | setValue (const uint value) |
| Stores numeric value and marks entry type as "n". | |
| Entry & | setValue (const ulong value) |
| Stores numeric value and marks entry type as "n". | |
| Entry & | setValue (const float value) |
| Stores floating-point value and marks entry type as "f". | |
| Entry & | setValue (const double value) |
| Stores floating-point value and marks entry type as "f". | |
| Entry & | getValue (const PIString &vname, const PIString &def=PIString(), bool *exists=0) |
| Get entry with name "vname" and default value "def". More... | |
| Branch | getValues (const PIString &vname) |
| Get entry with name "vname" and default value "def". More... | |
| bool | isEntryExists (const PIString &name) const |
| Returns true if this entry or any descendant has name "name". | |
| bool | toBool () const |
Converts stored value to bool. | |
| char | toChar () const |
Converts stored value to char. | |
| short | toShort () const |
Converts stored value to short. | |
| int | toInt () const |
Converts stored value to int. | |
| long | toLong () const |
Converts stored value to long. | |
| uchar | toUChar () const |
Converts stored value to uchar. | |
| ushort | toUShort () const |
Converts stored value to ushort. | |
| uint | toUInt () const |
Converts stored value to uint. | |
| ulong | toULong () const |
Converts stored value to ulong. | |
| float | toFloat () const |
Converts stored value to float. | |
| double | toDouble () const |
Converts stored value to double. | |
| PIString | toString () const |
| Returns stored value as PIString. | |
| PIStringList | toStringList () const |
| Splits stored list value into PIStringList using internal list separator. | |
Node of the parsed configuration tree.
Entry of configuration file
Stores entry name, value, type mark, inline comment and child entries derived from dotted names.
This class is node of internal PIConfig tree. Entry provide access to elements of PIConfig. Each entry has children or next properties:
Each property is a PIString. These properties forms from text line with format:
Type and comment are optional fields. Type is a single letter immediately after comment symbol "#".
Entry has many implicit convertions to common types: boolean, integers, float, double, PIString, PIStringList.
Generally there is no need to create instance of PIConfig::Entry manually, it returns by functions getValue() of PIConfig, PIConfig::Entry or PIConfig::Branch. If there is no suitable entry to return, reference to internal instance of PIConfig::Entry with "default" value will be returned.
|
inline |
Returns full dotted name as it appears in the tree.
Default placeholder entries always have empty full name.
| PIConfig::Entry & PIConfig::Entry::getValue | ( | const PIString & | vname, |
| const PIString & | def = PIString(), |
||
| bool * | exists = 0 |
||
| ) |
Get entry with name "vname" and default value "def".
If lookup fails, returns a shared default entry filled with "def" and sets exists to false when provided.
| PIConfig::Branch PIConfig::Entry::getValues | ( | const PIString & | vname | ) |
Get entry with name "vname" and default value "def".
Get entry with name "vname" and default value "def" Get entry with name "vname" and default value "def" Get entry with name "vname" and default value "def" Get entry with name "vname" and default value "def" Get entry with name "vname" and default value "def" Get entry with name "vname" and default value "def" Get entry with name "vname" and default value "def" Get entry with name "vname" and default value "def" Get entry with name "vname" and default value "def" Get entry with name "vname" and default value "def" Get entry with name "vname" and default value "def" Returns direct children whose names contain substring "vname".