|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "mdeorderrule.h" |
|
20 #include "mdepanic.h" |
|
21 #include "mdepropertydef.h" |
|
22 #include "mdcserializationbuffer.h" |
|
23 #include "mdcquery.h" |
|
24 |
|
25 |
|
26 EXPORT_C TMdEOrderRule::TMdEOrderRule(TOrderRuleType aType, TBool aAscending) |
|
27 : iType(aType), |
|
28 iAscending(aAscending), |
|
29 iCaseSensitive(ETrue) |
|
30 { |
|
31 } |
|
32 |
|
33 |
|
34 EXPORT_C TMdEOrderRule::TMdEOrderRule(const CMdEPropertyDef& aPropertyDef, TBool aAscending) |
|
35 : iType(EOrderRuleTypeProperty), iPropertyDef(&aPropertyDef), |
|
36 iAscending(aAscending), iCaseSensitive(ETrue) |
|
37 { |
|
38 } |
|
39 |
|
40 |
|
41 EXPORT_C TOrderRuleType TMdEOrderRule::Type() const |
|
42 { |
|
43 return iType; |
|
44 } |
|
45 |
|
46 |
|
47 EXPORT_C void TMdEOrderRule::SetType(TOrderRuleType aType) |
|
48 { |
|
49 iType = aType; |
|
50 } |
|
51 |
|
52 |
|
53 EXPORT_C TBool TMdEOrderRule::Ascending() const |
|
54 { |
|
55 return iAscending; |
|
56 } |
|
57 |
|
58 |
|
59 EXPORT_C void TMdEOrderRule::SetAscending(TBool aAscending) |
|
60 { |
|
61 iAscending = aAscending; |
|
62 } |
|
63 |
|
64 |
|
65 EXPORT_C const CMdEPropertyDef* TMdEOrderRule::PropertyDef() const |
|
66 { |
|
67 return iPropertyDef; |
|
68 } |
|
69 |
|
70 |
|
71 EXPORT_C void TMdEOrderRule::SetPropertyDef(const CMdEPropertyDef& aPropertyDef) |
|
72 { |
|
73 iPropertyDef = &aPropertyDef; |
|
74 } |
|
75 |
|
76 EXPORT_C void TMdEOrderRule::SetCaseSensitive(TBool aCaseSensitive) |
|
77 { |
|
78 iCaseSensitive = aCaseSensitive; |
|
79 } |
|
80 |
|
81 EXPORT_C TBool TMdEOrderRule::CaseSensitive() |
|
82 { |
|
83 return iCaseSensitive; |
|
84 } |
|
85 |
|
86 TUint32 TMdEOrderRule::RequiredBufferSize() const |
|
87 { |
|
88 return sizeof( TMdCOrderRule ); |
|
89 } |
|
90 |
|
91 void TMdEOrderRule::SerializeL(CMdCSerializationBuffer& aBuffer, |
|
92 TMdCOffset& aFreespaceOffset) const |
|
93 { |
|
94 TMdCOrderRule rule; |
|
95 |
|
96 rule.iOrderRule = iType; |
|
97 rule.iAscending = iAscending; |
|
98 rule.iCaseSensitive = iCaseSensitive; |
|
99 |
|
100 // If it's property order insert property def ID |
|
101 if( EOrderRuleTypeProperty == iType ) |
|
102 { |
|
103 const TDefId propertyDefId = iPropertyDef->Id(); |
|
104 rule.iPropertyDefId = propertyDefId; |
|
105 } |
|
106 else |
|
107 { |
|
108 rule.iPropertyDefId = KNoDefId; |
|
109 } |
|
110 |
|
111 rule.SerializeL( aBuffer ); |
|
112 |
|
113 aFreespaceOffset = aBuffer.Position(); |
|
114 } |