4.06.2013 - Version 0.3.4 - PIOBJECT() macro, ethernet improvement, documentation based on Doxygen
This commit is contained in:
12
piconfig.cpp
12
piconfig.cpp
@@ -277,7 +277,7 @@ void PIConfig::addEntry(const PIString & name, const PIString & value, const PIS
|
||||
void PIConfig::setValue(const PIString & name, const PIString & value, const PIString & type, bool write) {
|
||||
Entry & e(getValue(name));
|
||||
if (&e == &empty) {
|
||||
addEntry(name, value, type);
|
||||
addEntry(name, value, type, write);
|
||||
return;
|
||||
}
|
||||
e._value = value;
|
||||
@@ -376,10 +376,14 @@ void PIConfig::removeEntry(Branch & b, PIConfig::Entry * e) {
|
||||
|
||||
|
||||
void PIConfig::writeAll() {
|
||||
//cout << this << " write < " << size() << endl;
|
||||
clear();
|
||||
//*this << "1234567894132456798\n"; return;
|
||||
//writeEntry(&root);
|
||||
buildFullNames(&root);
|
||||
Branch b = allLeaves();
|
||||
//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;
|
||||
@@ -387,25 +391,27 @@ void PIConfig::writeAll() {
|
||||
if (b[j]->_line == i) {
|
||||
b[j]->buildLine();
|
||||
*this << b[j]->_all << '\n';
|
||||
//cout << this << " " << b[j]->_all << endl;
|
||||
++j;
|
||||
} else {
|
||||
*this << other[i];
|
||||
if (i < other.size_s() - 1) *this << '\n';
|
||||
//cout << this << " " << other[i] << endl;
|
||||
}
|
||||
} else {
|
||||
*this << other[i];
|
||||
if (i < other.size_s() - 1) *this << '\n';
|
||||
//cout << this << " " << other[i] << endl;
|
||||
}
|
||||
//cout << other[i] << endl;
|
||||
}
|
||||
flush();
|
||||
readAll();
|
||||
//cout << this << " write > " << size() << endl;
|
||||
}
|
||||
|
||||
|
||||
void PIConfig::readAll() {
|
||||
root.clear();
|
||||
flush();
|
||||
parse();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user