MCPcopy Create free account
hub / github.com/JosephP91/curlcpp / curl_receiver

Class curl_receiver

include/curl_receiver.h:38–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36 * data on an established connection on an easy handler.
37 */
38 template<class T, const size_t SIZE> class curl_receiver {
39 public:
40 /**
41 * The default constructor simply initializes the attributes. In this
42 * case just the received bytes number is initialized to zero.
43 */
44 curl_receiver();
45 /**
46 * In this case the destructor does not have to release any resource.
47 */
48 ~curl_receiver() = default;
49 /**
50 * The receive method wraps curl_easy_recv function and receives raw
51 * data from the established connection on an easy handler.
52 */
53 bool receive(curl_easy &);
54 /**
55 * Simple getter method that returns the buffer with the received
56 * data.
57 */
58 std::array<T,SIZE> get_buffer() const;
59 /**
60 * Simple getter method that returns the number of received bytes.
61 * Real applications should check this number to ensure that the
62 * communication ended without errors.
63 */
64 size_t get_received_bytes() const;
65 private:
66 std::array<T,SIZE> _buffer;
67 size_t _recv_bytes;
68 };
69
70 // Implementation of constructor.
71 template<typename T, const size_t SIZE> curl_receiver<T,SIZE>::curl_receiver() : _recv_bytes(0) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected