|
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_CAreaSearchResult.h" |
|
25 |
|
26 //CONSTANTS |
|
27 const TInt KMaxFieldLength = 80; |
|
28 |
|
29 // C++ Constructor |
|
30 CAreaSearchResult::CAreaSearchResult() |
|
31 { |
|
32 } |
|
33 |
|
34 CAreaSearchResult* CAreaSearchResult::NewL(const TDesC& aDes) |
|
35 { |
|
36 CAreaSearchResult* self = new(ELeave) CAreaSearchResult; |
|
37 CleanupStack::PushL(self); |
|
38 self->ConstructL(aDes); |
|
39 CleanupStack::Pop(); |
|
40 return self; |
|
41 } |
|
42 |
|
43 // C++ destructor |
|
44 CAreaSearchResult::~CAreaSearchResult() |
|
45 { |
|
46 |
|
47 } |
|
48 |
|
49 void CAreaSearchResult::ConstructL(const TDesC& aDes) |
|
50 { |
|
51 TLex line(aDes); |
|
52 line.Mark(); |
|
53 TInt redefined=0; |
|
54 |
|
55 if (line.Peek() != '#' && line.Peek() != '\t') |
|
56 { |
|
57 TInt index=0; |
|
58 while (line.Peek() != '\n' && !(line.Peek()).Eos()) |
|
59 { |
|
60 line.Inc(); |
|
61 if (line.Peek() == '\t') |
|
62 { |
|
63 TPtrC token = line.MarkedToken(); |
|
64 TLex val(token); |
|
65 switch(index) |
|
66 { |
|
67 case ESouthLat: |
|
68 val.Val(iSouthLat, TChar(',')); |
|
69 break; |
|
70 case ENorthLat: |
|
71 val.Val(iNorthLat, TChar(',')); |
|
72 break; |
|
73 case EWestLong: |
|
74 val.Val(iWestLong, TChar(',')); |
|
75 break; |
|
76 case EEastLong: |
|
77 val.Val(iEastLong, TChar(',')); |
|
78 break; |
|
79 case EErrorCode: |
|
80 val.Val(iErrorCode); |
|
81 break; |
|
82 case ESearchResult: |
|
83 ParseSearchResult(token); |
|
84 break; |
|
85 case ERedefined: |
|
86 val.Val(redefined); |
|
87 if (redefined == 1) |
|
88 { |
|
89 iRedefined = ETrue; |
|
90 } |
|
91 break; |
|
92 } |
|
93 line.Inc(); |
|
94 while (line.Peek() == '\t') // Empty value |
|
95 { |
|
96 line.Inc(); |
|
97 ++index; |
|
98 } |
|
99 line.Mark(); |
|
100 ++index; |
|
101 } |
|
102 } |
|
103 } |
|
104 |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------- |
|
108 // CAreaSearchResult::SouthLat |
|
109 // |
|
110 // (other items were commented in a header). |
|
111 // --------------------------------------------------------- |
|
112 // |
|
113 TReal64 CAreaSearchResult::SouthLat() const |
|
114 { |
|
115 return iSouthLat; |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------- |
|
119 // CAreaSearchResult::NortLat() |
|
120 // |
|
121 // (other items were commented in a header). |
|
122 // --------------------------------------------------------- |
|
123 // |
|
124 TReal64 CAreaSearchResult::NorthLat() const |
|
125 { |
|
126 return iNorthLat; |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------- |
|
130 // CAreaSearchResult::WestLong() |
|
131 // |
|
132 // (other items were commented in a header). |
|
133 // --------------------------------------------------------- |
|
134 // |
|
135 TReal64 CAreaSearchResult::WestLong() const |
|
136 { |
|
137 return iWestLong; |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------- |
|
141 // CAreaSearchResult::EastLong() |
|
142 // |
|
143 // (other items were commented in a header). |
|
144 // --------------------------------------------------------- |
|
145 // |
|
146 TReal64 CAreaSearchResult::EastLong() const |
|
147 { |
|
148 return iEastLong; |
|
149 } |
|
150 |
|
151 // --------------------------------------------------------- |
|
152 // CAreaSearchResult::ErrorCode() |
|
153 // |
|
154 // (other items were commented in a header). |
|
155 // --------------------------------------------------------- |
|
156 // |
|
157 TInt CAreaSearchResult::ErrorCode() const |
|
158 { |
|
159 return iErrorCode; |
|
160 } |
|
161 |
|
162 // --------------------------------------------------------- |
|
163 // CAreaSearchResult::Print() |
|
164 // |
|
165 // (other items were commented in a header). |
|
166 // --------------------------------------------------------- |
|
167 // |
|
168 void CAreaSearchResult::Print(TDes& aPrint) |
|
169 { |
|
170 |
|
171 |
|
172 TChar del(','); |
|
173 |
|
174 TBuf<KMaxFieldLength> info; |
|
175 _LIT(KPosInfo, "SouthLat=%g, NortLat=%g, WestLong=%g, EastLong=%g"); |
|
176 |
|
177 info.Format(KPosInfo, iSouthLat, iNorthLat, iWestLong, iEastLong); |
|
178 aPrint.Append(info); |
|
179 aPrint.Append(del); |
|
180 |
|
181 _LIT(KRedefined, "Redefined=%d"); |
|
182 info.Format(KRedefined, iRedefined); |
|
183 aPrint.Append(info); |
|
184 aPrint.Append(del); |
|
185 |
|
186 _LIT(KErrorCode, "ErrorCode = %d"); |
|
187 info.Format(KErrorCode, iErrorCode); |
|
188 aPrint.Append(info); |
|
189 aPrint.Append(del); |
|
190 |
|
191 aPrint.Append(_L("Search result = ")); |
|
192 |
|
193 for (TInt i=0; i<iSearchResult.Count(); i++) |
|
194 { |
|
195 _LIT(KSearchResult, "%d"); |
|
196 info.Format(KSearchResult, iSearchResult[i]); |
|
197 aPrint.Append(info); |
|
198 aPrint.Append(del); |
|
199 } |
|
200 |
|
201 |
|
202 } |
|
203 |
|
204 |
|
205 // End of File |