changed attributes of header files
[platform/core/location/maps-plugin-here.git] / inc / engine / routes / GeoRouterReplyParser.h
1 /*
2  * Copyright (C) 2013 HERE Global B.V. All rights reserved.
3  * This software, including documentation, is protected by copyright controlled by
4  * HERE Global B.V. (“Software”). All rights are reserved. Copying, including reproducing,
5  * storing, adapting or translating, any or all of this material requires the prior
6  * written consent of HERE Global B.V. You may use this
7  * Software in accordance with the terms and conditions defined in the
8  * HERE Location Platform Services Terms and Conditions, available at
9  * http://developer.here.com/terms-conditions-base
10  *
11  * As an additional permission to the above, you may distribute Software,
12  * in object code format as part of an Application, according to, and subject to, terms and
13  * conditions defined in the Tizen Software Development kit (“SDK”) License Agreement.
14  * You may distribute such object code format Application under terms of your choice,
15  * provided that the header and source files of the Software have not been modified.
16  */
17
18 #ifndef GEOROUTERREPLYPARSER_H
19 #define GEOROUTERREPLYPARSER_H
20
21 #include "common/HereMaps_global.h"
22
23 #include "common/GeoCoordinates.h"
24 #include "common/GeoBoundingBox.h"
25 #include "routes/RouteSegment.h"
26
27 #include <libxml/tree.h>
28 #include <libxml/xpath.h>
29
30 HERE_MAPS_BEGIN_NAMESPACE
31
32 class ErrorBase;
33 class ParserError;
34 class GeoRoute;
35
36
37 /**
38  * This class encapsulates a parser of replies to routing requests.  It provides
39  * methods dedicated to parsing specific nodes of the reply data and populating
40  * a destination object supplied by the caller.
41  * 
42  * \ingroup routes
43  */
44 class GeoRouterReplyParser
45 {
46 public:
47
48     /**
49      * This method retrieves the route details held in the XML node supplied by
50      * the caller.
51      * 
52      * @param pNode A pointer to the XML node to parse. 
53      * 
54      * @param rDst A reference to an object which is to receive the results.
55      * 
56      * @param pCtx A pointer to the XPath context.
57      * 
58      * @param pError A pointer to an object that is populated
59      *        with error information should parsing fail.
60      * 
61      * @return <code>true</code> on success, otherwise <code>false</code> (in
62      *        which case the last argument to the method can be used to retrieve
63      *        the error information.
64      */
65     static bool ParseRouteEntry(xmlNodePtr pNode, GeoRoute& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
66
67     /**
68      * This method retrieves a route summary entry held in the XML node supplied
69      * by the caller.
70      * 
71      * @param pNode A pointer to the XML node to parse. 
72      * 
73      * @param rDst A reference to an object which is to receive the results.
74      * 
75      * @param pCtx A pointer to the XPath context.
76      * 
77      * @param pError A pointer to an object that is populated
78      *        with error information should parsing fail.
79      * 
80      * @return <code>true</code> on success, otherwise <code>false</code> (in
81      *        which case the last argument to the method can be used to retrieve
82      *        the error information.
83      */
84     static bool ParseSummary(xmlNodePtr pNode, GeoRoute& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
85
86     /**
87      * This method retrieves a route travel mode held in the XML node supplied
88      * by the caller.
89      * 
90      * @param pNode A pointer to the XML node to parse. 
91      * 
92      * @param rDst A reference to an object which is to receive the results.
93      * 
94      * @param pCtx A pointer to the XPath context.
95      * 
96      * @param pError A pointer to an object that is populated
97      *        with error information should parsing fail.
98      * 
99      * @return <code>true</code> on success, otherwise <code>false</code> (in
100      *        which case the last argument to the method can be used to retrieve
101      *        the error information.
102      */
103     static bool ParseMode(xmlNodePtr pNode, GeoRoute& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
104
105     /**
106      * This method retrieves the route shape definition from the XML node
107      * supplied by the caller.
108      * 
109      * @param pNode A pointer to the XML node to parse. 
110      * 
111      * @param rDst A reference to an object which is to receive the results.
112      * 
113      * @param pCtx A pointer to the XPath context.
114      * 
115      * @param pError A pointer to an object that is populated
116      *        with error information should parsing fail.
117      * 
118      * @return <code>true</code> on success, otherwise <code>false</code> (in
119      *        which case the last argument to the method can be used to retrieve
120      *        the error information.
121      */
122     static bool ParseShape(xmlNodePtr pNode, GeoCoordinateList& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
123
124     /**
125      * This method retrieves a route bounding box from the XML node
126      * supplied by the caller.
127      * 
128      * @param pNode A pointer to the XML node to parse. 
129      * 
130      * @param rDst A reference to an object which is to receive the results.
131      * 
132      * @param pCtx A pointer to the XPath context.
133      * 
134      * @param pError A pointer to an object that is populated
135      *        with error information should parsing fail.
136      * 
137      * @return <code>true</code> on success, otherwise <code>false</code> (in
138      *        which case the last argument to the method can be used to retrieve
139      *        the error information.
140      */
141     static bool ParseBoundingBox(xmlNodePtr pNode, GeoBoundingBox& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
142
143     /**
144      * This method retrieves a route waypoint defined in the XML node supplied
145      * by the caller.
146      * 
147      * @param pNode A pointer to the XML node to parse. 
148      * 
149      * @param rDst A reference to an object which is to receive the results.
150      * 
151      * @param pCtx A pointer to the XPath context.
152      * 
153      * @param pError A pointer to an object that is populated
154      *        with error information should parsing fail.
155      * 
156      * @return <code>true</code> on success, otherwise <code>false</code> (in
157      *        which case the last argument to the method can be used to retrieve
158      *        the error information.
159      */
160     static bool ParseCoordinate(xmlNodePtr pNode, GeoCoordinates& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
161
162     /**
163      * This method retrieves a route leg defined in the XML node supplied by the
164      * caller.
165      * 
166      * @param pNode A pointer to the XML node to parse. 
167      * 
168      * @param rDst A reference to an object which is to receive the results.
169      * 
170      * @param pCtx A pointer to the XPath context.
171      * 
172      * @param pError A pointer to an object that is populated
173      *        with error information should parsing fail.
174      * 
175      * @return <code>true</code> on success, otherwise <code>false</code> (in
176      *        which case the last argument to the method can be used to retrieve
177      *        the error information.
178      */
179     static bool ParseLeg(xmlNodePtr pNode, RouteSegment& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
180
181     /**
182      * This method retrieves the details of a maneuver defined in the XML node
183      * supplied by the caller.
184      * 
185      * @param pNode A pointer to the XML node to parse. 
186      * 
187      * @param rDst A reference to an object which is to receive the results.
188      * 
189      * @param pCtx A pointer to the XPath context.
190      * 
191      * @param pError A pointer to an object that is populated
192      *        with error information should parsing fail.
193      * 
194      * @return <code>true</code> on success, otherwise <code>false</code> (in
195      *        which case the last argument to the method can be used to retrieve
196      *        the error information.
197      */
198     static bool ParseManeuver(xmlNodePtr pNode, Maneuver& rDst, GeoCoordinateList& vSegmentPath, xmlXPathContextPtr pCtx, ParserError*& pError);
199
200 private:
201     static bool ExtractContent(xmlNodePtr pNode, String& sDst, ParserError*& pError);
202     static xmlNodePtr FindChildNode(xmlNodePtr pNode, const char* pUTF8Literal);
203
204     static void AppendOrSet(ParserError*& pError, ParserError* pLoc);
205
206     HERE_MAPS_NO_COPY_NO_ASSIGN(GeoRouterReplyParser);
207
208 };
209
210 HERE_MAPS_END_NAMESPACE
211
212 #endif // GEOROUTERREPLYPARSER_H