git-svn-id: svn://db.shs.com.ru/pip@368 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user