OpenAB  1.0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
StorageItem.hpp
Go to the documentation of this file.
1 /*
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5  */
10 #ifndef STORAGE_ITEM_HPP_
11 #define STORAGE_ITEM_HPP_
12 
13 #include <PIMItem/PIMItem.hpp>
14 #include <string>
15 
16 namespace OpenAB_Storage {
17 
23 {
24  public:
29 
36  StorageItem(std::string i,
37  OpenAB::PIMItem* v)
38  : id(i)
39  , item(v)
41 
47  StorageItem(std::string i,
49  : id(i)
50  , item(v)
52 
57  StorageItem(const StorageItem& other)
58  {
59  id = other.id;
60  item = other.item;
61  status = other.status;
62  }
63 
68  {
69  }
70 
76  bool operator==(const StorageItem& lhs)
77  {return id == lhs.id &&
78  item->getIndex()->compare(*lhs.item->getIndex()) &&
79  status == lhs.status ;};
80 
81  std::string id;
84  enum{
90  }status;
91 };
92 
93 
98 {
99  public:
102 
107  virtual StorageItem* next() = 0;
112  virtual StorageItem operator*() = 0;
117  virtual StorageItem* operator->() = 0;
118 
123  virtual unsigned int getSize() const = 0;
124 };
125 
126 }
127 
128 #endif /* StorageItemIterator */
Definition: StorageItem.hpp:87
StorageItem()
Default constructor.
Definition: StorageItem.hpp:28
Definition: StorageItem.hpp:86
std::string id
OpenAB_Storage::Storage unique ID of the item.
Definition: StorageItem.hpp:79
virtual SmartPtr< PIMItemIndex > getIndex()=0
Returns index for given item.
Definition: StorageItem.hpp:89
virtual unsigned int getSize() const =0
Retrieve number of items in interator.
This object associates OpenAB::PIMItem with its unique ID from OpenAB_Storage::Storage. Additionally it stores status flag used in synchronization process.
Definition: StorageItem.hpp:22
Definition: StorageItem.hpp:85
StorageItem(std::string i, OpenAB::SmartPtr< OpenAB::PIMItem > v)
Constructor.
Definition: StorageItem.hpp:47
virtual StorageItem * next()=0
Retrieve the next StorageItem.
The StorageItemIterator is mainly used to quickly browse the Storage contents.
Definition: StorageItem.hpp:97
virtual ~StorageItemIterator()
Definition: StorageItem.hpp:101
StorageItem(const StorageItem &other)
Copy constructor.
Definition: StorageItem.hpp:57
virtual StorageItem operator*()=0
Retrieve the current StorageItem.
enum OpenAB_Storage::StorageItem::@1 status
StorageItem(std::string i, OpenAB::PIMItem *v)
Constructor.
Definition: StorageItem.hpp:36
Definition: StorageItem.hpp:88
bool operator==(const StorageItem &lhs)
Comparison operator. Compares id, status and OpenAB::PIMItemIndex of both instance.
Definition: StorageItem.hpp:76
StorageItemIterator()
Definition: StorageItem.hpp:100
virtual StorageItem * operator->()=0
Retrieve the current StorageItem.
~StorageItem()
Destructor.
Definition: StorageItem.hpp:67
Class representing PIM item.
Definition: PIMItem.hpp:22
OpenAB::SmartPtr< OpenAB::PIMItem > item
PIMItem.
Definition: StorageItem.hpp:82