tizen beta release
[framework/web/wrt-plugins-common.git] / src / modules / API / Contact / EventFindContacts.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  * @author      Lukasz Marek (l.marek@samsung.com)
18  * @version     0.1
19  * @brief
20  */
21
22 #ifndef WRTDEVICEAPIS_CONTACT_EVENT_FIND_CONTACT_H_
23 #define WRTDEVICEAPIS_CONTACT_EVENT_FIND_CONTACT_H_
24
25 #include <vector>
26 #include <dpl/shared_ptr.h>
27 #include <Commons/IEvent.h>
28 #include <Contact/ContactFilter.h>
29 #include <Contact/Contact.h>
30 #include <Contact/IContactEventPrivateData.h>
31
32 namespace WrtDeviceApis {
33 namespace Contact {
34 namespace Api {
35
36 /* Event sent while searching contacts */
37 class EventFindContacts : public Commons::IEvent<EventFindContacts>
38 {
39     bool m_result;
40     std::vector<ContactPtr> m_contacts;
41     ContactFilterPtr m_filter;
42     int m_startIndex;
43     int m_endIndex;
44     //this variable allows to use only one type per contact objects (check Contact object and contained subobjects)
45     //e.g. if contact has the same email as PREF and WORK, we can get 2 record with 1 type in each record, or singe record with 2 types within it.
46     bool m_useSingleTypes;
47
48     //this variable is not revelant to perform operation,
49     //but allows to store additional data to finish further operations in callback function.
50     IContactEventPrivateDataPtr m_privateData;
51   public:
52     void setContactEventPrivateData(const IContactEventPrivateDataPtr &value)
53     {
54         m_privateData = value;
55     }
56     IContactEventPrivateDataPtr getContactEventPrivateData() const
57     {
58         return m_privateData;
59     }
60     void setStartIndex(int value)
61     {
62         m_startIndex = value;
63     }
64     int getStartIndex() const
65     {
66         return m_startIndex;
67     }
68     void setEndIndex(int value)
69     {
70         m_endIndex = value;
71     }
72     int getEndIndex() const
73     {
74         return m_endIndex;
75     }
76     void setResult(bool value)
77     {
78         m_result = value;
79     }
80     bool getResult() const
81     {
82         return m_result;
83     }
84     void setUseSignleTypes(bool value)
85     {
86         m_useSingleTypes = value;
87     }
88     bool getUseSignleTypes() const
89     {
90         return m_useSingleTypes;
91     }
92     void setFilter(const ContactFilterPtr &filter)
93     {
94         m_filter = filter;
95     }
96     ContactFilterPtr getFilter() const
97     {
98         return m_filter;
99     }
100     void addContact(const ContactPtr &contact)
101     {
102         m_contacts.push_back(contact);
103     }
104     const std::vector<ContactPtr> &getContacts() const
105     {
106         return m_contacts;
107     }
108     void setContacts(const std::vector<ContactPtr> &value)
109     {
110         m_contacts = value;
111     }
112
113     EventFindContacts() : m_result(false),
114         m_filter(NULL),
115         m_startIndex(-1),
116         m_endIndex(-1),
117         m_useSingleTypes(true)
118     {
119     }
120     virtual ~EventFindContacts()
121     {
122     }
123     virtual void clearOnCancel()
124     {
125     }
126 };
127
128 typedef DPL::SharedPtr<EventFindContacts> EventFindContactsPtr;
129
130 }
131 } // Api
132 } // WrtDeviceApis
133
134 #endif // WRTDEVICEAPIS_CONTACT_EVENT_FIND_CONTACT_H_