fixes for missing or broken interface items for Phoenix
[wxWidgets.git] / interface / wx / fileconf.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: fileconf.h
3 // Purpose: interface of wxFileConfig
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxFileConfig
11
12 wxFileConfig implements wxConfigBase interface for
13 storing and retrieving configuration information using plain text files. The
14 files have a simple format reminiscent of Windows INI files with lines of the
15 form @c "key = value" defining the keys and lines of special form
16 @c "[group]" indicating the start of each group.
17
18 This class is used by default for wxConfig on Unix platforms but may also be
19 used explicitly if you want to use files and not the registry even under
20 Windows.
21
22 @library{wxbase}
23 @category{cfg}
24
25 @see wxFileConfig::Save
26 */
27 class wxFileConfig : public wxConfigBase
28 {
29 public:
30
31 // New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or
32 // wxCONFIG_USE_GLOBAL_FILE to say which files should be used.
33 wxFileConfig(const wxString& appName = wxEmptyString,
34 const wxString& vendorName = wxEmptyString,
35 const wxString& localFilename = wxEmptyString,
36 const wxString& globalFilename = wxEmptyString,
37 long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE,
38 const wxMBConv& conv = wxConvAuto());
39
40 /**
41 Read the config data from the specified stream instead of the associated file,
42 as usual.
43
44 @see Save()
45 */
46 wxFileConfig(wxInputStream& is, const wxMBConv& conv = wxConvAuto());
47
48 /**
49 Return the full path to the file which would be used by wxFileConfig as global,
50 system-wide, file if it were constructed with @a basename as "global filename"
51 parameter in the constructor.
52
53 Notice that this function cannot be used if @a basename is already a full path name.
54 */
55 static wxFileName GetGlobalFile(const wxString& basename);
56
57 /**
58 Return the full path to the file which would be used by wxFileConfig as local,
59 user-specific, file if it were constructed with @a basename as "local filename"
60 parameter in the constructor.
61
62 @a style has the same meaning as in @ref wxConfigBase::wxConfigBase "wxConfig constructor"
63 and can contain any combination of styles but only wxCONFIG_USE_SUBDIR bit is
64 examined by this function.
65
66 Notice that this function cannot be used if @a basename is already a full path name.
67 */
68 static wxFileName GetLocalFile(const wxString& basename, int style = 0);
69
70 static wxString GetGlobalFileName(const wxString& szFile);
71 static wxString GetLocalFileName(const wxString& szFile, int style = 0);
72
73 /**
74 Saves all config data to the given stream, returns @true if data was saved
75 successfully or @false on error.
76
77 Note the interaction of this function with the internal "dirty flag": the
78 data is saved unconditionally, i.e. even if the object is not dirty. However
79 after saving it successfully, the dirty flag is reset so no changes will be
80 written back to the file this object is associated with until you change its
81 contents again.
82
83 @see wxConfigBase::Flush
84 */
85 virtual bool Save(wxOutputStream& os, const wxMBConv& conv = wxConvAuto());
86
87 /**
88 Allows to set the mode to be used for the config file creation. For example, to
89 create a config file which is not readable by other users (useful if it stores
90 some sensitive information, such as passwords), you could use @c SetUmask(0077).
91
92 This function doesn't do anything on non-Unix platforms.
93
94 @see wxCHANGE_UMASK()
95 */
96 void SetUmask(int mode);
97
98 // implement inherited pure virtual functions
99 virtual void SetPath(const wxString& strPath);
100 virtual const wxString& GetPath() const;
101
102 virtual bool GetFirstGroup(wxString& str, long& lIndex) const;
103 virtual bool GetNextGroup (wxString& str, long& lIndex) const;
104 virtual bool GetFirstEntry(wxString& str, long& lIndex) const;
105 virtual bool GetNextEntry (wxString& str, long& lIndex) const;
106
107 virtual size_t GetNumberOfEntries(bool bRecursive = false) const;
108 virtual size_t GetNumberOfGroups(bool bRecursive = false) const;
109
110 virtual bool HasGroup(const wxString& strName) const;
111 virtual bool HasEntry(const wxString& strName) const;
112
113 virtual bool Flush(bool bCurrentOnly = false);
114
115 virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
116 virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
117
118 virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true);
119 virtual bool DeleteGroup(const wxString& szKey);
120 virtual bool DeleteAll();
121 };
122