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
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.
18 #ifndef GEOCODERREPLYPARSER_H
19 #define GEOCODERREPLYPARSER_H
21 #include "common/HereMaps_global.h"
23 #include <libxml/tree.h>
24 #include <libxml/xpath.h>
26 HERE_MAPS_BEGIN_NAMESPACE
38 * This class encapsulates a request reply parser. It provides methods dedicated
39 * to parsing specific nodes of the reply data and populating a destination
40 * object supplied by the caller.
44 class GeoCoderReplyParser
48 * This method retrieves reply meta info held in the XML node supplied
51 * @param pNode A pointer to the XML node to parse.
53 * @param rDst A reference to an object which is to receive the results.
55 * @param pCtx A pointer to the XPath context.
57 * @param pError A pointer to an object that is populated
58 * with error information should parsing fail.
60 * @return <code>true</code> on success, otherwise <code>false</code> (in
61 * which case the last argument to the method can be used to retrieve
62 * the error information.
64 static bool ParseMetaInfo(xmlNodePtr pNode, MetaInfo& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
67 * This method retrieves a result entry held in the XML node supplied
70 * @param pNode A pointer to the XML node to parse.
72 * @param rDst A reference to an object which is to receive the results.
74 * @param pCtx A pointer to the XPath context.
76 * @param pError A pointer to an object that is populated
77 * with error information should parsing fail.
79 * @return <code>true</code> on success, otherwise <code>false</code> (in
80 * which case the last argument to the method can be used to retrieve
81 * the error information.
83 static bool ParseResultEntry(xmlNodePtr pNode, Result& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
86 * This method retrieves an address held in the XML node supplied
89 * @param pNode A pointer to the XML node to parse.
91 * @param rDst A reference to an object which is to receive the results.
93 * @param pCtx A pointer to the XPath context.
95 * @param pError A pointer to an object that is populated
96 * with error information should parsing fail.
98 * @return <code>true</code> on success, otherwise <code>false</code> (in
99 * which case the last argument to the method can be used to retrieve
100 * the error information.
102 static bool ParseAddress(xmlNodePtr pNode, Address& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
105 * This method retrieves geographic coordinates held in the XML node supplied
108 * @param pNode A pointer to the XML node to parse.
110 * @param rDst A reference to an object which is to receive the results.
112 * @param pCtx A pointer to the XPath context.
114 * @param pError A pointer to an object that is populated
115 * with error information should parsing fail.
117 * @return <code>true</code> on success, otherwise <code>false</code> (in
118 * which case the last argument to the method can be used to retrieve
119 * the error information.
121 static bool ParseCoordinate(xmlNodePtr pNode, GeoCoordinates& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
124 * This method retrieves location information held in the XML node supplied
127 * @param pNode A pointer to the XML node to parse.
129 * @param rDst A reference to an object which is to receive the results.
131 * @param pCtx A pointer to the XPath context.
133 * @param pError A pointer to an object that is populated
134 * with error information should parsing fail.
136 * @return <code>true</code> on success, otherwise <code>false</code> (in
137 * which case the last argument to the method can be used to retrieve
138 * the error information.
140 static bool ParseLocation(xmlNodePtr pNode, GeoLocation& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
143 * This method retrieves match quality information held in the XML node supplied
146 * @param pNode A pointer to the XML node to parse.
148 * @param rDst A reference to an object which is to receive the results.
150 * @param pCtx A pointer to the XPath context.
152 * @param pError A pointer to an object that is populated
153 * with error information should parsing fail.
155 * @return <code>true</code> on success, otherwise <code>false</code> (in
156 * which case the last argument to the method can be used to retrieve
157 * the error information.
159 static bool ParseMatchQualitites(xmlNodePtr pNode, Result& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
162 * This method retrieves held in the XML node supplied
165 * @param pNode A pointer to the XML node to parse.
167 * @param rDst A reference to an object which is to receive the results.
169 * @param pCtx A pointer to the XPath context.
171 * @param pError A pointer to an object that is populated
172 * with error information should parsing fail.
174 * @return <code>true</code> on success, otherwise <code>false</code> (in
175 * which case the last argument to the method can be used to retrieve
176 * the error information.
178 static bool ParseBoundingBox(xmlNodePtr pNode, GeoBoundingBox& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
181 static bool ExtractContent(xmlNodePtr pNode, String& sDst, ParserError*& pError);
182 static bool ExtractNodeName(xmlNodePtr pNode, String& sDst, ParserError*& pError);
183 static xmlNodePtr FindChildNode(xmlNodePtr pNode, const char* pUTF8Literal);
185 static void AppendOrSet(ParserError*& pError, ParserError* pLoc);
187 HERE_MAPS_NO_COPY_NO_ASSIGN(GeoCoderReplyParser);
190 HERE_MAPS_END_NAMESPACE