changed attributes of header files
[platform/core/location/maps-plugin-here.git] / inc / engine / geocoder / GeoCoderReplyParser.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 GEOCODERREPLYPARSER_H
19 #define GEOCODERREPLYPARSER_H
20
21 #include "common/HereMaps_global.h"
22
23 #include <libxml/tree.h>
24 #include <libxml/xpath.h>
25
26 HERE_MAPS_BEGIN_NAMESPACE
27
28 class Result;
29 class Address;
30 class MetaInfo;
31 class ErrorBase;
32 class ParserError;
33 class GeoLocation;
34 class GeoCoordinates;
35 class GeoBoundingBox;
36
37 /**
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.
41  * 
42  * \ingroup geocoding
43  */
44 class GeoCoderReplyParser
45 {
46 public:
47     /**
48      * This method retrieves reply meta info held in the XML node supplied
49      * by the caller.
50      * 
51      * @param pNode A pointer to the XML node to parse. 
52      * 
53      * @param rDst A reference to an object which is to receive the results.
54      * 
55      * @param pCtx A pointer to the XPath context.
56      * 
57      * @param pError A pointer to an object that is populated
58      *        with error information should parsing fail.
59      * 
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.
63      */
64     static bool ParseMetaInfo(xmlNodePtr pNode, MetaInfo& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
65
66     /**
67      * This method retrieves a result entry held in the XML node supplied
68      * by the caller.
69      * 
70      * @param pNode A pointer to the XML node to parse. 
71      * 
72      * @param rDst A reference to an object which is to receive the results.
73      * 
74      * @param pCtx A pointer to the XPath context.
75      * 
76      * @param pError A pointer to an object that is populated
77      *        with error information should parsing fail.
78      * 
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.
82      */
83     static bool ParseResultEntry(xmlNodePtr pNode, Result& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
84
85     /**
86      * This method retrieves an address held in the XML node supplied
87      * by the caller 
88      * 
89      * @param pNode A pointer to the XML node to parse. 
90      * 
91      * @param rDst A reference to an object which is to receive the results.
92      * 
93      * @param pCtx A pointer to the XPath context.
94      * 
95      * @param pError A pointer to an object that is populated
96      *        with error information should parsing fail.
97      * 
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.
101      */
102     static bool ParseAddress(xmlNodePtr pNode, Address& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
103
104     /**
105      * This method retrieves geographic coordinates held in the XML node supplied
106      * by the caller.
107      * 
108      * @param pNode A pointer to the XML node to parse. 
109      * 
110      * @param rDst A reference to an object which is to receive the results.
111      * 
112      * @param pCtx A pointer to the XPath context.
113      * 
114      * @param pError A pointer to an object that is populated
115      *        with error information should parsing fail.
116      * 
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.
120      */
121     static bool ParseCoordinate(xmlNodePtr pNode, GeoCoordinates& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
122
123     /**
124      * This method retrieves location information held in the XML node supplied
125      * by the caller.
126      * 
127      * @param pNode A pointer to the XML node to parse. 
128      * 
129      * @param rDst A reference to an object which is to receive the results.
130      * 
131      * @param pCtx A pointer to the XPath context.
132      * 
133      * @param pError A pointer to an object that is populated
134      *        with error information should parsing fail.
135      * 
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.
139      */
140     static bool ParseLocation(xmlNodePtr pNode, GeoLocation& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
141
142     /**
143      * This method retrieves match quality information held in the XML node supplied
144      * by the caller.
145      * 
146      * @param pNode A pointer to the XML node to parse. 
147      * 
148      * @param rDst A reference to an object which is to receive the results.
149      * 
150      * @param pCtx A pointer to the XPath context.
151      * 
152      * @param pError A pointer to an object that is populated
153      *        with error information should parsing fail.
154      * 
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.
158      */
159     static bool ParseMatchQualitites(xmlNodePtr pNode, Result& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
160
161     /**
162      * This method retrieves  held in the XML node supplied
163      * by the caller.   
164      * 
165      * @param pNode A pointer to the XML node to parse. 
166      * 
167      * @param rDst A reference to an object which is to receive the results.
168      * 
169      * @param pCtx A pointer to the XPath context.
170      * 
171      * @param pError A pointer to an object that is populated
172      *        with error information should parsing fail.
173      * 
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.
177      */
178     static bool ParseBoundingBox(xmlNodePtr pNode, GeoBoundingBox& rDst, xmlXPathContextPtr pCtx, ParserError*& pError);
179
180 private:
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);
184
185     static void AppendOrSet(ParserError*& pError, ParserError* pLoc);
186
187     HERE_MAPS_NO_COPY_NO_ASSIGN(GeoCoderReplyParser);
188 };
189
190 HERE_MAPS_END_NAMESPACE
191
192 #endif