17.10.2013 - Adjusted for QNX, PIPeer release for Windows, Remote console

This commit is contained in:
peri4
2013-10-17 16:12:10 +04:00
parent 4b90f2818e
commit 0f1b528ac6
42 changed files with 585 additions and 171 deletions

View File

@@ -1,3 +1,6 @@
/*! \file piconfig.h
* \brief Configuration file
*/
/*
PIP - Platform Independent Primitives
Config parser
@@ -54,7 +57,9 @@ class PIP_EXPORT PIConfig: public PIFile
friend class Entry;
friend class Branch;
public:
//! Contructs and read configuration file at path "path" in mode "mode"
PIConfig(const PIString & path, PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
~PIConfig() {/*piForeach (Entry * i, root._children) deleteEntry(i); close();*/}
class Entry;
@@ -172,10 +177,13 @@ public:
int _line;
};
//! Returns top-level entry with name "vname", if doesn`t exists return entry with value "def" and set *exist to false
Entry & getValue(const PIString & vname, const PIString & def = PIString(), bool * exist = 0);
Entry & getValue(const PIString & vname, const PIString & def = PIString(), bool * exist = 0) const {return const_cast<PIConfig * >(this)->getValue(vname, def, exist);}
PICONFIG_GET_VALUE
//! Returns top-level entries with names matches "vname"
Branch getValues(const PIString & vname);
void setValue(const PIString & name, const PIString & value, const PIString & type = "s", bool write = true);
@@ -192,12 +200,21 @@ public:
void setValue(const PIString & name, const float value, bool write = true) {setValue(name, ftos(value), "f", write);}
void setValue(const PIString & name, const double value, bool write = true) {setValue(name, dtos(value), "f", write);}
//! Returns root entry
Entry & rootEntry() {return root;}
//! Returns top-level entries count
int entriesCount() const {return childCount(&root);}
//! Returns if top-level entry with name "name" exists
bool isEntryExists(const PIString & name) const {return entryExists(&root, name);}
//! Returns all top-level entries
Branch allTree() {Branch b; piForeach (Entry * i, root._children) b << i; return b;}
//! Returns all entries without children
Branch allLeaves() {Branch b; allLeaves(b, &root); b.sort(Entry::compare); return b;}
int entryIndex(const PIString & name);
PIString getName(uint number) {return entryByIndex(number)._name;}
@@ -216,8 +233,11 @@ public:
void readAll();
void writeAll();
//! Returns current tree delimiter
const PIString & delimiter() const {return delim;}
//! Set current tree delimiter
void setDelimiter(const PIString & d) {delim = d; setEntryDelim(&root, d); readAll();}
private: