OpenAB  1.0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
EDSContactsStorage.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  */
12 #include <string>
13 
14 #ifndef OPENAB_PLUGIN_EDS_CONTACTS_HPP_
15 #define OPENAB_PLUGIN_EDS_CONTACTS_HPP_
16 
34 {
35  public:
36  EDSContactsStorage(const std::string&);
37 
39 
41 
43 
45 
47 
49 
50  int getTotalCount() const;
51 
52  enum eAddItem addContact( const std::string& vCard,
53  OpenAB::PIMItem::ID& newId,
54  OpenAB::PIMItem::Revision& revision);
55 
56  enum eAddItem addContacts( const std::vector<std::string> &vCards,
57  OpenAB::PIMItem::IDs& newIds,
58  OpenAB::PIMItem::Revisions& revisions);
59 
60  enum eModifyItem modifyContact( const std::string& vCard,
61  const OpenAB::PIMItem::ID& id,
62  OpenAB::PIMItem::Revision& revision);
63 
64  enum eModifyItem modifyContacts( const std::vector<std::string> &vCard,
65  const OpenAB::PIMItem::IDs& ids,
66  OpenAB::PIMItem::Revisions& revisions);
67 
69 
71 
72  enum eGetItem getContact (const OpenAB::PIMItem::ID & id,
74 
75  enum eGetItem getContacts(const OpenAB::PIMItem::IDs & ids,
76  std::vector<OpenAB::SmartPtr<OpenAB::PIMContactItem> > & items);
77 
78  //TODO: add comments
79  enum OpenAB_Storage::Storage::eGetRevisions getRevisions(std::map<std::string, std::string>& revisions);
80 
81  enum OpenAB_Storage::Storage::eGetRevisions getChangedRevisions(const std::string& token,
82  std::map<std::string, std::string>& revisions,
83  std::vector<OpenAB::PIMItem::ID>& removed);
84 
86 
88 
89  private:
90  OpenAB::PIMItem::Revision getRevision(const OpenAB::PIMItem::ID& id);
92  std::string database;
93  ESourceRegistry * registry;
94  ESource * source;
95  EBookClient * client;
96  EDSContactsStorageItemIterator* contactsIterator;
97 };
98 
99 #endif /* OpenAB_PLUGIN_EDS_CONTACTS_HPP_ */
enum eRemoveItem removeContact(const OpenAB::PIMItem::ID &id)
Removes contact from the ContactsStorage.
Definition: EDSContactsStorage.cpp:320
std::string Revision
Definition: PIMItem.hpp:89
enum eAddItem addContact(const std::string &vCard, OpenAB::PIMItem::ID &newId, OpenAB::PIMItem::Revision &revision)
Adds a new contact to the ContactsStorage.
Definition: EDSContactsStorage.cpp:164
Documentation for ContactsStorage interface. Provides functionalities specific to Storage of OpenAB::...
Definition: ContactsStorage.hpp:27
enum eGetItem getContacts(const OpenAB::PIMItem::IDs &ids, std::vector< OpenAB::SmartPtr< OpenAB::PIMContactItem > > &items)
Get the contacts from the Storage.
Definition: EDSContactsStorage.cpp:384
eCancelRet
Definition: Source.hpp:138
eResumeRet
Definition: Source.hpp:123
enum OpenAB_Storage::Storage::eGetRevisions getRevisions(std::map< std::string, std::string > &revisions)
Gets revision of the items from the Storage.
Definition: EDSContactsStorage.cpp:400
eModifyItem
Definition: Storage.hpp:164
std::vector< OpenAB::PIMItem::Revision > Revisions
Definition: PIMItem.hpp:111
eAddItem
Definition: Storage.hpp:126
Definition: EDSContactsStorage.hpp:33
Documentation for class EDSStorageItemIterator.
Definition: EDSContactsStorageItemIterator.hpp:18
enum OpenAB_Source::Source::eResumeRet resume()
Resumes Source, if such operation is supported.
Definition: EDSContactsStorage.cpp:113
OpenAB_Storage::StorageItemIterator * newStorageItemIterator()
Retrieve an new Iterator to quickly parse the list of items.
Definition: EDSContactsStorage.cpp:442
enum OpenAB_Source::Source::eInit init()
Initializes Source.
Definition: EDSContactsStorage.cpp:41
eSuspendRet
Definition: Source.hpp:108
enum OpenAB_Source::Source::eCancelRet cancel()
Cancels Source, if such operation is supported. After canceling Source next call to getVCard() should...
Definition: EDSContactsStorage.cpp:118
The StorageItemIterator is mainly used to quickly browse the Storage contents.
Definition: StorageItem.hpp:97
std::vector< OpenAB::PIMItem::ID > IDs
Definition: PIMItem.hpp:110
enum OpenAB_Storage::Storage::eGetRevisions getChangedRevisions(const std::string &token, std::map< std::string, std::string > &revisions, std::vector< OpenAB::PIMItem::ID > &removed)
Gets revisions of items changed since Storage was in state identified by token.
Definition: EDSContactsStorage.cpp:430
enum eModifyItem modifyContact(const std::string &vCard, const OpenAB::PIMItem::ID &id, OpenAB::PIMItem::Revision &revision)
Modifies contact in the ContactsStorage.
Definition: EDSContactsStorage.cpp:258
~EDSContactsStorage()
Definition: EDSContactsStorage.cpp:25
eGetItemRet
Definition: Source.hpp:155
enum eModifyItem modifyContacts(const std::vector< std::string > &vCard, const OpenAB::PIMItem::IDs &ids, OpenAB::PIMItem::Revisions &revisions)
Modifies contacts in the ContactsStorage.
Definition: EDSContactsStorage.cpp:283
eGetItem
Definition: Storage.hpp:226
enum OpenAB_Source::Source::eGetItemRet getItem(OpenAB::SmartPtr< OpenAB::PIMItem > &item)
Gets PIM Item from Source. If Source is suspended getItem() should block until Source will be resumed...
Definition: EDSContactsStorage.cpp:86
eGetRevisions
Definition: Storage.hpp:265
enum eRemoveItem removeContacts(const OpenAB::PIMItem::IDs &ids)
Removes contacts from the ContactsStorage.
Definition: EDSContactsStorage.cpp:333
enum eGetItem getContact(const OpenAB::PIMItem::ID &id, OpenAB::SmartPtr< OpenAB::PIMContactItem > &item)
Get the contact from the Storage.
Definition: EDSContactsStorage.cpp:356
enum OpenAB_Storage::Storage::eGetSyncToken getLatestSyncToken(std::string &)
If storage supports tracking of items changes, it returns latest status identifier of the storage...
Definition: EDSContactsStorage.cpp:437
int getTotalCount() const
Returns total count of items available from Source, if such information is available.
Definition: EDSContactsStorage.cpp:123
eGetSyncToken
Definition: Storage.hpp:251
eInit
Definition: Source.hpp:94
std::string ID
Definition: PIMItem.hpp:64
enum eAddItem addContacts(const std::vector< std::string > &vCards, OpenAB::PIMItem::IDs &newIds, OpenAB::PIMItem::Revisions &revisions)
Adds new contacts to the ContactsStorage.
Definition: EDSContactsStorage.cpp:202
EDSContactsStorage(const std::string &)
Definition: EDSContactsStorage.cpp:14
eRemoveItem
Definition: Storage.hpp:201
enum OpenAB_Source::Source::eSuspendRet suspend()
Suspends Source, if such operation is supported.
Definition: EDSContactsStorage.cpp:108