Tizen 2.1 base
[platform/core/pim/contacts-service.git] / common / ctsvc_record.h
1 /*\r
2  * Contacts Service\r
3  *\r
4  * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
5  *\r
6  * Contact: Dohyung Jin <dh.jin@samsung.com>\r
7  *                 Jongwon Lee <gogosing.lee@samsung.com>\r
8  *                 Donghee Ye <donghee.ye@samsung.com>\r
9  *\r
10  * Licensed under the Apache License, Version 2.0 (the "License");\r
11  * you may not use this file except in compliance with the License.\r
12  * You may obtain a copy of the License at\r
13  *\r
14  * http://www.apache.org/licenses/LICENSE-2.0\r
15  *\r
16  * Unless required by applicable law or agreed to in writing, software\r
17  * distributed under the License is distributed on an "AS IS" BASIS,\r
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
19  * See the License for the specific language governing permissions and\r
20  * limitations under the License.\r
21  *\r
22  */\r
23 \r
24 #ifndef __TIZEN_SOCIAL_CTSVC_RECORD_H__\r
25 #define __TIZEN_SOCIAL_CTSVC_RECORD_H__\r
26 \r
27 #define CTSVC_RECORD_INIT_BASE(base, type, cb, uri) do {\\r
28     (base)->r_type = (type);\\r
29     (base)->plugin_cbs = (cb);\\r
30     (base)->view_uri = (uri);\\r
31     (base)->property_max_count = 0;\\r
32 } while (0)\r
33 \r
34 #define CTSVC_RECORD_COPY_BASE(dest, src) do {\\r
35     (dest)->r_type = (src)->r_type;\\r
36     (dest)->plugin_cbs = (src)->plugin_cbs;\\r
37     (dest)->view_uri = (src)->view_uri;\\r
38     (dest)->property_max_count = (src)->property_max_count;\\r
39     if ((src)->properties_flags) \\r
40     {\\r
41         (dest)->properties_flags  = calloc((dest)->property_max_count, sizeof(char));\\r
42                 memcpy((dest)->properties_flags,(src)->properties_flags,sizeof(char)*(dest)->property_max_count);\\r
43     }\\r
44 } while (0)\r
45 \r
46 int ctsvc_record_set_projection_flags( contacts_record_h record, const unsigned int *projection, const unsigned int projection_count, const unsigned int property_max_count);\r
47 int ctsvc_record_set_str( contacts_record_h record, unsigned int property_id, const char* value );\r
48 int ctsvc_record_set_bool( contacts_record_h record, unsigned int property_id, bool value );\r
49 int ctsvc_record_set_int( contacts_record_h record, unsigned int property_id, int value );\r
50 int ctsvc_record_set_lli( contacts_record_h record, unsigned int property_id, long long int value );\r
51 int ctsvc_record_set_double( contacts_record_h record, unsigned int property_id, double value );\r
52 \r
53 #endif /* __TIZEN_SOCIAL_CTSVC_RECORD_H__ */\r