git-svn-id: svn://db.shs.com.ru/pip@368 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2017-04-15 05:02:10 +00:00
parent 9058bdc521
commit 364cba2733
17 changed files with 129 additions and 26 deletions

View File

@@ -20,6 +20,7 @@
#include "piconfig.h"
#include "pifile.h"
#include "piiostring.h"
#include <iostream>
/*! \class PIConfig
* \brief Configuration file
@@ -222,7 +223,7 @@ PIConfig::Branch PIConfig::Entry::getValues(const PIString & vname) {
if (i->_name.find(vname) >= 0)
b << i;
return b;
};
}
bool PIConfig::Entry::entryExists(const Entry * e, const PIString & name) const {
@@ -235,6 +236,22 @@ bool PIConfig::Entry::entryExists(const Entry * e, const PIString & name) const
}
void PIConfig::Entry::coutt(std::ostream & s, const PIString & p) const {
PIString nl = p + " ";
if (!_value.isEmpty()) s << p << _name << " = " << _value << std::endl;
else std::cout << p << _name << std::endl;
piForeachC (Entry * i, _children) i->coutt(s, nl);
}
void PIConfig::Entry::piCoutt(PICout s, const PIString & p) const {
PIString nl = p + " ";
if (!_value.isEmpty()) s << p << _name << " = " << _value << PICoutManipulators::NewLine;
else std::cout << p << _name << std::endl;
piForeachC (Entry * i, _children) i->piCoutt(s, nl);
}
PIConfig::PIConfig(const PIString & path, PIIODevice::DeviceMode mode) {
_init();
own_dev = true;

View File

@@ -303,8 +303,8 @@ public:
bool entryExists(const Entry * e, const PIString & name) const;
void buildLine() {_all = _tab + _full_name + " = " + _value + " #" + _type + " " + _comment;}
void clear() {_children.clear(); _name = _value = _type = _comment = _all = PIString(); _line = 0; _parent = 0;}
void coutt(std::ostream & s, const PIString & p) const {PIString nl = p + " "; if (!_value.isEmpty()) s << p << _name << " = " << _value << std::endl; else std::cout << p << _name << std::endl; piForeachC (Entry * i, _children) i->coutt(s, nl);}
void piCoutt(PICout s, const PIString & p) const {PIString nl = p + " "; if (!_value.isEmpty()) s << p << _name << " = " << _value << PICoutManipulators::NewLine; else std::cout << p << _name << std::endl; piForeachC (Entry * i, _children) i->piCoutt(s, nl);}
void coutt(std::ostream & s, const PIString & p) const;
void piCoutt(PICout s, const PIString & p) const;
void deleteBranch() {piForeach (Entry * i, _children) {i->deleteBranch(); delete i;}}
static Entry _empty;