2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file ContactManager.h
24 #ifndef _PLATFORM_CONTACT_CONTACT_WRAPPER_H_
25 #define _PLATFORM_CONTACT_CONTACT_WRAPPER_H_
29 #include <contacts-svc.h>
30 #include <API/Contact/IContact.h>
31 #include <API/Contact/IAddressBook.h>
40 explicit ContactWrapper(TizenApis::Api::Contact::IAddressBook::AddressBookType type);
41 virtual ~ContactWrapper();
43 TizenApis::Api::Contact::ContactPtr getAbstractContact() const;
44 void setAbstractContact(const TizenApis::Api::Contact::ContactPtr &contact, bool isConvertingVCard);
46 CTSstruct* getPlatformContact() const;
47 //WARNING: calling this function will cause to store pointer inside private field
48 //Structure will be freed by this class when is not needed anymore.
49 //User should not modify nor free passed pointer.
50 void setPlatformContact(CTSstruct* contact, bool isConvertingVCard);
52 bool convertAbstractToPlatform(const TizenApis::Api::Contact::ContactPtr &abstract, CTSstruct* platform, bool isConvertingVCard);
53 bool convertPlatformToAbstract(CTSstruct* platform, TizenApis::Api::Contact::ContactPtr &abstract, bool isConvertingVCard);
56 bool convertToPlatformObject(bool isConvertingVCard);
57 bool convertToAbstractObject(bool isConvertingVCard);
59 TizenApis::Api::Contact::ContactPtr m_abstractContact;
60 CTSstruct* m_platformContact;
61 bool m_platformContactOwnership;
64 void freePlatformObject();
65 void freeAbstractObject();
67 bool convertToPlatformBaseData();
68 bool convertToPlatformAddressObject();
69 bool convertToPlatformEmailObject();
70 bool convertToPlatformPhoneObject();
71 bool convertToPlatformNicknameObject();
72 bool convertToPlatformPhoneticnameObject();
73 bool convertToPlatformGroupObject();
74 bool convertToPlatformUrlObject();
75 bool convertToPlatformOrganizationObject();
76 bool convertToPlatformAnniversaryObject();
77 bool convertToPlatformbirthdayObject();
79 bool convertToAbstractBaseData();
80 bool convertToAbstractAddressObject();
81 bool convertToAbstractEmailObject();
82 bool convertToAbstractPhoneObject();
83 bool convertToAbstractNicknameObject();
84 bool convertToAbstractPhoneticnameObject();
85 bool convertToAbstractGroupObject();
86 bool convertToAbstractUrlObject();
87 bool convertToAbstractOrganizationObject();
88 bool convertToAbstractAnniversaryObject();
89 bool convertToAbstractBirthdayObject();
91 int getCustomTypeInContactsSvc(const std::string &typeName) const;
92 //for debug purpose only
93 void printPlatformObject();
94 //for debug purpose only
95 void printAbstractObject();
97 std::string convertUriToPath(std::string str) const;
98 std::string convertPathToUri(std::string str) const;
101 typedef DPL::SharedPtr<ContactWrapper> ContactWrapperPtr;
107 #endif // _PLATFORM_CONTACT_CONTACT_WRAPPER_H_