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

This commit is contained in:
2017-04-25 12:55:47 +00:00
parent 826db9e87d
commit ed059005f9
15 changed files with 101 additions and 78 deletions

View File

@@ -75,7 +75,9 @@ public:
class PIP_EXPORT Branch: public PIVector<Entry * > {
friend class PIConfig;
friend class Entry;
#ifdef PIP_STD_IOSTREAM
friend std::ostream & operator <<(std::ostream & s, const Branch & v);
#endif
friend PICout operator <<(PICout s, const Branch & v);
public:
Branch() {;}
@@ -97,7 +99,9 @@ public:
private:
bool entryExists(const Entry * e, const PIString & name) const;
void allLeaves(Branch & b, Entry * e) {piForeach (Entry * i, e->_children) {if (i->isLeaf()) b << i; else allLeaves(b, i);}}
#ifdef PIP_STD_IOSTREAM
void coutt(std::ostream & s, const PIString & p) const {piForeachC (Entry * i, *this) i->coutt(s, p);}
#endif
void piCoutt(PICout s, const PIString & p) const {piForeachC (Entry * i, *this) i->piCoutt(s, p);}
static Entry _empty;
@@ -303,7 +307,9 @@ 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;}
#ifdef PIP_STD_IOSTREAM
void coutt(std::ostream & s, const PIString & p) const;
#endif
void piCoutt(PICout s, const PIString & p) const;
void deleteBranch() {piForeach (Entry * i, _children) {i->deleteBranch(); delete i;}}
@@ -500,8 +506,11 @@ private:
};
#ifdef PIP_STD_IOSTREAM
std::ostream & operator <<(std::ostream & s, const PIConfig::Branch & v);
std::ostream & operator <<(std::ostream & s, const PIConfig::Entry & v);
#endif
inline PICout operator <<(PICout s, const PIConfig::Branch & v) {s.setControl(0, true); v.piCoutt(s, ""); s.restoreControl(); return s;}
inline PICout operator <<(PICout s, const PIConfig::Entry & v) {s << v.value(); return s;}