upload tizen1.0 source
[profile/ivi/wrt-plugins-tizen.git] / src / platform / 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 /**
18  * @file        IAddressBook.h
19  * @author      Kisub Song (kisubs.song@samsung.com)
20  * @version     0.1
21  * @brief
22  */
23
24 #ifndef _API_CONTACT_IADDRESS_BOOK_H_
25 #define _API_CONTACT_IADDRESS_BOOK_H_
26
27 #include <vector>
28 #include <string>
29 #include <dpl/log/log.h>
30 #include <dpl/shared_ptr.h>
31 #include <Commons/EventReceiver.h>
32 #include "EventAddressBookGet.h"
33 #include "EventAddressBookAdd.h"
34 #include "EventAddressBookAddBatch.h"
35 #include "EventAddressBookUpdate.h"
36 #include "EventAddressBookUpdateBatch.h"
37 #include "EventAddressBookRemove.h"
38 #include "EventAddressBookRemoveBatch.h"
39 #include "EventAddressBookFind.h"
40 #include "EventAddressBookAddChangeListener.h"
41 #include "EventAddressBookRemoveChangeListener.h"
42 #include "IContactEventPrivateData.h"
43
44 namespace TizenApis {
45 namespace Api {
46 namespace Contact {
47
48 class IAddressBook;
49 typedef DPL::SharedPtr<IAddressBook> AddressBookPtr;
50
51 typedef std::vector<AddressBookPtr> AddressBookArray;
52 typedef DPL::SharedPtr<AddressBookArray> AddressBookArrayPtr;
53
54 class IAddressBook :
55         public WrtDeviceApis::Commons::EventRequestReceiver< EventAddressBookGet >,
56         public WrtDeviceApis::Commons::EventRequestReceiver< EventAddressBookAdd >,
57         public WrtDeviceApis::Commons::EventRequestReceiver< EventAddressBookAddBatch >,
58         public WrtDeviceApis::Commons::EventRequestReceiver< EventAddressBookUpdate >,
59         public WrtDeviceApis::Commons::EventRequestReceiver< EventAddressBookUpdateBatch >,
60         public WrtDeviceApis::Commons::EventRequestReceiver< EventAddressBookRemove >,
61         public WrtDeviceApis::Commons::EventRequestReceiver< EventAddressBookRemoveBatch >,
62         public WrtDeviceApis::Commons::EventRequestReceiver< EventAddressBookFind >,
63         public WrtDeviceApis::Commons::EventRequestReceiver< EventAddressBookAddChangeListener >,
64         public WrtDeviceApis::Commons::EventRequestReceiver< EventAddressBookRemoveChangeListener >,
65         public IContactEventPrivateData
66 {
67 public:
68         typedef enum
69         {
70             SIMBook,
71             PhoneBook
72         } AddressBookType;
73
74         explicit IAddressBook(AddressBookType type);
75         virtual ~IAddressBook();
76
77         virtual void get(const EventAddressBookGetPtr &event);
78         virtual void add(const EventAddressBookAddPtr &event);
79         virtual void addBatch(const EventAddressBookAddBatchPtr &event);
80         virtual void update(const EventAddressBookUpdatePtr &event);
81         virtual void updateBatch(const EventAddressBookUpdateBatchPtr &event);
82         virtual void remove(const EventAddressBookRemovePtr &event);
83         virtual void removeBatch(const EventAddressBookRemoveBatchPtr &event);
84         virtual void find(const EventAddressBookFindPtr &event);
85         virtual void addChangeListener(const EventAddressBookAddChangeListenerPtr &event);
86         virtual void removeChangeListener(const EventAddressBookRemoveChangeListenerPtr &event);
87
88         virtual AddressBookType    getType() const;
89         virtual std::string getId() const = 0;
90         virtual void        setId(const std::string &value) = 0;
91         virtual std::string getName() const = 0;
92         virtual void        setName(const std::string &value) = 0;
93         virtual bool        getReadOnly() const = 0;
94         virtual void        setReadOnly(const bool &value) = 0;
95
96 protected:
97         AddressBookType m_bookType;
98
99         virtual void    OnRequestReceived(const EventAddressBookGetPtr &event) = 0;
100         virtual void    OnRequestReceived(const EventAddressBookAddPtr &event) = 0;
101         virtual void    OnRequestReceived(const EventAddressBookAddBatchPtr &event) = 0;
102         virtual void    OnRequestReceived(const EventAddressBookUpdatePtr &event) = 0;
103         virtual void    OnRequestReceived(const EventAddressBookUpdateBatchPtr &event) = 0;
104         virtual void    OnRequestReceived(const EventAddressBookRemovePtr &event) = 0;
105         virtual void    OnRequestReceived(const EventAddressBookRemoveBatchPtr &event) = 0;
106         virtual void    OnRequestReceived(const EventAddressBookFindPtr &event) = 0;
107         virtual void    OnRequestReceived(const EventAddressBookAddChangeListenerPtr &event) = 0;
108         virtual void    OnRequestReceived(const EventAddressBookRemoveChangeListenerPtr &event) = 0;
109 };
110
111 } // Contact
112 } // Api
113 } // TizenApis
114
115 #endif // _API_CONTACT_IADDRESS_BOOK_H_