30.11.2013 - New PICollection namespace, Android support, my own PIVector implementation
This commit is contained in:
39
piconfig.cpp
39
piconfig.cpp
@@ -30,17 +30,42 @@
|
||||
* \image html piconfig.png
|
||||
*
|
||||
* \section PIConfig_sec1 Concepts
|
||||
* Each entry of internal tree has type PIConfig::Entry. This class
|
||||
* has next properties:
|
||||
* Each node of internal tree has type PIConfig::Entry. %PIConfig
|
||||
* has one root element \a rootEntry(). Any entry of configuration file is a
|
||||
* child of this element.
|
||||
*
|
||||
*/
|
||||
|
||||
/*! \class PIConfig::Entry
|
||||
* \brief %Entry of configuration file
|
||||
* \details This class is node of internal PIConfig tree.
|
||||
* %Entry provide access to elements of PIConfig. Each entry has
|
||||
* children or next properties:
|
||||
* * name
|
||||
* * value
|
||||
* * type
|
||||
* * comment
|
||||
* Entry class has many implicit convertions to common types: bolean,
|
||||
* integers, float, double, PIString, PIStringList.
|
||||
*
|
||||
*/
|
||||
* Each property is a PIString. These properties forms from text line with
|
||||
* format: \code{.cpp} <name> = <value> #<type> <comment> \endcode
|
||||
* Type and comment are optional fields. Type is a single letter immediately
|
||||
* after comment symbol "#". \n \n
|
||||
* %Entry has many implicit convertions to common types: boolean, integers,
|
||||
* float, double, PIString, PIStringList. \n \n
|
||||
* Generally there is no need to create instance of %PIConfig::Entry manually,
|
||||
* it returns by functions \a getValue() of \a PIConfig, \a PIConfig::Entry or
|
||||
* \a PIConfig::Branch. If there is no suitable entry to return, reference to
|
||||
* internal instance of %PIConfig::Entry with "default" value will be returned.
|
||||
* \snippet piconfig.cpp PIConfig::Entry
|
||||
*
|
||||
*/
|
||||
|
||||
/*! \class PIConfig::Branch
|
||||
* \brief %Branch is a list of entries of configuration file
|
||||
* \details %Branch provides some features to get entries lists.
|
||||
* \snippet piconfig.cpp PIConfig::Branch
|
||||
*
|
||||
*/
|
||||
|
||||
PIConfig::Entry PIConfig::Branch::_empty;
|
||||
PIConfig::Entry PIConfig::Entry::_empty;
|
||||
@@ -184,7 +209,7 @@ PIConfig::Branch PIConfig::Entry::getValues(const PIString & vname) {
|
||||
|
||||
bool PIConfig::Entry::entryExists(const Entry * e, const PIString & name) const {
|
||||
if (e->_children.isEmpty()) {
|
||||
if (e->_name == name) return true;
|
||||
if (e->_name == name) return true;
|
||||
else return false;
|
||||
}
|
||||
piForeachC (Entry * i, e->_children)
|
||||
@@ -484,7 +509,7 @@ void PIConfig::parse() {
|
||||
name = tree.back();
|
||||
tree.pop_back();
|
||||
entry = &root;
|
||||
piForeach (PIString & i, tree) {
|
||||
piForeachC (PIString & i, tree) {
|
||||
te = entry->findChild(i);
|
||||
if (te == 0) {
|
||||
ce = new Entry();
|
||||
|
||||
Reference in New Issue
Block a user