code format

This commit is contained in:
2022-12-14 14:13:52 +03:00
parent 430a41fefc
commit c2b8a8d6da
297 changed files with 27331 additions and 24162 deletions

View File

@@ -1,28 +1,30 @@
/*
PIP - Platform Independent Primitives
Config parser
Ivan Pelipenko peri4ko@yandex.ru
PIP - Platform Independent Primitives
Config parser
Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "piconfig.h"
#include "pifile.h"
#include "piiostring.h"
#ifdef PIP_STD_IOSTREAM
# include "pistring_std.h"
# include <iostream>
#endif
/*! \class PIConfig
@@ -88,14 +90,14 @@
* 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;
@@ -105,9 +107,11 @@ PIConfig::Entry PIConfig::Entry::_empty;
PIConfig::Branch PIConfig::Branch::allLeaves() {
Branch b;
b.delim = delim;
piForeach (Entry * i, *this) {
if (i->isLeaf()) b << i;
else allLeaves(b, i);
piForeach(Entry * i, *this) {
if (i->isLeaf())
b << i;
else
allLeaves(b, i);
}
return b;
}
@@ -121,27 +125,27 @@ PIConfig::Entry & PIConfig::Branch::getValue(const PIString & vname, const PIStr
return _empty;
}
PIStringList tree = vname.split(delim);
PIString name = tree.front();
PIString name = tree.front();
tree.pop_front();
Entry * ce = 0;
piForeach (Entry * i, *this)
piForeach(Entry * i, *this)
if (i->_name == name) {
ce = i;
break;
}
if (ce == 0) {
_empty._name = vname;
_empty._name = vname;
_empty._value = def;
_empty.delim = delim;
_empty.delim = delim;
if (exist != 0) *exist = false;
return _empty;
}
piForeach (PIString & i, tree) {
piForeach(PIString & i, tree) {
ce = ce->findChild(i);
if (ce == 0) {
_empty._name = vname;
_empty._name = vname;
_empty._value = def;
_empty.delim = delim;
_empty.delim = delim;
if (exist != 0) *exist = false;
return _empty;
}
@@ -154,14 +158,12 @@ PIConfig::Entry & PIConfig::Branch::getValue(const PIString & vname, const PIStr
PIConfig::Branch PIConfig::Branch::getValues(const PIString & name) {
Branch b;
b.delim = delim;
piForeach (Entry * i, *this) {
piForeach(Entry * i, *this) {
if (i->isLeaf()) {
if (i->_name.find(name) >= 0)
b << i;
if (i->_name.find(name) >= 0) b << i;
} else {
piForeach (Entry * j, i->_children)
if (j->_name.find(name) >= 0)
b << j;
piForeach(Entry * j, i->_children)
if (j->_name.find(name) >= 0) b << j;
}
}
return b;
@@ -171,9 +173,8 @@ PIConfig::Branch PIConfig::Branch::getValues(const PIString & name) {
PIConfig::Branch PIConfig::Branch::getLeaves() {
Branch b;
b.delim = delim;
piForeach (Entry * i, *this)
if (i->isLeaf())
b << i;
piForeach(Entry * i, *this)
if (i->isLeaf()) b << i;
return b;
}
@@ -181,9 +182,8 @@ PIConfig::Branch PIConfig::Branch::getLeaves() {
PIConfig::Branch PIConfig::Branch::getBranches() {
Branch b;
b.delim = delim;
piForeach (Entry * i, *this)
if (!i->isLeaf())
b << i;
piForeach(Entry * i, *this)
if (!i->isLeaf()) b << i;
return b;
}
@@ -203,7 +203,7 @@ bool PIConfig::Branch::entryExists(const Entry * e, const PIString & name) const
if (e->_children.isEmpty()) {
return (e->_name == name);
}
piForeachC (Entry * i, e->_children)
piForeachC(Entry * i, e->_children)
if (entryExists(i, name)) return true;
return false;
}
@@ -211,13 +211,13 @@ bool PIConfig::Branch::entryExists(const Entry * e, const PIString & name) const
PIConfig::Entry & PIConfig::Entry::getValue(const PIString & vname, const PIString & def, bool * exist) {
PIStringList tree = vname.split(delim);
Entry * ce = this;
piForeach (PIString & i, tree) {
Entry * ce = this;
piForeach(PIString & i, tree) {
ce = ce->findChild(i);
if (ce == 0) {
_empty._name = vname;
_empty._name = vname;
_empty._value = def;
_empty.delim = delim;
_empty.delim = delim;
if (exist != 0) *exist = false;
return _empty;
}
@@ -230,9 +230,8 @@ PIConfig::Entry & PIConfig::Entry::getValue(const PIString & vname, const PIStri
PIConfig::Branch PIConfig::Entry::getValues(const PIString & vname) {
Branch b;
b.delim = delim;
piForeach (Entry * i, _children)
if (i->_name.find(vname) >= 0)
b << i;
piForeach(Entry * i, _children)
if (i->_name.find(vname) >= 0) b << i;
return b;
}
@@ -241,7 +240,7 @@ bool PIConfig::Entry::entryExists(const Entry * e, const PIString & name) const
if (e->_children.isEmpty()) {
return (e->_name == name);
}
piForeachC (Entry * i, e->_children)
piForeachC(Entry * i, e->_children)
if (entryExists(i, name)) return true;
return false;
}
@@ -249,19 +248,25 @@ bool PIConfig::Entry::entryExists(const Entry * e, const PIString & name) const
#ifdef PIP_STD_IOSTREAM
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);
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);
}
#endif
void PIConfig::Entry::piCoutt(PICout s, const PIString & p) const {
PIString nl = p + " ";
if (!_value.isEmpty()) s << p << _name << " = " << _value << " (" << _type << " " << _comment << ")" << PICoutManipulators::NewLine;
else s << p << _name << PICoutManipulators::NewLine;
piForeachC (Entry * i, _children) i->piCoutt(s, nl);
PIString nl = p + " ";
if (!_value.isEmpty())
s << p << _name << " = " << _value << " (" << _type << " " << _comment << ")" << PICoutManipulators::NewLine;
else
s << p << _name << PICoutManipulators::NewLine;
piForeachC(Entry * i, _children)
i->piCoutt(s, nl);
}
@@ -286,9 +291,9 @@ PIConfig::PIConfig(PIIODevice * device, PIIODevice::DeviceMode mode) {
PIConfig::PIConfig(const PIString & path, PIStringList dirs) {
_init();
internal = true;
own_dev = true;
dev = new PIFile(path, PIIODevice::ReadOnly);
incdirs = dirs;
own_dev = true;
dev = new PIFile(path, PIIODevice::ReadOnly);
incdirs = dirs;
incdirs << PIFile::fileInfo(path).dir();
while (!dev->isOpened()) {
if (dirs.isEmpty()) break;
@@ -318,9 +323,8 @@ bool PIConfig::open(const PIString & path, PIIODevice::DeviceMode mode) {
_destroy();
incdirs << PIFile::fileInfo(path).dir();
own_dev = true;
dev = new PIFile(path, mode);
if (!dev->isOpened())
dev->open(path, mode);
dev = new PIFile(path, mode);
if (!dev->isOpened()) dev->open(path, mode);
_setupDev();
parse();
return dev->isOpened();
@@ -330,7 +334,7 @@ bool PIConfig::open(const PIString & path, PIIODevice::DeviceMode mode) {
bool PIConfig::open(PIString * string, PIIODevice::DeviceMode mode) {
_destroy();
own_dev = true;
dev = new PIIOString(string, mode);
dev = new PIIOString(string, mode);
_setupDev();
parse();
return true;
@@ -340,11 +344,10 @@ bool PIConfig::open(PIString * string, PIIODevice::DeviceMode mode) {
bool PIConfig::open(PIIODevice * device, PIIODevice::DeviceMode mode) {
_destroy();
own_dev = false;
dev = device;
dev = device;
if (dev) {
dev->open(mode);
if (dev->isTypeOf<PIFile>())
incdirs << PIFile::fileInfo(((PIFile*)dev)->path()).dir();
if (dev->isTypeOf<PIFile>()) incdirs << PIFile::fileInfo(((PIFile *)dev)->path()).dir();
}
_setupDev();
parse();
@@ -354,9 +357,9 @@ bool PIConfig::open(PIIODevice * device, PIIODevice::DeviceMode mode) {
void PIConfig::_init() {
delim = PIStringAscii(".");
root.delim = delim;
empty.delim = delim;
delim = PIStringAscii(".");
root.delim = delim;
empty.delim = delim;
empty._parent = 0;
}
@@ -368,7 +371,7 @@ void PIConfig::_destroy() {
}
if (own_dev && dev) delete dev;
dev = nullptr;
piForeach (PIConfig * c, inc_devs)
piForeach(PIConfig * c, inc_devs)
delete c;
inc_devs.clear();
}
@@ -383,14 +386,22 @@ void PIConfig::_setupDev() {
void PIConfig::_clearDev() {
if (!dev) return;
if (PIString(dev->className()) == "PIFile") {((PIFile*)dev)->clear(); return;}
if (PIString(dev->className()) == "PIIOString") {((PIIOString*)dev)->clear(); return;}
if (PIString(dev->className()) == "PIFile") {
((PIFile *)dev)->clear();
return;
}
if (PIString(dev->className()) == "PIIOString") {
((PIIOString *)dev)->clear();
return;
}
}
void PIConfig::_flushDev() {
if (!dev) return;
if (PIString(dev->className()) == "PIFile") {((PIFile*)dev)->flush();}
if (PIString(dev->className()) == "PIFile") {
((PIFile *)dev)->flush();
}
}
@@ -402,8 +413,14 @@ bool PIConfig::_isEndDev() {
void PIConfig::_seekToBeginDev() {
if (!dev) return;
if (PIString(dev->className()) == "PIFile") {((PIFile*)dev)->seekToBegin(); return;}
if (PIString(dev->className()) == "PIIOString") {((PIIOString*)dev)->seekToBegin(); return;}
if (PIString(dev->className()) == "PIFile") {
((PIFile *)dev)->seekToBegin();
return;
}
if (PIString(dev->className()) == "PIIOString") {
((PIIOString *)dev)->seekToBegin();
return;
}
}
@@ -414,7 +431,7 @@ PIString PIConfig::_readLineDev() {
void PIConfig::_writeDev(const PIString & l) {
//piCout << "write \"" << l << "\"";
// piCout << "write \"" << l << "\"";
if (!stream) return;
stream->append(l);
}
@@ -428,14 +445,14 @@ bool PIConfig::isOpened() const {
PIConfig::Entry & PIConfig::getValue(const PIString & vname, const PIString & def, bool * exist) {
PIStringList tree = vname.split(delim);
Entry * ce = &root;
piForeach (PIString & i, tree) {
Entry * ce = &root;
piForeach(PIString & i, tree) {
ce = ce->findChild(i);
if (ce == 0) {
if (exist != 0) *exist = false;
empty._name = vname;
empty._name = vname;
empty._value = def;
empty.delim = delim;
empty.delim = delim;
return empty;
}
}
@@ -447,50 +464,52 @@ PIConfig::Entry & PIConfig::getValue(const PIString & vname, const PIString & de
PIConfig::Branch PIConfig::getValues(const PIString & vname) {
Branch b;
b.delim = delim;
piForeach (Entry * i, root._children)
if (i->_name.find(vname) >= 0)
b << i;
piForeach(Entry * i, root._children)
if (i->_name.find(vname) >= 0) b << i;
return b;
};
void PIConfig::addEntry(const PIString & name, const PIString & value, const PIString & type, bool write) {
if (getValue(name)._parent != 0)
return;
bool toRoot = false;
if (getValue(name)._parent != 0) return;
bool toRoot = false;
PIStringList tree = name.split(delim);
PIString ename = tree.back();
PIString ename = tree.back();
tree.pop_back();
Entry * te, * ce, * entry = &root;
Entry *te, *ce, *entry = &root;
if (tree.isEmpty()) toRoot = true;
piForeach (PIString & i, tree) {
piForeach(PIString & i, tree) {
te = entry->findChild(i);
if (te == 0) {
ce = new Entry();
ce->delim = delim;
ce->_tab = entry->_tab;
ce->_line = entry->_line;
ce->_name = i;
ce = new Entry();
ce->delim = delim;
ce->_tab = entry->_tab;
ce->_line = entry->_line;
ce->_name = i;
ce->_parent = entry;
entry->_children << ce;
entry = ce;
} else entry = te;
} else
entry = te;
}
PIConfig::Branch ch = entry->_children;
ch.sort(PIConfig::Entry::compare);
te = (entry->isLeaf() ? 0 : ch.back());
ce = new Entry();
ce->delim = delim;
ce->_name = ename;
te = (entry->isLeaf() ? 0 : ch.back());
ce = new Entry();
ce->delim = delim;
ce->_name = ename;
ce->_value = value;
ce->_type = type;
ce->_type = type;
if (te == 0) {
ce->_tab = entry->_tab;
if (toRoot) ce->_line = other.size_s() - 1;
else ce->_line = entry->_line;
if (toRoot)
ce->_line = other.size_s() - 1;
else
ce->_line = entry->_line;
} else {
ce->_tab = te->_tab;
if (toRoot) ce->_line = other.size_s() - 1;
if (toRoot)
ce->_line = other.size_s() - 1;
else {
ch = entry->_parent->_children;
ch.sort(PIConfig::Entry::compare);
@@ -500,7 +519,7 @@ void PIConfig::addEntry(const PIString & name, const PIString & value, const PIS
ce->_parent = entry;
entry->_children << ce;
other.insert(ce->_line, "");
Branch b = allLeaves();
Branch b = allLeaves();
bool found = false;
for (int i = 0; i < b.size_s(); ++i) {
if (found) {
@@ -510,8 +529,7 @@ void PIConfig::addEntry(const PIString & name, const PIString & value, const PIS
if (b[i] == ce) {
found = true;
if (i > 0)
if (b[i - 1]->_line == b[i]->_line)
b[i - 1]->_line++;
if (b[i - 1]->_line == b[i]->_line) b[i - 1]->_line++;
}
}
if (write) writeAll();
@@ -525,18 +543,17 @@ void PIConfig::setValue(const PIString & name, const PIString & value, const PIS
return;
}
e._value = value;
e._type = type;
e._type = type;
if (write) writeAll();
}
int PIConfig::entryIndex(const PIString & name) {
PIStringList tree = name.split(delim);
Entry * ce = &root;
piForeach (PIString & i, tree) {
Entry * ce = &root;
piForeach(PIString & i, tree) {
ce = ce->findChild(i);
if (ce == 0)
return -1;
if (ce == 0) return -1;
}
return allLeaves().indexOf(ce);
}
@@ -600,8 +617,7 @@ void PIConfig::removeEntry(Branch & b, PIConfig::Entry * e) {
leaf = false;
} else {
int cc = e->_children.size_s();
piForTimes (cc)
removeEntry(b, e->_children.back());
piForTimes(cc) removeEntry(b, e->_children.back());
}
bool found = false;
for (int i = 0; i < b.size_s(); ++i) {
@@ -620,10 +636,16 @@ void PIConfig::removeEntry(Branch & b, PIConfig::Entry * e) {
PIString PIConfig::getPrefixFromLine(PIString line, bool * exists) {
line.trim();
if (line.left(1) == "#") {if (exists) *exists = false; return PIString();}
if (line.left(1) == "#") {
if (exists) *exists = false;
return PIString();
}
int ci = line.find("#");
if (ci >= 0) line.cutRight(line.size() - ci);
if (line.find("=") >= 0) {if (exists) *exists = false; return PIString();}
if (line.find("=") >= 0) {
if (exists) *exists = false;
return PIString();
}
if (line.find("[") >= 0 && line.find("]") >= 0) {
if (exists) *exists = true;
return line.takeRange('[', ']').trim();
@@ -634,51 +656,47 @@ PIString PIConfig::getPrefixFromLine(PIString line, bool * exists) {
void PIConfig::writeAll() {
//cout << this << " write < " << size() << endl;
// cout << this << " write < " << size() << endl;
_clearDev();
buildFullNames(&root);
Branch b = allLeaves();
PIString prefix, tprefix;
bool isPrefix;
//for (int i = 0; i < b.size_s(); ++i)
// for (int i = 0; i < b.size_s(); ++i)
// cout << b[i]->_name << " = " << b[i]->_value << endl;
int j = 0;
for (int i = 0; i < other.size_s(); ++i) {
//cout << j << endl;
// cout << j << endl;
if (j >= 0 && j < b.size_s()) {
if (b[j]->_line == i) {
b[j]->buildLine();
_writeDev((b[j]->_all).cutLeft(prefix.size()) + "\n");
//cout << this << " " << b[j]->_all << endl;
// cout << this << " " << b[j]->_all << endl;
++j;
} else {
_writeDev(other[i]);
tprefix = getPrefixFromLine(other[i], &isPrefix);
if (isPrefix) {
prefix = tprefix;
if (!prefix.isEmpty())
prefix += delim;
if (!prefix.isEmpty()) prefix += delim;
}
if (i < other.size_s() - 1)
_writeDev('\n');
//cout << this << " " << other[i] << endl;
if (i < other.size_s() - 1) _writeDev('\n');
// cout << this << " " << other[i] << endl;
}
} else {
_writeDev(other[i]);
tprefix = getPrefixFromLine(other[i], &isPrefix);
if (isPrefix) {
prefix = tprefix;
if (!prefix.isEmpty())
prefix += delim;
if (!prefix.isEmpty()) prefix += delim;
}
if (i < other.size_s() - 1)
_writeDev('\n');
//cout << this << " " << other[i] << endl;
if (i < other.size_s() - 1) _writeDev('\n');
// cout << this << " " << other[i] << endl;
}
}
_flushDev();
readAll();
//cout << this << " write > " << size() << endl;
// cout << this << " write > " << size() << endl;
}
@@ -699,7 +717,7 @@ bool PIConfig::entryExists(const Entry * e, const PIString & name) const {
if (e->_children.isEmpty()) {
return (e->_name == name);
}
piForeachC (Entry * i, e->_children)
piForeachC(Entry * i, e->_children)
if (entryExists(i, name)) return true;
return false;
}
@@ -708,7 +726,7 @@ bool PIConfig::entryExists(const Entry * e, const PIString & name) const {
void PIConfig::updateIncludes() {
if (internal) return;
all_includes.clear();
piForeach (PIConfig * c, includes)
piForeach(PIConfig * c, includes)
all_includes << c->allLeaves();
}
@@ -719,15 +737,15 @@ PIString PIConfig::parseLine(PIString v) {
i = v.find("${");
if (i < 0) break;
PIString w = v.mid(i + 1).takeRange('{', '}'), r;
l = w.length() + 3;
w = parseLine(w);
l = w.length() + 3;
w = parseLine(w);
w.trim();
bool ex = false;
bool ex = false;
PIConfig::Entry & me = getValue(w, "", &ex);
if (ex) {
r = me._value;
} else {
piForeachC (PIConfig::Entry * e, all_includes)
piForeachC(PIConfig::Entry * e, all_includes)
if (e->_full_name == w) {
r = e->_value;
break;
@@ -740,13 +758,13 @@ PIString PIConfig::parseLine(PIString v) {
void PIConfig::parse() {
//piCout << "[PIConfig] charset" << PIFile::defaultCharset();
// piCout << "[PIConfig] charset" << PIFile::defaultCharset();
PIString src, str, tab, comm, all, name, type, prefix, tprefix;
PIStringList tree;
Entry * entry = 0, * te = 0, * ce = 0;
Entry *entry = 0, *te = 0, *ce = 0;
int ind, sind;
bool isNew = false, isPrefix = false, wasMultiline = false, isMultiline = false;
piForeach (PIConfig * c, inc_devs)
piForeach(PIConfig * c, inc_devs)
delete c;
inc_devs.clear();
includes.clear();
@@ -757,16 +775,15 @@ void PIConfig::parse() {
while (!_isEndDev()) {
other.push_back(PIString());
src = str = parseLine(_readLineDev());
tprefix = getPrefixFromLine(src, &isPrefix);
tprefix = getPrefixFromLine(src, &isPrefix);
if (isPrefix) {
prefix = tprefix;
if (!prefix.isEmpty())
prefix += delim;
if (!prefix.isEmpty()) prefix += delim;
}
//piCout << "line \"" << str << "\"";
// piCout << "line \"" << str << "\"";
tab = str.left(str.find(str.trimmed().left(1)));
str.trim();
all = str;
all = str;
sind = str.find('#');
if (sind > 0) {
@@ -774,7 +791,8 @@ void PIConfig::parse() {
if (!comm.isEmpty()) {
type = comm[0];
comm.cutLeft(1).trim();
} else type = "s";
} else
type = "s";
str = str.left(sind).trim();
} else {
type = "s";
@@ -798,14 +816,14 @@ void PIConfig::parse() {
ce = 0;
wasMultiline = isMultiline;
//piCout << "[PIConfig] str" << str.size() << str << str.toUTF8();
ind = str.find('=');
// piCout << "[PIConfig] str" << str.size() << str << str.toUTF8();
ind = str.find('=');
if ((ind > 0) && (str[0] != '#')) {
tree = (prefix + str.left(ind).trimmed()).split(delim);
if (tree.front() == "include") {
name = str.mid(ind + 1).trimmed();
name = str.mid(ind + 1).trimmed();
PIConfig * iconf = new PIConfig(name, incdirs);
//piCout << "include" << name << iconf->dev;
// piCout << "include" << name << iconf->dev;
if (!iconf->dev) {
delete iconf;
} else {
@@ -818,41 +836,43 @@ void PIConfig::parse() {
name = tree.back();
tree.pop_back();
entry = &root;
piForeachC (PIString & i, tree) {
piForeachC(PIString & i, tree) {
te = entry->findChild(i);
if (te == 0) {
ce = new Entry();
ce->delim = delim;
ce->_tab = tab;
ce->_line = lines;
ce->_name = i;
ce = new Entry();
ce->delim = delim;
ce->_tab = tab;
ce->_line = lines;
ce->_name = i;
ce->_parent = entry;
entry->_children << ce;
entry = ce;
} else entry = te;
} else
entry = te;
}
isNew = false;
ce = entry->findChild(name);
ce = entry->findChild(name);
if (ce == 0) {
ce = new Entry();
ce = new Entry();
isNew = true;
}
ce->delim = delim;
ce->_tab = tab;
ce->_name = name;
ce->_value = str.mid(ind + 1).trimmed();
ce->_type = type;
ce->delim = delim;
ce->_tab = tab;
ce->_name = name;
ce->_value = str.mid(ind + 1).trimmed();
ce->_type = type;
ce->_comment = comm;
//piCout << "[PIConfig] comm" << comm.size() << comm << comm.toUTF8();
//piCout << "[PIConfig] type" << type.size() << type << type.toUTF8();
ce->_line = lines;
ce->_all = all;
// piCout << "[PIConfig] comm" << comm.size() << comm << comm.toUTF8();
// piCout << "[PIConfig] type" << type.size() << type << type.toUTF8();
ce->_line = lines;
ce->_all = all;
if (isNew) {
ce->_parent = entry;
entry->_children << ce;
}
}
} else other.back() = src;
} else
other.back() = src;
lines++;
}
setEntryDelim(&root, delim);
@@ -861,13 +881,13 @@ void PIConfig::parse() {
#ifdef PIP_STD_IOSTREAM
std::ostream &operator <<(std::ostream & s, const PIConfig::Entry & v) {
std::ostream & operator<<(std::ostream & s, const PIConfig::Entry & v) {
s << v.value();
return s;
}
std::ostream &operator <<(std::ostream & s, const PIConfig::Branch & v) {
std::ostream & operator<<(std::ostream & s, const PIConfig::Branch & v) {
v.coutt(s, "");
return s;
}