955c0b01071637cd24c066e5b9e5eae16caff6fb
[framework/osp/social.git] / src / FSclAddressbookFilter.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18 * @file         FSclAddressbookFilter.cpp
19 * @brief        This is the implementation for AddressbookFilter class.
20 *
21 * This file contains definitions of @e AddressbookFilter class.
22 */
23
24 #include <FSclAddressbookFilter.h>
25 #include <FBaseSysLog.h>
26 #include "FScl_AddressbookFilterImpl.h"
27
28 using namespace Tizen::App;
29 using namespace Tizen::Base;
30
31 namespace Tizen { namespace Social
32 {
33 AddressbookFilter::AddressbookFilter(AddressbookFilterType type)
34 {
35         _AddressbookFilterImpl* pAddressbookFilterImpl = new (std::nothrow) _AddressbookFilterImpl(type);
36         SysTryReturnVoidResult(NID_SCL, pAddressbookFilterImpl, E_OUT_OF_MEMORY, "[%s ] Memory allocation failed.", GetErrorMessage(GetLastResult()));
37
38         __pAddressbookFilterImpl = pAddressbookFilterImpl;
39 }
40
41 AddressbookFilter::~AddressbookFilter(void)
42 {
43         delete __pAddressbookFilterImpl;
44 }
45
46 bool
47 AddressbookFilter::Equals(const Tizen::Base::Object& rhs) const
48 {
49         const AddressbookFilter* pAddressbookFilter = dynamic_cast<const AddressbookFilter*>(&rhs);
50         if (pAddressbookFilter == null)
51         {
52                 return false;
53         }
54
55         return __pAddressbookFilterImpl->Equals(*pAddressbookFilter->__pAddressbookFilterImpl);
56 }
57
58 int
59 AddressbookFilter::GetHashCode(void) const
60 {
61         return __pAddressbookFilterImpl->GetHashCode();
62 }
63
64 result
65 AddressbookFilter::AppendInt(FilterConjunctiveOperator conjunctiveOperator, unsigned long filterProperty, FilterComparisonOperator comparisonOperator, int value)
66 {
67         return __pAddressbookFilterImpl->AppendInt(conjunctiveOperator, filterProperty, comparisonOperator, value);
68 }
69
70 result
71 AddressbookFilter::AppendBool(FilterConjunctiveOperator conjunctiveOperator, unsigned long filterProperty, FilterComparisonOperator comparisonOperator, bool value)
72 {
73         return __pAddressbookFilterImpl->AppendBool(conjunctiveOperator, filterProperty, comparisonOperator, value);
74 }
75
76 result
77 AddressbookFilter::AppendString(FilterConjunctiveOperator conjunctiveOperator, unsigned long filterProperty, FilterStringOperator comparisonOperator, const Tizen::Base::String& value)
78 {
79         return __pAddressbookFilterImpl->AppendString(conjunctiveOperator, filterProperty, comparisonOperator, value);
80 }
81
82 result
83 AddressbookFilter::AppendFilter(FilterConjunctiveOperator conjunctiveOperator, const AddressbookFilter& filter)
84 {
85         return __pAddressbookFilterImpl->AppendFilter(conjunctiveOperator, *filter.__pAddressbookFilterImpl);;
86 }
87
88 }} // Tizen::Social