4be7d952d6872e5fceda036ce36944fac7edba54
[platform/core/pim/calendar-service.git] / include / calendar_filter.h
1 /*
2  * Calendar Service
3  *
4  * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __TIZEN_SOCIAL_CALENDAR_FILTER_H__
21 #define __TIZEN_SOCIAL_CALENDAR_FILTER_H__
22
23 #include <calendar_types.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 /**
30  * @file calendar_filter.h
31  */
32
33 /**
34  * @addtogroup CAPI_SOCIAL_CALENDAR_SVC_FILTER_MODULE
35  * @{
36  */
37
38 /**
39  * @brief Creates a filter handle.
40  *
41  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
42  *
43  * @remarks You must release @a filter using calendar_filter_destroy().
44  *
45  * @param[in]   view_uri     The view URI of a filter
46  * @param[out]  filter       The filter handle
47  *
48  * @return  @c 0 on success,
49  *          otherwise a negative error value
50  * @retval  #CALENDAR_ERROR_NONE                Successful
51  * @retval  #CALENDAR_ERROR_INVALID_PARAMETER   Invalid parameter
52  * @retval  #CALENDAR_ERROR_OUT_OF_MEMORY       Out of memory
53  *
54  * @pre     calendar_connect() should be called to initialize.
55  *
56  * @see calendar_filter_destroy()
57  */
58 int calendar_filter_create(const char* view_uri, calendar_filter_h* filter);
59
60 /**
61  * @brief Destroys a filter handle.
62  *
63  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
64  *
65  * @param[in]   filter   The filter handle
66  *
67  * @return  @c 0 on success,
68  *          otherwise a negative error value
69  * @retval  #CALENDAR_ERROR_NONE                Successful
70  * @retval  #CALENDAR_ERROR_INVALID_PARAMETER   Invalid parameter
71  *
72  * @see calendar_filter_create()
73  */
74 int     calendar_filter_destroy(calendar_filter_h filter);
75
76 /**
77  * @brief Adds a condition for the string type property.
78  *
79  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
80  *
81  * @param[in]   filter          The filter handle
82  * @param[in]   property_id     The property ID to add a condition
83  * @param[in]   match           The match flag
84  * @param[in]   match_value     The match value
85  *
86  * @return  @c 0 on success,
87  *          otherwise a negative error value
88  * @retval  #CALENDAR_ERROR_NONE                Successful
89  * @retval  #CALENDAR_ERROR_INVALID_PARAMETER   Invalid parameter
90  *
91  * @see calendar_filter_add_operator()
92  */
93 int     calendar_filter_add_str(calendar_filter_h filter, unsigned int property_id, calendar_match_str_flag_e match, const char* match_value);
94
95 /**
96  * @brief Adds a condition for the integer type property.
97  *
98  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
99  *
100  * @param[in]   filter          The filter handle
101  * @param[in]   property_id     The property ID to add a condition
102  * @param[in]   match           The match flag
103  * @param[in]   match_value     The match value
104  *
105  * @return  @c 0 on success,
106  *          otherwise a negative error value
107  * @retval  #CALENDAR_ERROR_NONE                Successful
108  * @retval  #CALENDAR_ERROR_INVALID_PARAMETER   Invalid parameter
109  *
110  * @see calendar_filter_add_operator()
111  */
112 int     calendar_filter_add_int(calendar_filter_h filter, unsigned int property_id, calendar_match_int_flag_e match, int match_value);
113
114 /**
115  * @brief Adds a condition for the double type property.
116  *
117  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
118  *
119  * @param[in]   filter          The filter handle
120  * @param[in]   property_id     The property ID to add a condition
121  * @param[in]   match           The match flag
122  * @param[in]   match_value     The match value
123  *
124  * @return  @c 0 on success,
125  *          otherwise a negative error value
126  * @retval  #CALENDAR_ERROR_NONE                Successful
127  * @retval  #CALENDAR_ERROR_INVALID_PARAMETER   Invalid parameter
128  *
129  * @see calendar_filter_add_operator()
130  */
131 int     calendar_filter_add_double(calendar_filter_h filter, unsigned int property_id, calendar_match_int_flag_e match, double match_value);
132
133 /**
134  * @brief Adds a condition for the long long int type property.
135  *
136  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
137  *
138  * @param[in]   filter          The filter handle
139  * @param[in]   property_id     The property ID to add a condition
140  * @param[in]   match           The match flag
141  * @param[in]   match_value     The match value
142  *
143  * @return  @c 0 on success,
144  *          otherwise a negative error value
145  * @retval  #CALENDAR_ERROR_NONE                Successful
146  * @retval  #CALENDAR_ERROR_INVALID_PARAMETER   Invalid parameter
147  *
148  * @see calendar_filter_add_operator()
149  */
150 int     calendar_filter_add_lli(calendar_filter_h filter, unsigned int property_id, calendar_match_int_flag_e match, long long int match_value);
151
152 /**
153  * @brief Adds a condition for the calendar_time_s type property.
154  *
155  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
156  *
157  * @param[in]   filter          The filter handle
158  * @param[in]   property_id     The property ID to add a condition
159  * @param[in]   match           The match flag
160  * @param[in]   match_value     The match value
161  *
162  * @return  @c 0 on success,
163  *          otherwise a negative error value
164  * @retval  #CALENDAR_ERROR_NONE                Successful
165  * @retval  #CALENDAR_ERROR_INVALID_PARAMETER   Invalid parameter
166  *
167  * @see calendar_filter_add_operator()
168  */
169 int     calendar_filter_add_caltime(calendar_filter_h filter, unsigned int property_id, calendar_match_int_flag_e match, calendar_time_s match_value);
170
171 /**
172  * @brief Adds a child filter to a parent filter.
173  *
174  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
175  *
176  * @param[in]   parent_filter      The parent filter handle
177  * @param[in]   child_filter       The child filter handle
178  *
179  * @return  @c 0 on success,
180  *          otherwise a negative error value
181  * @retval  #CALENDAR_ERROR_NONE                Successful
182  * @retval  #CALENDAR_ERROR_INVALID_PARAMETER   Invalid parameter
183  *
184  * @see calendar_filter_add_operator()
185  */
186 int calendar_filter_add_filter(calendar_filter_h parent_filter, calendar_filter_h child_filter);
187
188 /**
189  * @brief Adds an operator between conditions.
190  *
191  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
192  *
193  * @param[in]   filter          The filter handle
194  * @param[in]   operator_type   The operator type
195  *
196  * @return  @c 0 on success,
197  *          otherwise a negative error value
198  * @retval  #CALENDAR_ERROR_NONE                Successful
199  * @retval  #CALENDAR_ERROR_INVALID_PARAMETER   Invalid parameter
200  *
201  * @see calendar_filter_add_str()
202  * @see calendar_filter_add_int()
203  * @see calendar_filter_add_double()
204  * @see calendar_filter_add_caltime()
205  * @see calendar_filter_add_filter()
206  */
207 int calendar_filter_add_operator(calendar_filter_h filter, calendar_filter_operator_e operator_type);
208
209 /**
210  * @}
211  */
212
213 #ifdef __cplusplus
214 }
215 #endif
216
217 #endif /* __TIZEN_SOCIAL_CALENDAR_FILTER_H__ */
218