#include <vector>
#include <boost/scoped_ptr.hpp>
#include <string>
#include <ostream>
Go to the source code of this file.
Classes | |
class | FWConfiguration |
Functions | |
void | streamTo (std::ostream &, const FWConfiguration &, const std::string &name) |
void streamTo | ( | std::ostream & | oTo, |
const FWConfiguration & | iConfig, | ||
const std::string & | name | ||
) |
Streaming FWConfiguration objects to xml.
Example of dump is:
<config name="top" version="1"> <string value="S1"> <string value="S2"> ... <string value="SN"> <config name="c1"> ... </configuration> <config name="c2"> ... </config> ... </config>
Streaming the top level configuration item will stream all its children.
Definition at line 215 of file FWConfiguration.cc.
References attrEscape(), FWConfiguration::keyValues(), streamTo(), FWConfiguration::stringValues(), and FWConfiguration::version().
Referenced by streamTo(), and FWConfigurationManager::writeToFile().
{ static int recursionLevel = -1; recursionLevel += 1; std::string indentation(recursionLevel, ' '); oTo << indentation << "<config name=\"" << name << "\" version=\"" << iConfig.version() << "\">\n"; if(iConfig.stringValues()) { for(FWConfiguration::StringValues::const_iterator it = iConfig.stringValues()->begin(); it != iConfig.stringValues()->end(); ++it) { oTo << indentation << " <string>" << attrEscape(*it) << "</string>\n"; } } if(iConfig.keyValues()) { for(FWConfiguration::KeyValues::const_iterator it = iConfig.keyValues()->begin(); it != iConfig.keyValues()->end(); ++it) { streamTo(oTo, it->second, attrEscape(it->first)); } } oTo << indentation << "</config>" << std::endl; recursionLevel -= 1; }