ae5289055d5e01b717bc9f65401dd2a593219101
[platform/core/location/maps-plugin-here.git] / inc / engine / internal / RestItem.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 RESTITEM_H
19 #define RESTITEM_H
20
21 #include "common/HereMaps_global.h"
22 #include "common/BaseReply.h"
23 #include "common/RestItemHandle.h"
24
25 #ifdef TIZEN_MIGRATION
26 #include "internal/RestCurl.h" // MemoryStruct_s
27 #else
28 #include <FNet.h>
29 #endif
30
31 HERE_MAPS_BEGIN_NAMESPACE
32
33 class ErrorBase;
34 class BaseReply;
35 class QueryListener;
36 #ifndef TIZEN_MIGRATION
37 class RestEngine;
38 #endif
39
40 //this class is for internal use only - do not rely on this outside
41 class RestItem
42 #ifdef TIZEN_MIGRATION
43 : public Tizen::Maps::Object
44 #endif
45 {
46 public:
47     enum RestItemStatus
48     {
49         RIS_Created = 0,
50         RIS_RequestIssued,
51         RIS_Completed
52     };
53
54     RestItem(QueryListener* rListener, BaseReplyPtr pBaseReply);
55     ~RestItem();
56
57 #ifdef TIZEN_SUPPORT_POST_METHOD
58     bool Run(const String& rUri, bool bPost = false, const String& rPostData = "");
59 #else
60     bool Run(const String& rUri);
61 #endif
62     void Stop();
63
64     void OnError(ErrorBase& rError);
65     void OnResponseData(const Tizen::Maps::ByteBuffer& rBuff);
66
67 #ifndef TIZEN_MIGRATION
68     bool OwnsTransaction(Tizen::Net::Http::HttpTransaction* pTransaction) const;
69 #endif
70     QueryListener* GetListener() const;
71
72     RestItemHandle::RequestId GetRequestId() const;
73
74 private:
75     HERE_MAPS_NO_COPY_NO_ASSIGN(RestItem);
76     friend class RestEngine;
77
78     class RestItemImpl;
79     RestItemImpl* m_pImpl;
80 };
81
82 HERE_MAPS_END_NAMESPACE
83
84 #endif