tizen beta release
[framework/web/wrt-plugins-common.git] / src / modules / API / Contact / IAddressBook.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  * @file        IAddressBook.h
18  * @author      Lukasz Marek (l.marek@samsung.com)
19  * @version     0.1
20  */
21
22 #ifndef WRTDEVICEAPIS_CONTACT_IADDRESSBOOK_H_
23 #define WRTDEVICEAPIS_CONTACT_IADDRESSBOOK_H_
24
25 #include <string>
26 #include <dpl/log/log.h>
27 #include <dpl/shared_ptr.h>
28 #include <Contact/EventAddContact.h>
29 #include <Contact/EventDeleteContact.h>
30 #include <Contact/EventFindContacts.h>
31 #include <Contact/EventUpdateContact.h>
32 #include <Contact/EventGetAddressBookItemCount.h>
33 #include <Contact/EventAddGroup.h>
34 #include <Contact/EventDeleteGroup.h>
35 #include <Contact/EventFindGroup.h>
36 #include <Contact/EventExportVCard.h>
37
38 namespace WrtDeviceApis {
39 namespace Contact {
40 namespace Api {
41
42 class IAddressBookObject :
43     public Commons::EventRequestReceiver<EventAddContact>,
44     public Commons::EventRequestReceiver<EventUpdateContact>,
45     public Commons::EventRequestReceiver<EventFindContacts>,
46     public Commons::EventRequestReceiver<EventDeleteContact>,
47     public Commons::EventRequestReceiver<EventGetAddressBookItemCount>,
48     public Commons::EventRequestReceiver<EventAddGroup>,
49     public Commons::EventRequestReceiver<EventDeleteGroup>,
50     public Commons::EventRequestReceiver<EventFindGroup>,
51     public Commons::EventRequestReceiver<EventExportVCard>,
52     public IContactEventPrivateData
53 {
54   public:
55     typedef enum
56     {
57         SIMBook,
58         PhoneBook
59     } BookType;
60
61     virtual ~IAddressBookObject();
62     explicit IAddressBookObject(BookType type);
63
64     virtual void addContact(const EventAddContactPtr &event);
65     virtual void updateContact(const EventUpdateContactPtr &event);
66     virtual void findContacts(const EventFindContactsPtr &event);
67     virtual void deleteContact(const EventDeleteContactPtr &event);
68     virtual void getNumberOfContact(
69             const EventGetAddressBookItemCountPtr &event);
70     virtual void addGroup(const EventAddGroupPtr &event);
71     virtual void deleteGroup(const EventDeleteGroupPtr &event);
72     virtual void findGroup(const EventFindGroupPtr &event);
73     virtual void exportToVCard(const EventExportVCardPtr &event);
74
75     virtual BookType getType() const;
76     virtual std::string getName() const = 0;
77     virtual void setName(const std::string &value) = 0;
78
79   protected:
80     BookType m_bookType;
81
82     virtual void OnRequestReceived(const EventAddContactPtr &event) = 0;
83     virtual void OnRequestReceived(const EventUpdateContactPtr &event) = 0;
84     virtual void OnRequestReceived(const EventDeleteContactPtr &event) = 0;
85     virtual void OnRequestReceived(const EventFindContactsPtr &event) = 0;
86     virtual void OnRequestReceived(
87             const EventGetAddressBookItemCountPtr &event) = 0;
88     virtual void OnRequestReceived(const EventAddGroupPtr &event) = 0;
89     virtual void OnRequestReceived(const EventDeleteGroupPtr &event) = 0;
90     virtual void OnRequestReceived(const EventFindGroupPtr &event) = 0;
91     virtual void OnRequestReceived(const EventExportVCardPtr &event) = 0;
92 };
93
94 typedef DPL::SharedPtr<IAddressBookObject> IAddressBookObjectPtr;
95
96 }
97 }
98 }
99
100 #endif // WRTDEVICEAPIS_CONTACT_IADDRESSBOOK_H_