| 55 | namespace curl { |
| 56 | // Base class for curl_ios |
| 57 | template<class T> class curl_ios { |
| 58 | public: |
| 59 | // This constructor allows to specifiy a custom stream and a custom callback pointer. |
| 60 | curl_ios(T *stream, curlcpp_callback_type callback_ptr) : _stream(stream) { |
| 61 | this->set_callback(callback_ptr); |
| 62 | } |
| 63 | |
| 64 | // This method allow to specify a custom callback pointer. |
| 65 | void set_callback(curlcpp_callback_type callback_ptr) { |
| 66 | _callback_ptr = callback_ptr == nullptr ? write_callback<std::ostringstream> : callback_ptr; |
| 67 | } |
| 68 | |
| 69 | // This method returns the stream pointer. |
| 70 | T *get_stream() const { |
| 71 | return _stream; |
| 72 | } |
| 73 | |
| 74 | // This method return the callback function pointer. |
| 75 | curlcpp_callback_type get_function() const { |
| 76 | return _callback_ptr; |
| 77 | } |
| 78 | private: |
| 79 | // Callback pointer. |
| 80 | curlcpp_callback_type _callback_ptr; |
| 81 | |
| 82 | // Generic stream pointer. |
| 83 | T* _stream; |
| 84 | }; |
| 85 | |
| 86 | |
| 87 | // Template specialization for fstream |
nothing calls this directly
no outgoing calls
no test coverage detected