|
1 /* |
|
2 * Copyright (c) 2008-2008 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: Parser class for parsing landmarks to url and vice versa |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CESMRURLPARSERPLUGINIMPL_H |
|
19 #define CESMRURLPARSERPLUGINIMPL_H |
|
20 |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <e32base.h> |
|
24 #include <f32file.h> // RFs |
|
25 #include <barsc.h> // RResourceFile |
|
26 #include <barsread.h> // TResourceReader |
|
27 |
|
28 #include "cesmrurlparserplugin.h" |
|
29 |
|
30 class CPosLandmark; |
|
31 |
|
32 |
|
33 /** |
|
34 * Parser class for parsing URL to landmark and vice versa |
|
35 * |
|
36 */ |
|
37 class CESMRUrlParserPluginImpl : public CESMRUrlParserPlugin |
|
38 { |
|
39 |
|
40 public: |
|
41 |
|
42 static CESMRUrlParserPluginImpl* NewL(); |
|
43 static CESMRUrlParserPluginImpl* NewLC(); |
|
44 |
|
45 |
|
46 /** |
|
47 * Destructor. |
|
48 */ |
|
49 virtual ~CESMRUrlParserPluginImpl(); |
|
50 |
|
51 /** |
|
52 * Finds location URL from given text input |
|
53 * |
|
54 * @param aText text where URL is searched from |
|
55 * @param aUrl points to founded URL after execution |
|
56 * @return URL start position in aText, |
|
57 * if not found returns KErrNotFound/KErrArgument or other |
|
58 * unexpected Symbian wide errorcode |
|
59 */ |
|
60 TInt FindLocationUrl( const TDesC& aText, TPtrC& aUrl ); |
|
61 |
|
62 /** |
|
63 * Creates location URL from landmark object |
|
64 * May leave with KErrNotFound/KErrArgument or other Symbian wide errorcode |
|
65 * |
|
66 * @param aLandmark contains landmark object that is parsed to location URL |
|
67 * @return pointer to created location URL, caller takes ownership |
|
68 */ |
|
69 HBufC* CreateUrlFromLandmarkL( const CPosLandmark& aLandmark ); |
|
70 |
|
71 /** |
|
72 * Creates landmark object from location URL |
|
73 * May leave with KErrNotFound/KErrArgument or other Symbian wide errorcode |
|
74 * |
|
75 * @param aUrl contains location URL from which landmark is created |
|
76 * @return pointer to created landmark object, caller takes ownership |
|
77 */ |
|
78 CPosLandmark* CreateLandmarkFromUrlL( const TDesC& aUrl ); |
|
79 |
|
80 private: |
|
81 |
|
82 CESMRUrlParserPluginImpl(); |
|
83 |
|
84 void ConstructL(); |
|
85 |
|
86 TInt DoFindLocationUrlL( const TDesC& aText, |
|
87 TPtrC& aUrl ); |
|
88 |
|
89 TInt LocateResourceFile( |
|
90 const TDesC& aResource, |
|
91 const TDesC& aPath, |
|
92 TFileName &aResourceFile, |
|
93 RFs* aFs ); |
|
94 |
|
95 void InitializeL(); |
|
96 |
|
97 HBufC* ReadResourceStringLC( TInt aResourceId ); |
|
98 |
|
99 void CheckCoordinateParamL( const TDesC& aParam ); |
|
100 |
|
101 void GetCoordinateParamValuesL( const TDesC& aUrl, TPtrC& aLatitude, |
|
102 TPtrC& aLongitude ); |
|
103 private: // data |
|
104 |
|
105 /** |
|
106 * Tells if this instance is yet initialized |
|
107 */ |
|
108 TBool iIsInitialized; |
|
109 |
|
110 /** |
|
111 * File server session |
|
112 */ |
|
113 RFs iFs; |
|
114 |
|
115 /** |
|
116 * Resource file |
|
117 */ |
|
118 RResourceFile iFile; |
|
119 |
|
120 /** |
|
121 * Resource file reader |
|
122 */ |
|
123 TResourceReader iReader; |
|
124 }; |
|
125 |
|
126 |
|
127 #endif // CESMRURLPARSERPLUGINIMPL_H |