|
1 /* |
|
2 * Copyright (c) 2005 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: |
|
15 * ?description_line |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDES |
|
21 #include <e32math.h> |
|
22 #include <e32svr.h> |
|
23 #include <e32std.h> |
|
24 #include "FT_CSearchResultBase.h" |
|
25 |
|
26 //CONSTANTS |
|
27 |
|
28 // C++ Constructor |
|
29 CSearchResultBase::CSearchResultBase() : |
|
30 iRedefined(EFalse) |
|
31 { |
|
32 |
|
33 } |
|
34 |
|
35 // C++ destructor |
|
36 CSearchResultBase::~CSearchResultBase() |
|
37 { |
|
38 iSearchResult.Close(); |
|
39 } |
|
40 |
|
41 |
|
42 // --------------------------------------------------------- |
|
43 // CSearchResultBase::ParseSearchResult() |
|
44 // |
|
45 // (other items were commented in a header). |
|
46 // --------------------------------------------------------- |
|
47 // |
|
48 void CSearchResultBase::ParseSearchResult(const TDesC& aDes) |
|
49 { |
|
50 TLex line(aDes); |
|
51 line.Mark(); |
|
52 TInt startValue=0; |
|
53 TInt endValue=0; |
|
54 |
|
55 while (!(line.Peek()).Eos()) |
|
56 { |
|
57 line.Inc(); |
|
58 |
|
59 if (line.Peek() == ',' || line.Peek() == '-' || (line.Peek()).Eos()) |
|
60 { |
|
61 TPtrC token = line.MarkedToken(); |
|
62 TLex val(token); |
|
63 val.Val(startValue); |
|
64 iSearchResult.Append(startValue); |
|
65 if (line.Peek() == '-') |
|
66 { |
|
67 line.Inc(); |
|
68 line.Mark(); |
|
69 while (line.Peek() != ',' && !(line.Peek()).Eos()) |
|
70 { |
|
71 line.Inc(); |
|
72 } |
|
73 TPtrC endToken = line.MarkedToken(); |
|
74 TLex endVal(endToken); |
|
75 endVal.Val(endValue); |
|
76 for (TInt i=startValue+1; i<=endValue; i++) |
|
77 { |
|
78 iSearchResult.Append(i); |
|
79 } |
|
80 } |
|
81 if (line.Peek() == ',') |
|
82 { |
|
83 line.Inc(); |
|
84 line.Mark(); |
|
85 } |
|
86 } |
|
87 } |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------- |
|
91 // CSearchResultBase::ParseAttribute() |
|
92 // |
|
93 // (other items were commented in a header). |
|
94 // --------------------------------------------------------- |
|
95 // |
|
96 void CSearchResultBase::ParseAttributesL(const TDesC& aDes) |
|
97 { |
|
98 TLex line(aDes); |
|
99 line.Inc(); |
|
100 line.Inc(); |
|
101 User::LeaveIfError(line.Val(iAttributes, EHex)); |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------- |
|
105 // CSearchResultBase::Attributes |
|
106 // |
|
107 // (other items were commented in a header). |
|
108 // --------------------------------------------------------- |
|
109 // |
|
110 TUint CSearchResultBase::Attributes() const |
|
111 { |
|
112 return iAttributes; |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------- |
|
116 // CSearchResultBase::SearchResult |
|
117 // |
|
118 // (other items were commented in a header). |
|
119 // --------------------------------------------------------- |
|
120 // |
|
121 RArray<TPosLmItemId>& CSearchResultBase::SearchResult() |
|
122 { |
|
123 return iSearchResult; |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------- |
|
127 // CSearchResultBase::Redefined |
|
128 // |
|
129 // (other items were commented in a header). |
|
130 // --------------------------------------------------------- |
|
131 // |
|
132 TBool CSearchResultBase::Redefined() const |
|
133 { |
|
134 return iRedefined; |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------- |
|
138 // CSearchResultBase::FindSearchResult |
|
139 // |
|
140 // (other items were commented in a header). |
|
141 // --------------------------------------------------------- |
|
142 // |
|
143 TBool CSearchResultBase::FindSearchResult(const TPosLmItemId aId) |
|
144 { |
|
145 for (TInt i=0; i<iSearchResult.Count(); i++) |
|
146 { |
|
147 if (iSearchResult[i] == aId) |
|
148 { |
|
149 return ETrue; |
|
150 } |
|
151 } |
|
152 return EFalse; |
|
153 } |
|
154 |
|
155 // End of File |