~ubuntu-branches/ubuntu/raring/sflphone/raring

« back to all changes in this revision

Viewing changes to daemon/src/config/config.h

  • Committer: Package Import Robot
  • Author(s): Whoopie
  • Date: 2012-03-22 10:29:10 UTC
  • mfrom: (4.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20120322102910-tb8hugi2su1tguwh
Tags: 1.0.2-1ubuntu1
* Apply some upstream patches to fix FTBFS (LP: #913018):
  - debian/patches/05_glib_includes.patch: fix glib includes.
  - debian/patches/06_use_XkbKeycodeToKeysym.patch: use 
    XkbKeycodeToKeysym instead of (deprecated) XKeycodeToKeysym.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 
48
48
class ConfigTreeItem;
49
49
typedef std::map<std::string, ConfigTreeItem> ItemMap;
50
 
typedef std::map<std::string, ItemMap*> SectionMap;
51
 
typedef std::list<std::string> TokenList;
 
50
typedef std::map<std::string, ItemMap> SectionMap;
52
51
 
53
52
class ConfigTreeItemException {
54
53
};
58
57
class ConfigTreeIterator {
59
58
 
60
59
    public:
61
 
        /**
62
 
         * Parsing method
63
 
         * @return TokenList
64
 
         */
65
 
        TokenList begin();
 
60
        std::list<std::string> begin() const;
66
61
 
67
 
        /**
68
 
         * Parsing method
69
 
         * @return TokenList
70
 
         */
71
 
        const TokenList& end() const {
 
62
        const std::list<std::string> & end() const {
72
63
            return endToken_;
73
64
        }
74
65
 
75
 
        /**
76
 
         * Parsing method
77
 
         * @return TokenList
78
 
         */
79
 
        TokenList next();
 
66
        std::list<std::string> next();
80
67
 
81
68
    private:
82
69
        friend class ConfigTree;
85
72
        NON_COPYABLE(ConfigTreeIterator);
86
73
 
87
74
        ConfigTree* tree_;
88
 
        TokenList endToken_;
89
 
        SectionMap::iterator iter_;
90
 
        ItemMap::iterator iterItem_;
 
75
        std::list<std::string> endToken_;
 
76
        mutable SectionMap::iterator iter_;
 
77
        mutable ItemMap::iterator iterItem_;
91
78
};
92
79
 
93
80
class ConfigTree {
94
81
    public:
95
82
        ConfigTree() : sections_(), defaultValueMap_() {}
96
 
        ~ConfigTree();
97
83
        /**
98
84
         * Add a default value for a given key.
99
85
         * It looks in a map of default values when
118
104
         *
119
105
         * @return array Strings of the sections
120
106
         */
121
 
        TokenList getSections();
 
107
        std::list<std::string> getSections() const;
122
108
 
123
109
        void addConfigTreeItem(const std::string& section, const ConfigTreeItem item);
124
110
        /**
128
114
         * @param itemName The itemName= in the .ini file
129
115
         * @param value The value to assign to that itemName
130
116
         */
131
 
        bool setConfigTreeItem(const std::string& section, const std::string& itemName, const std::string& value);
 
117
        void setConfigTreeItem(const std::string& section, const std::string& itemName, const std::string& value);
132
118
 
133
119
        /**
134
120
         * Get a value.
149
135
        /**
150
136
         * Flush data to .ini file
151
137
         */
152
 
        bool saveConfigTree(const std::string& fileName);
 
138
        bool saveConfigTree(const std::string& fileName) const;
153
139
 
154
140
        /**
155
141
         * Load data (and fill ConfigTree) from disk
156
142
         */
157
 
        int  populateFromFile(const std::string& fileName);
 
143
        bool populateFromFile(const std::string& fileName);
158
144
 
159
 
        bool getConfigTreeItemToken(const std::string& section, const std::string& itemName, TokenList& arg) const;
 
145
        bool getConfigTreeItemToken(const std::string& section, const std::string& itemName, std::list<std::string>& arg) const;
160
146
 
161
147
    private:
162
148
        std::string getDefaultValue(const std::string& key) const;
196
182
            value_ = value;
197
183
        }
198
184
 
199
 
        const std::string getName() const {
 
185
        std::string getName() const {
200
186
            return name_;
201
187
        }
202
188
 
203
 
        const std::string getValue() const  {
 
189
        std::string getValue() const  {
204
190
            return value_;
205
191
        }
206
192
 
207
 
        const std::string getDefaultValue() const  {
 
193
        std::string getDefaultValue() const  {
208
194
            return defaultValue_;
209
195
        }
210
196
 
211
 
        const std::string getType() const  {
 
197
        std::string getType() const  {
212
198
            return type_;
213
199
        }
214
200