edelib 1.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List

EdbusList.h
1 /*
2 * $Id: EdbusList.h 2839 2009-09-28 11:36:20Z karijes $
3 *
4 * D-BUS stuff
5 * Copyright (c) 2008 edelib authors
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef __EDELIB_EDBUSLIST_H__
22 #define __EDELIB_EDBUSLIST_H__
23
24 #include "EdbusData.h"
25 #include "EdbusContainer.h"
26
27 EDELIB_NS_BEGIN
28
114 class EDELIB_API EdbusList : public EdbusContainer<EdbusData> {
115 private:
116 bool array_mode;
117 EdbusList();
118
119 public:
123 typedef EdbusContainer<EdbusData>::const_iterator const_iterator;
124
129 explicit EdbusList(bool a);
130
134 void append(const EdbusData& val);
135
139 void clear(void);
140
144 void remove(const EdbusData& val);
145
149 void remove_all(const EdbusData& val);
150
154 bool operator==(const EdbusList& other) const;
155
159 bool operator!=(const EdbusList& other) const { return !operator==(other); }
160
165 EdbusDataType value_type(void);
166
171 bool value_type_is_container(void);
172
176 bool list_is_array(void) const { return array_mode; }
177
181 bool list_is_struct(void) const { return !array_mode; }
182
186 const_iterator begin(void) const;
187
192 const_iterator end(void) const;
193
197 unsigned int size(void) const;
198
202 static EdbusList create_array(void) { return EdbusList(true); }
203
207 static EdbusList create_struct(void) { return EdbusList(false); }
208 };
209
219 inline EdbusList& operator<<(EdbusList& lst, const EdbusData& val) {
220 lst.append(val);
221 return lst;
222 }
223
224 EDELIB_NS_END
225 #endif