|
a/src/conftree.cpp |
|
b/src/conftree.cpp |
|
... |
|
... |
272 |
}
|
272 |
}
|
273 |
value = s->second;
|
273 |
value = s->second;
|
274 |
return 1;
|
274 |
return 1;
|
275 |
}
|
275 |
}
|
276 |
|
276 |
|
|
|
277 |
int ConfSimple::get(const string& nm, int *value, const string& sk) const
|
|
|
278 |
{
|
|
|
279 |
string sval;
|
|
|
280 |
if (!get(nm, sval, sk)) {
|
|
|
281 |
return 0;
|
|
|
282 |
}
|
|
|
283 |
*value = atoi(sval.c_str());
|
|
|
284 |
return 1;
|
|
|
285 |
}
|
|
|
286 |
|
277 |
// Appropriately output a subkey (nm=="") or variable line.
|
287 |
// Appropriately output a subkey (nm=="") or variable line.
|
278 |
// We can't make any assumption about the data except that it does not
|
288 |
// We can't make any assumption about the data except that it does not
|
279 |
// contain line breaks.
|
289 |
// contain line breaks.
|
280 |
// Avoid long lines if possible (for hand-editing)
|
290 |
// Avoid long lines if possible (for hand-editing)
|
281 |
// We used to break at arbitrary places, but this was ennoying for
|
291 |
// We used to break at arbitrary places, but this was ennoying for
|
|
... |
|
... |
330 |
if (!i_set(nm, value, sk)) {
|
340 |
if (!i_set(nm, value, sk)) {
|
331 |
return 0;
|
341 |
return 0;
|
332 |
}
|
342 |
}
|
333 |
return write();
|
343 |
return write();
|
334 |
}
|
344 |
}
|
|
|
345 |
int ConfSimple::set(const string& nm, long long val,
|
|
|
346 |
const string& sk)
|
|
|
347 |
{
|
|
|
348 |
return this->set(nm, lltodecstr(val), sk);
|
|
|
349 |
}
|
|
|
350 |
|
335 |
|
351 |
|
336 |
// Internal set variable: no rw checking or file rewriting. If init is
|
352 |
// Internal set variable: no rw checking or file rewriting. If init is
|
337 |
// set, we're doing initial parsing, else we are changing a parsed
|
353 |
// set, we're doing initial parsing, else we are changing a parsed
|
338 |
// tree (changes the way we update the order data)
|
354 |
// tree (changes the way we update the order data)
|
339 |
int ConfSimple::i_set(const std::string& nm, const std::string& value,
|
355 |
int ConfSimple::i_set(const std::string& nm, const std::string& value,
|