edelib 2.1.0
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
27EDELIB_NS_BEGIN
28
114class EDELIB_API EdbusList : public EdbusContainer<EdbusData> {
115private:
116 bool array_mode;
117 EdbusList();
118
119public:
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
166
172
176 bool list_is_array(void) const { return array_mode; }
177
181 bool list_is_struct(void) const { return !array_mode; }
182
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
219inline EdbusList& operator<<(EdbusList& lst, const EdbusData& val) {
220 lst.append(val);
221 return lst;
222}
223
224EDELIB_NS_END
225#endif
Abstract container for D-Bus containers.
Definition: EdbusContainer.h:52
Class for representing D-Bus data types.
Definition: EdbusData.h:110
A class representing D-Bus struct and array.
Definition: EdbusList.h:114
const_iterator end(void) const
void remove(const EdbusData &val)
bool list_is_array(void) const
Definition: EdbusList.h:176
bool operator==(const EdbusList &other) const
bool operator!=(const EdbusList &other) const
Definition: EdbusList.h:159
EdbusDataType value_type(void)
bool list_is_struct(void) const
Definition: EdbusList.h:181
bool value_type_is_container(void)
static EdbusList create_struct(void)
Definition: EdbusList.h:207
const_iterator begin(void) const
void remove_all(const EdbusData &val)
static EdbusList create_array(void)
Definition: EdbusList.h:202
void append(const EdbusData &val)
void clear(void)
unsigned int size(void) const
EdbusContainer< EdbusData >::const_iterator const_iterator
Definition: EdbusList.h:123
EdbusDataType
Type of data current EdbusData object holds.
Definition: EdbusData.h:41
EdbusList & operator<<(EdbusList &lst, const EdbusData &val)
Definition: EdbusList.h:219