Modify the spec file for secure log
[framework/osp/social.git] / src / FScl_AddressbookFilterImpl.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_AddressbookFilterImpl.h
18  * @brief               This is the header file for the %_AddressbookFilterImpl class.
19  *
20  * This header file contains the declarations of the %_AddressbookFilterImpl class.
21  */
22 #ifndef _FSCL_ADDRESSBOOK_FILTER_IMPL_H_
23 #define _FSCL_ADDRESSBOOK_FILTER_IMPL_H_
24
25 #include <contacts.h>
26 #include <FBaseTypes.h>
27 #include <FSclTypes.h>
28 #include <FBaseObject.h>
29
30 namespace Tizen { namespace Base
31 {
32 class String;
33 }}
34
35 namespace Tizen { namespace Social
36 {
37
38 class AddressbookFilter;
39
40 enum __DataType
41 {
42         DATA_TYPE_NONE,
43         DATA_TYPE_INT,
44         DATA_TYPE_BOOL,
45         DATA_TYPE_STRING,
46 };
47
48 class _OSP_EXPORT_ _AddressbookFilterImpl
49            : public Tizen::Base::Object
50 {
51 public:
52         _AddressbookFilterImpl(AddressbookFilterType type);
53
54         virtual ~_AddressbookFilterImpl(void);
55
56         virtual bool Equals(const Tizen::Base::Object& rhs) const;
57
58         virtual int GetHashCode(void) const;
59
60         contacts_filter_h GetFilterHandle(void) const;
61
62         AddressbookFilterType GetType(void) const;
63
64         bool IsEmpty(void) const;
65
66         result AppendInt(FilterConjunctiveOperator conjunctiveOperator, unsigned long filterProperty, FilterComparisonOperator comparisonOperator, int value);
67
68         result AppendBool(FilterConjunctiveOperator conjunctiveOperator, unsigned long filterProperty, FilterComparisonOperator comparisonOperator, bool value);
69
70         result AppendString(FilterConjunctiveOperator conjunctiveOperator, unsigned long filterProperty, FilterStringOperator comparisonOperator, const Tizen::Base::String& value);
71
72         result AppendFilter(FilterConjunctiveOperator conjunctiveOperator, const _AddressbookFilterImpl& filter);
73
74         static const char* GetUriFromType(AddressbookFilterType type);
75
76         static __DataType GetPropertyType(AddressbookFilterType type, unsigned long filterProperty);
77
78         static bool IsValidProperty(AddressbookFilterType type, unsigned long filterProperty);
79
80         static unsigned int GetViewPropertyId(AddressbookFilterType type, unsigned long filterProperty);
81
82         static const _AddressbookFilterImpl* GetInstance(const AddressbookFilter& filter);
83
84         static  _AddressbookFilterImpl* GetInstance(AddressbookFilter& filter);
85
86 public:
87         struct __FilterPropertyInfoEntry
88         {
89                 unsigned long propertyId;
90                 unsigned long viewPropertyId;
91                 __DataType dataType;
92         };
93
94         struct __FilterInfoEntry
95         {
96                 unsigned long filterType;
97                 const char* pViewUri;
98                 unsigned long baseIndex;
99                 unsigned long propertyInfoCount;
100                 const __FilterPropertyInfoEntry* propertyInfos;
101         };
102
103         static const __FilterPropertyInfoEntry __addressbookFilterPropertyInfos[];
104         static const __FilterPropertyInfoEntry __personFilterPropertyInfos[];
105         static const __FilterPropertyInfoEntry __contactFilterPropertyInfos[];
106         static const __FilterPropertyInfoEntry __categoryFilterPropertyInfos[];
107         static const __FilterPropertyInfoEntry __phoneContactFilterPropertyInfos[];
108         static const __FilterPropertyInfoEntry __emailContactFilterPropertyInfos[];
109         static const __FilterInfoEntry __filterInfos[];
110
111 private:
112         // get match flag
113         static contacts_match_str_flag_e GetMatchStrFlag(FilterStringOperator stringOperstor);
114         static contacts_match_int_flag_e GetMatchIntFlag(FilterComparisonOperator comparisonOperator);
115
116         contacts_filter_h __filterHandle;
117         AddressbookFilterType __filterType;
118         bool __isEmpty;
119 };         // _AddressbookFilterImpl
120
121 }} // Tizen::Social
122
123 #endif // _FSCL_ADDRESSBOOK_FILTER_IMPL_H_