2 * Copyright (C) 2003-2007 Funambol, Inc
3 * Copyright (C) 2008 Patrick Ohly
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
12 * PURPOSE. See the GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #ifndef INCL_EVOLUTION_FILE_CONFIG_NODE
21 # define INCL_EVOLUTION_FILE_CONFIG_NODE
23 #include "ConfigNode.h"
30 * This class started its life as the Posix implementation of the
31 * ManagementNode in the Funambol C++ client library. Nowadays it is
32 * part of the SyncEvoluition ConfigTree (see there for details).
34 * Each node is mapped to one file whose location is determined by
35 * the ConfigTree when the node gets created. Each node represents
36 * one .ini file with entries of the type
37 * <property>\s*=\s*<value>\s*\n
42 * @todo rewrite with standard C++ containers
44 class FileConfigNode : public ConfigNode {
56 * Open or create a new file. The file will be physically created
57 * right away whereas changes to its content will not be written
60 * @param path node name, maps to directory
61 * @param fileName name of file inside that directory
63 FileConfigNode(const string &path, const string &fileName);
65 virtual string getName() const { return m_path + "/" + m_fileName; }
68 virtual string readProperty(const string &property) const;
69 virtual void setProperty(const string &property,
71 const string &comment = "",
72 const string *defValue = NULL);
73 virtual void readProperties(map<string, string> &props) const;
74 virtual void removeProperty(const string &property);
75 virtual bool exists() const { return m_exists; }