fixed DCM-1707
[framework/osp/social.git] / src / inc / FScl_ContactImpl.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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                FScl_ContactImpl.h
18  * @brief               This is the header file for the _ContactImpl class.
19  *
20  * This header file contains the declarations of the _ContactImpl class.
21  */
22 #ifndef _FSCL_INTERNAL_CONTACT_IMPL_H_
23 #define _FSCL_INTERNAL_CONTACT_IMPL_H_
24
25 #include <contacts.h>
26 #include <unique_ptr.h>
27 #include <FBaseResult.h>
28 #include <FBaseObject.h>
29 #include <FBaseString.h>
30 #include <FBaseColAllElementsDeleter.h>
31 #include <FSclTypes.h>
32
33 namespace Tizen { namespace Base
34 {
35 class DateTime;
36
37 namespace Collection
38 {
39 class IList;
40 }
41
42 }}
43
44 namespace Tizen { namespace Graphics
45 {
46 class Bitmap;
47 }}
48
49 namespace Tizen { namespace Social
50 {
51 class Contact;
52 class Address;
53 class PhoneNumber;
54 class Email;
55 class Url;
56 class ImAddress;
57 class Organization;
58 class ContactEvent;
59 class Relationship;
60
61 /**
62  * @class       _ContactImpl
63  * @brief       This class provides a contact.
64  * @since       2.0
65  * @see Contact
66  *
67  */
68 class _ContactImpl
69         : public Tizen::Base::Object
70 {
71 public:
72         /**
73          * This is the default constructor of the class
74          *
75          * @since       2.0
76          */
77         _ContactImpl(void);
78
79         /**
80          * Copying of objects using this copy constructor is allowed.
81          *
82          * @since       2.0
83          */
84         _ContactImpl(const _ContactImpl& rhs);
85
86         /**
87          * This destructor overrides Tizen::Base::Object::~Object().
88          *
89          * @since       2.0
90          */
91         virtual ~_ContactImpl(void);
92
93         void SetContactRecordHandle(contacts_record_h contactHandle);
94
95         _OSP_EXPORT_ contacts_record_h GetContactRecordHandle(void) const;
96
97         result SetThumbnailPath(const Tizen::Base::String& filePath);
98
99         Tizen::Base::String GetThumbnailPath(void) const;
100
101         Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
102
103         result GetValue(const ContactPropertyId id, Tizen::Base::String& value) const;
104
105         result GetValue(const ContactPropertyId id, Tizen::Base::DateTime& value) const;
106
107         result SetValue(ContactPropertyId id, const Tizen::Base::String& value);
108
109         result SetValue(ContactPropertyId id, const Tizen::Base::DateTime& value);
110
111         result AddPhoneNumber(const Tizen::Social::PhoneNumber& phoneNumber);
112
113         result AddNickname(const Tizen::Base::String& nickname);
114
115         result AddNote(const Tizen::Base::String& note);
116
117         result AddEmail(const Tizen::Social::Email& email);
118
119         result AddUrl(const Tizen::Social::Url& url);
120
121         result AddAddress(const Tizen::Social::Address& address);
122
123         result AddImAddress(const Tizen::Social::ImAddress& imAddress);
124
125         result AddEvent(const ContactEvent& event);
126
127         result AddOrganization(const Organization& organization);
128
129         result AddRelationship(const Relationship& relationship);
130
131         result RemoveAt(ContactMultiPropertyId id, int index);
132
133         Tizen::Base::Collection::IList* GetValuesN(const ContactMultiPropertyId id);
134
135         result SetNoteAt(int index, const Tizen::Base::String& note);
136
137         result SetNicknameAt(int index, const Tizen::Base::String& nickname);
138
139         result SetEmailAt(int index, const Tizen::Social::Email& email);
140
141         result SetPhoneNumberAt(int index, const Tizen::Social::PhoneNumber& phoneNumber);
142
143         result SetUrlAt(int index, const Tizen::Social::Url& url);
144
145         result SetAddressAt(int index, const Tizen::Social::Address& address);
146
147         result SetImAddressAt(int index, const Tizen::Social::ImAddress& imAddress);
148
149         result SetRelationshipAt(int index, const Tizen::Social::Relationship& relationship);
150
151         result SetEventAt(int index, const Tizen::Social::ContactEvent& event);
152
153         result SetOrganizationAt(int index, const Tizen::Social::Organization& organization);
154
155         bool IsEmpty(void) const;
156
157         AddressbookId GetAddressbookId(void) const;
158
159         PersonId GetPersonId(void) const;
160
161         void SetAsRemoved(void);
162
163         bool IsRemoved(void) const;
164
165         result Invalidate(void);
166
167         bool IsFavorite(void) const;
168
169         void SetAsFavorite(bool isFavorite = true);
170
171         PhoneNumberType GetNativePhoneNumberType(int coreType) const;
172
173         _OSP_EXPORT_ static const _ContactImpl* GetInstance(const Contact& contact);
174
175         _OSP_EXPORT_ static _ContactImpl* GetInstance(Contact& contact);
176
177         /**
178          * Copying of objects using this copy assignment operator is allowed.
179          *
180          * @since       2.0
181          */
182         _ContactImpl& operator =(const _ContactImpl& rhs);
183
184 private:
185         bool IsEmptyName(contacts_record_h nameHandle);
186         bool IsEmptyCompany(contacts_record_h companyHandle);
187         int GetMaxLength(ContactPropertyId id);
188
189         Tizen::Base::Collection::IList* GetPhoneNumbersN(void) const;
190         Tizen::Base::Collection::IList* GetEmailsN(void) const;
191         Tizen::Base::Collection::IList* GetUrlsN(void) const;
192         Tizen::Base::Collection::IList* GetAddressesN(void) const;
193         Tizen::Base::Collection::IList* GetImAddressesN(void) const;
194         Tizen::Base::Collection::IList* GetOrganizationsN(void) const;
195         Tizen::Base::Collection::IList* GetRelationshipsN(void) const;
196         Tizen::Base::Collection::IList* GetEventsN(void) const;
197         Tizen::Base::Collection::IList* GetNotesN(void) const;
198         Tizen::Base::Collection::IList* GetNicknamesN(void) const;
199
200 private:
201         contacts_record_h __contactHandle;
202         bool __isRemoved;
203
204 }; // _ContactImpl
205
206 }} // Tizen::Social
207
208 #endif //_FSCL_INTERNAL_CONTACT_IMPL_H_