edelib
2.0.0
|
00001 /* 00002 * $Id: EdbusDict.h 3295 2012-05-15 12:52:41Z karijes $ 00003 * 00004 * D-BUS stuff 00005 * Copyright (c) 2008 edelib authors 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public License 00018 * along with this library. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef __EDELIB_EDBUSDICT_H__ 00022 #define __EDELIB_EDBUSDICT_H__ 00023 00024 #include "EdbusData.h" 00025 #include "EdbusContainer.h" 00026 00027 EDELIB_NS_BEGIN 00028 00034 struct EDELIB_API EdbusDictEntry { 00036 EdbusData key; 00038 EdbusData value; 00039 00043 bool operator==(const EdbusDictEntry& other) const { 00044 if(key == other.key && value == other.value) 00045 return true; 00046 return false; 00047 } 00048 00052 bool operator!=(const EdbusDictEntry& other) const { return !operator==(other); } 00053 }; 00054 00121 struct EDELIB_API EdbusDict : public EdbusContainer<EdbusDictEntry> { 00125 typedef EdbusContainer<EdbusDictEntry>::const_iterator const_iterator; 00126 00134 void append(const EdbusData& key, const EdbusData& value); 00135 00139 void clear(void); 00140 00147 void remove(const EdbusData& key); 00148 00156 EdbusData find(const EdbusData& key); 00157 00161 bool operator==(const EdbusDict& other); 00162 00166 bool operator!=(const EdbusDict& other) { return !operator==(other); } 00167 00171 EdbusDataType key_type(void); 00172 00176 EdbusDataType value_type(void); 00177 00181 bool value_type_is_container(void); 00182 00186 const_iterator begin(void) const; 00187 00192 const_iterator end(void) const; 00193 00197 unsigned int size(void) const; 00198 }; 00199 00200 EDELIB_NS_END 00201 #endif