2 * Copyright (C) 2008-2009 Patrick Ohly <patrick.ohly@gmx.de>
3 * Copyright (C) 2009 Intel Corporation
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) version 3.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 #include <syncevo/IniConfigNode.h>
22 #include <syncevo/SafeConfigNode.h>
24 #include <syncevo/declarations.h>
30 boost::shared_ptr<ConfigNode> ConfigNode::createFileNode(const string &filename)
32 string::size_type off = filename.rfind('/');
33 boost::shared_ptr<ConfigNode> filenode;
34 if (off != filename.npos) {
35 filenode.reset(new IniFileConfigNode(filename.substr(0, off),
36 filename.substr(off + 1),
39 filenode.reset(new IniFileConfigNode(".", filename, false));
41 boost::shared_ptr<SafeConfigNode> savenode(new SafeConfigNode(filenode));
42 savenode->setMode(false);
46 void ConfigNode::writeProperties(const ConfigProps &props)
48 BOOST_FOREACH(const ConfigProps::value_type &entry, props) {
49 setProperty(entry.first, entry.second);