be04a4e9d3f7c88e8dbd8997b8640fabbdeeda7b
[platform/core/location/maps-plugin-here.git] / inc / engine / common / BaseReply.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 BASEREPLY_H
19 #define BASEREPLY_H
20
21 #include "common/HereMaps_global.h"
22 #include "common/QueryListener.h"
23
24 #ifdef TIZEN_MIGRATION
25 #include <base/HereObject.h>
26 #else
27 #include <FBaseObject.h>
28 #endif
29
30 HERE_MAPS_BEGIN_NAMESPACE
31
32 class ErrorBase;
33
34 /**
35  * This class is the base class that encapsulates a reply to a REST-based query.
36  * 
37  * @ingroup TODO
38  */
39 class EXPORT_API BaseReply
40 {
41 public:
42     /**
43      * This method is a destructor.
44      */
45     virtual ~BaseReply();
46
47     /**
48      * This method retrieves error information associated with the query
49      * response received from the server.
50      * 
51      * @return A constant pointer to an object containing the error details.
52      */
53     const ErrorBase* GetError() const;
54
55     /**
56      * This method sets (saves) a pointer to user data associated with the
57      * reply to the query.
58      *
59      * @param pUserData A pointer to user data.
60      */
61      void SetUserData(Tizen::Maps::HereObject* pUserData);
62
63     /**
64      * This method retrieves the pointer the user data.
65      *
66      * @return A pointer to the user data.
67      */
68     Tizen::Maps::HereObject* GetUserData() const;
69
70 protected:
71     /**
72      * This method is the default constructor. 
73      */
74     BaseReply();
75
76     /**
77      * This method appends information about an error associated with the server
78      * response. 
79      *
80      * @param rError A reference to an object containing the error details.
81      */
82     void Append(ErrorBase& rError);
83
84 private:
85     virtual bool OnDataReceived(const unsigned char* pBuffer, size_t uSize) = 0;
86
87 private:
88     HERE_MAPS_NO_COPY_NO_ASSIGN(BaseReply);
89     friend class RestItem;
90
91     class BaseReplyImpl;
92     BaseReplyImpl* m_pImpl;
93 };
94
95 typedef std::tr1::shared_ptr<BaseReply> BaseReplyPtr;
96
97 HERE_MAPS_END_NAMESPACE
98
99 #endif // BASEREPLY_H