All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WebResponse.h
1 // Copyright eeGeo Ltd (2012-2015), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Web.h"
6 #include "Types.h"
7 #include "IWebLoadRequest.h"
8 #include "WebPostData.h"
9 #include <string>
10 #include <vector>
11 
12 namespace Eegeo
13 {
14  namespace Web
15  {
22  {
23  public:
25  const TWebRequestId requestId,
26  const WebLoadResponseStatistics& statistics,
27  const std::string& url,
28  const HttpVerbs::Values httpVerb,
29  const int httpStatusCode,
30  void* const pUserData,
31  const TResourceData* bodyData,
32  const TResourceData* headerData,
33  const WebPostData postBodyData,
34  const WebLoadResponseCompletionCode::Values completionCode);
35 
36  ~WebResponse();
37 
38  bool IsSucceeded() const;
39  bool IsErrored() const;
40  bool IsCancelled() const;
41  bool HasData() const;
42 
43  std::string GetUrl() const;
44  std::string GetBaseUrl() const;
45  HttpVerbs::Values GetHttpVerb() const;
46  int GetHttpStatusCode() const;
47  void* GetUserData() const;
48  const TResourceData& GetHeaderData() const;
49  const TResourceData& GetBodyData() const;
50  const WebPostData& GetPostBodyData() const;
51  WebLoadResponseStatistics GetStatistics() const;
52  bool MatchesRequestId(const TWebRequestId requestId) const;
53  TWebRequestId GetRequestId() const;
54 
55  // sole mutable method
56  const TResourceData* TransferResourceDataOwnership();
57 
58  private:
59  const TWebRequestId m_requestId;
60 
61  const WebLoadResponseStatistics m_statistics;
62  const std::string m_url;
63  const HttpVerbs::Values m_httpVerb;
64  const int m_httpStatusCode;
65  void* const m_pUserData;
66 
67  // sole pieces of mutable data. We either own their lifetime (they're non-NULL), or the caller has grabbed them (NULL).
68  const TResourceData* m_pHeaderData;
69  const TResourceData* m_pBodyData;
70  const WebPostData m_postBodyData;
71 
72  const WebLoadResponseCompletionCode::Values m_completionCode;
73  };
74  }
75 }