Merge "Export internal APIs needed by samsung-socil" into tizen_2.1
[framework/osp/social.git] / src / FScl_CalendarbookFilterImpl.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_CalendarbookFilterImpl.h
18  * @brief               This is the header file for the %_CalendarbookFilterImpl class.
19  *
20  * This header file contains the declarations of the %_CalendarbookFilterImpl class.
21  */
22 #ifndef _FSCL_CALENDARBOOK_FILTER_IMPL_H_
23 #define _FSCL_CALENDARBOOK_FILTER_IMPL_H_
24
25 #include <calendar2.h>
26 #include <FBaseTypes.h>
27 #include <FSclTypes.h>
28 #include <FBaseObject.h>
29
30 namespace Tizen { namespace Base
31 {
32 class String;
33 class DateTime;
34 }}
35
36 namespace Tizen { namespace Social
37 {
38
39 class CalendarbookFilter;
40
41 enum __DataType
42 {
43         DATA_TYPE_NONE,
44         DATA_TYPE_INT,
45         DATA_TYPE_DOUBLE,
46         DATA_TYPE_BOOL,
47         DATA_TYPE_DATE_TIME,
48         DATA_TYPE_STRING,
49 };
50
51 class _OSP_EXPORT_ _CalendarbookFilterImpl
52            : public Tizen::Base::Object
53 {
54 public:
55         _CalendarbookFilterImpl(CalendarbookFilterType type);
56
57         virtual ~_CalendarbookFilterImpl(void);
58
59         virtual bool Equals(const Tizen::Base::Object& rhs) const;
60
61         virtual int GetHashCode(void) const;
62
63         calendar_filter_h GetFilterHandle(void) const;
64
65         CalendarbookFilterType GetType(void) const;
66
67         bool IsEmpty(void) const;
68
69         result AppendInt(FilterConjunctiveOperator conjunctiveOperator, unsigned long filterProperty, FilterComparisonOperator comparisonOperator, int value);
70
71         result AppendDouble(FilterConjunctiveOperator conjunctiveOperator, unsigned long filterProperty, FilterComparisonOperator comparisonOperator, double value);
72
73         result AppendBool(FilterConjunctiveOperator conjunctiveOperator, unsigned long filterProperty, FilterComparisonOperator comparisonOperator, bool value);
74
75         result AppendDateTime(FilterConjunctiveOperator conjunctiveOperator, unsigned long filterProperty, FilterComparisonOperator comparisonOperator, const Tizen::Base::DateTime& value);
76
77         result AppendString(FilterConjunctiveOperator conjunctiveOperator, unsigned long filterProperty, FilterStringOperator comparisonOperator, const Tizen::Base::String& value);
78
79         result AppendFilter(FilterConjunctiveOperator conjunctiveOperator, const _CalendarbookFilterImpl& filter);
80
81         static const char* GetUriFromType(CalendarbookFilterType type);
82
83         static __DataType GetPropertyType(CalendarbookFilterType type, unsigned long filterProperty);
84
85         static bool IsValidProperty(CalendarbookFilterType type, unsigned long filterProperty);
86
87         static unsigned int GetViewPropertyId(CalendarbookFilterType type, unsigned long filterProperty);
88
89         static const _CalendarbookFilterImpl* GetInstance(const CalendarbookFilter& filter);
90
91         static  _CalendarbookFilterImpl* GetInstance(CalendarbookFilter& filter);
92
93 public:
94         struct __FilterPropertyInfoEntry
95         {
96                 unsigned long propertyId;
97                 unsigned long viewPropertyId;
98                 __DataType dataType;
99         };
100
101         struct __FilterInfoEntry
102         {
103                 unsigned long filterType;
104                 const char* pViewUri;
105                 unsigned long baseIndex;
106                 unsigned long propertyInfoCount;
107                 const __FilterPropertyInfoEntry* propertyInfos;
108         };
109
110         static const __FilterPropertyInfoEntry __calendarFilterPropertyInfos[];
111         static const __FilterPropertyInfoEntry __eventFilterPropertyInfos[];
112         static const __FilterPropertyInfoEntry __todoFilterPropertyInfos[];
113         static const __FilterPropertyInfoEntry __allDayEventInstanceFilterPropertyInfos[];
114         static const __FilterPropertyInfoEntry __nonAllDayEventInstanceFilterPropertyInfos[];
115         static const __FilterInfoEntry __filterInfos[];
116
117 private:
118         // get match flag
119         static calendar_match_str_flag_e GetMatchStrFlag(FilterStringOperator stringOperstor);
120         static calendar_match_int_flag_e GetMatchIntFlag(FilterComparisonOperator comparisonOperator);
121
122         calendar_filter_h __filterHandle;
123         CalendarbookFilterType __filterType;
124         bool __isEmpty;
125 };         // _CalendarbookFilterImpl
126
127 }} // Tizen::Social
128
129 #endif // _FSCL_CALENDARBOOK_FILTER_IMPL_H_