HoverRace  2.0
BaseTransfer.h
Go to the documentation of this file.
1 
2 // BaseTransfer.h
3 //
4 // Copyright (c) 2009, 2016 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include <curl/curl.h>
25 
26 #include "Agent.h"
27 #include "NetExn.h"
28 #include "Transfer.h"
29 
30 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
31 # ifdef MR_ENGINE
32 # define MR_DllDeclare __declspec( dllexport )
33 # else
34 # define MR_DllDeclare __declspec( dllimport )
35 # endif
36 #else
37 # define MR_DllDeclare
38 #endif
39 
40 namespace HoverRace {
41 namespace Net {
42 
48 {
49  typedef Transfer SUPER;
50  private:
51  BaseTransfer() { };
52  public:
53  BaseTransfer(const Agent &agent);
54  virtual ~BaseTransfer();
55 
56  protected:
57  void AssertCurlSuccess(CURLcode code,
58  std::shared_ptr<CancelFlag> cancelFlag = {});
59 
60  private:
61  char errorBuf[CURL_ERROR_SIZE];
62  protected:
63  CURL *curl;
64 };
65 
66 } // namespace Net
67 } // namespace HoverRace
68 
69 #undef MR_DllDeclare
Transfer SUPER
Definition: BaseTransfer.h:49
The network transfer agent (wrapper for libcurl).
Definition: Agent.h:46
CURL * curl
Definition: BaseTransfer.h:63
BaseTransfer()
Definition: BaseTransfer.h:51
#define MR_DllDeclare
Definition: BaseTransfer.h:37
Base class for standard Agent transfers.
Definition: BaseTransfer.h:47
Definition: Announcement.h:24
Interface for network transfers.
Definition: Transfer.h:44