summaryrefslogtreecommitdiff
path: root/src/platform/API/Contact/IAddressBook.h
blob: 7eb72d24c62660bd0542154a37a28178878aee70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
 *
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file        IAddressBook.h
 * @author      Kisub Song (kisubs.song@samsung.com)
 * @version     0.1
 * @brief
 */

#ifndef _API_CONTACT_IADDRESS_BOOK_H_
#define _API_CONTACT_IADDRESS_BOOK_H_

#include <vector>
#include <string>
#include <dpl/log.h>
#include <dpl/shared_ptr.h>
#include <Commons/EventReceiver.h>
#include "EventAddressBookAddBatch.h"
#include "EventAddressBookUpdateBatch.h"
#include "EventAddressBookRemoveBatch.h"
#include "EventAddressBookFind.h"
#include "EventAddressBookChangeListener.h"
#include "IContactEventPrivateData.h"

namespace TizenApis {
namespace Api {
namespace Contact {

class IAddressBook;
typedef DPL::SharedPtr<IAddressBook> IAddressBookPtr;

typedef std::vector<IAddressBookPtr> IAddressBookArray;
typedef DPL::SharedPtr<IAddressBookArray> IAddressBookArrayPtr;

class IAddressBook :
	public WrtDeviceApis::Commons::EventRequestReceiver< EventAddressBookAddBatch >,
	public WrtDeviceApis::Commons::EventRequestReceiver< EventAddressBookUpdateBatch >,
	public WrtDeviceApis::Commons::EventRequestReceiver< EventAddressBookRemoveBatch >,
	public WrtDeviceApis::Commons::EventRequestReceiver< EventAddressBookFind >,
	public IContactEventPrivateData
{
public:
	typedef enum
	{
	    SIMBook,
	    PhoneBook
	} AddressBookType;

	virtual ~IAddressBook();
	explicit IAddressBook(AddressBookType type);

	virtual ContactPropertiesPtr convertFromString(const std::string &vCardStr, const std::string &format) = 0;
	virtual std::string convertToString(const ContactPtr &contact, const std::string &format) = 0;
	virtual ContactPtr add(const ContactPropertiesPtr &contactProperty) = 0;
	virtual void addBatch(const EventAddressBookAddBatchPtr &event);
	virtual void update(const ContactPtr &contact) = 0;
	virtual void updateBatch(const EventAddressBookUpdateBatchPtr &event);
	virtual void remove(const std::string &id) = 0;
	virtual void removeBatch(const EventAddressBookRemoveBatchPtr &event);
	virtual void find(const EventAddressBookFindPtr &event);

	virtual long addChangeListener(const EventAddressBookChangeListenerEmitterPtr &emitter) = 0;
	virtual void removeChangeListener(const long watchId) = 0;

	virtual AddressBookType    getType() const;
	virtual std::string getName() const = 0;
	virtual void        setName(const std::string &value) = 0;

protected:
	AddressBookType m_bookType;

	virtual void    OnRequestReceived(const EventAddressBookAddBatchPtr &event) = 0;
	virtual void    OnRequestReceived(const EventAddressBookUpdateBatchPtr &event) = 0;
	virtual void    OnRequestReceived(const EventAddressBookRemoveBatchPtr &event) = 0;
	virtual void    OnRequestReceived(const EventAddressBookFindPtr &event) = 0;
};

} // Contact
} // Api
} // TizenApis

#endif // _API_CONTACT_IADDRESS_BOOK_H_