Audacity 3.2.0
RequestPayload.h
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file RequestPayload.h
6 @brief Declare a class for constructing HTTP requests.
7
8 Dmitry Vedenko
9 **********************************************************************/
10
11#pragma once
12
13#include <cstdint>
14#include <memory>
15#include <string>
16
18{
20{
21public:
22 virtual ~RequestPayloadStream();
23
25 virtual bool HasData() const = 0;
26
28 virtual int64_t GetDataSize() const = 0;
29
30 enum class SeekDirection
31 {
32 Start,
33 Current,
34 End
35 };
36
38 virtual bool Seek(int64_t offset, SeekDirection direction) = 0;
39
41 virtual int64_t Read(void* buffer, int64_t size) = 0;
42}; // class RequestPayload
43
44using RequestPayloadStreamPtr = std::shared_ptr<RequestPayloadStream>;
45
47CreateRequestPayloadStream(const void* data, int64_t size, bool copyData);
48
50
52CreateRequestPayloadStream(const std::string& filePath);
53
54
55} // namespace audacity::network_manager
#define NETWORK_MANAGER_API
virtual bool Seek(int64_t offset, SeekDirection direction)=0
returns true on success
virtual int64_t Read(void *buffer, int64_t size)=0
returns number of bytes read
virtual int64_t GetDataSize() const =0
May return 0 even if HasData() returns true.
virtual bool HasData() const =0
return true on if stream is not empty
std::shared_ptr< RequestPayloadStream > RequestPayloadStreamPtr
Definition: CurlResponse.h:33
RequestPayloadStreamPtr CreateRequestPayloadStream(const void *data, int64_t size, bool copyData)