ScummVM API documentation
Networking::NetworkReadStream Class Referenceabstract
Inheritance diagram for Networking::NetworkReadStream:
Common::ReadStream Common::Stream Networking::NetworkReadStreamAndroid Networking::NetworkReadStreamCurl

Public Member Functions

virtual bool reuse (const char *url, RequestHeaders *headersList, const Common::String &postFields, bool uploading=false, bool usingPatch=false)=0
 
virtual bool reuse (const char *url, RequestHeaders *headersList, const Common::HashMap< Common::String, Common::String > &formFields, const Common::HashMap< Common::String, Common::Path > &formFiles)=0
 
virtual bool reuse (const char *url, RequestHeaders *headersList, const byte *buffer, uint32 bufferSize, bool uploading=false, bool usingPatch=false, bool post=true)=0
 
bool eos () const override
 
uint32 read (void *dataPtr, uint32 dataSize) override=0
 
virtual long httpResponseCode () const =0
 
virtual Common::String currentLocation () const =0
 
virtual Common::HashMap< Common::String, Common::StringresponseHeadersMap () const =0
 
virtual double getProgress () const =0
 
bool keepAlive () const
 
virtual bool hasError () const =0
 
virtual const char * getError () const =0
 
- Public Member Functions inherited from Common::ReadStream
byte readByte ()
 
FORCEINLINE int8 readSByte ()
 
uint16 readUint16LE ()
 
uint32 readUint32LE ()
 
uint64 readUint64LE ()
 
uint16 readUint16BE ()
 
uint32 readUint32BE ()
 
uint64 readUint64BE ()
 
FORCEINLINE int16 readSint16LE ()
 
FORCEINLINE int32 readSint32LE ()
 
FORCEINLINE int64 readSint64LE ()
 
FORCEINLINE int16 readSint16BE ()
 
FORCEINLINE int32 readSint32BE ()
 
FORCEINLINE int64 readSint64BE ()
 
FORCEINLINE float readFloatLE ()
 
FORCEINLINE float readFloatBE ()
 
FORCEINLINE double readDoubleLE ()
 
FORCEINLINE double readDoubleBE ()
 
template<class TDataFormat , class... T>
bool readMultiple (const TDataFormat &dataFormat, T &...values)
 
template<class... T>
bool readMultipleEndian (bool isLittle, T &...values)
 
template<class... T>
bool readMultipleLE (T &...values)
 
template<class... T>
bool readMultipleBE (T &...values)
 
SeekableReadStreamreadStream (uint32 dataSize)
 
String readString (char terminator=0, size_t len=String::npos)
 
Common::String readPascalString (bool transformCR=true)
 
- Public Member Functions inherited from Common::Stream
virtual bool err () const
 
virtual void clearErr ()
 

Static Public Member Functions

static NetworkReadStreammake (const char *url, RequestHeaders *headersList, const Common::String &postFields, bool uploading=false, bool usingPatch=false, bool keepAlive=false, long keepAliveIdle=120, long keepAliveInterval=60)
 
static NetworkReadStreammake (const char *url, RequestHeaders *headersList, const Common::HashMap< Common::String, Common::String > &formFields, const Common::HashMap< Common::String, Common::Path > &formFiles, bool keepAlive=false, long keepAliveIdle=120, long keepAliveInterval=60)
 
static NetworkReadStreammake (const char *url, RequestHeaders *headersList, const byte *buffer, uint32 bufferSize, bool uploading=false, bool usingPatch=false, bool post=true, bool keepAlive=false, long keepAliveIdle=120, long keepAliveInterval=60)
 

Protected Member Functions

 NetworkReadStream (bool keepAlive, long keepAliveIdle, long keepAliveInterval)
 

Protected Attributes

bool _keepAlive
 
long _keepAliveIdle
 
long _keepAliveInterval
 
bool _eos
 

Member Function Documentation

◆ make() [1/3]

static NetworkReadStream* Networking::NetworkReadStream::make ( const char *  url,
RequestHeaders headersList,
const Common::String postFields,
bool  uploading = false,
bool  usingPatch = false,
bool  keepAlive = false,
long  keepAliveIdle = 120,
long  keepAliveInterval = 60 
)
static

Send <postFields>, using POST by default.

◆ make() [2/3]

static NetworkReadStream* Networking::NetworkReadStream::make ( const char *  url,
RequestHeaders headersList,
const Common::HashMap< Common::String, Common::String > &  formFields,
const Common::HashMap< Common::String, Common::Path > &  formFiles,
bool  keepAlive = false,
long  keepAliveIdle = 120,
long  keepAliveInterval = 60 
)
static

Send <formFields>, <formFiles>, using POST multipart/form.

◆ make() [3/3]

static NetworkReadStream* Networking::NetworkReadStream::make ( const char *  url,
RequestHeaders headersList,
const byte *  buffer,
uint32  bufferSize,
bool  uploading = false,
bool  usingPatch = false,
bool  post = true,
bool  keepAlive = false,
long  keepAliveIdle = 120,
long  keepAliveInterval = 60 
)
static

Send <buffer>, using POST by default.

◆ reuse() [1/3]

virtual bool Networking::NetworkReadStream::reuse ( const char *  url,
RequestHeaders headersList,
const Common::String postFields,
bool  uploading = false,
bool  usingPatch = false 
)
pure virtual

Send <postFields>, using POST by default.

Implemented in Networking::NetworkReadStreamCurl, and Networking::NetworkReadStreamAndroid.

◆ reuse() [2/3]

virtual bool Networking::NetworkReadStream::reuse ( const char *  url,
RequestHeaders headersList,
const Common::HashMap< Common::String, Common::String > &  formFields,
const Common::HashMap< Common::String, Common::Path > &  formFiles 
)
pure virtual

Send <formFields>, <formFiles>, using POST multipart/form.

Implemented in Networking::NetworkReadStreamCurl, and Networking::NetworkReadStreamAndroid.

◆ reuse() [3/3]

virtual bool Networking::NetworkReadStream::reuse ( const char *  url,
RequestHeaders headersList,
const byte *  buffer,
uint32  bufferSize,
bool  uploading = false,
bool  usingPatch = false,
bool  post = true 
)
pure virtual

Send <buffer>, using POST by default.

Implemented in Networking::NetworkReadStreamCurl, and Networking::NetworkReadStreamAndroid.

◆ eos()

bool Networking::NetworkReadStream::eos ( ) const
inlineoverridevirtual

Returns true if a read failed because the stream end has been reached. This flag is cleared by clearErr(). For a SeekableReadStream, it is also cleared by a successful seek.

Note
The semantics of any implementation of this method are supposed to match those of ISO C feof(). In particular, in a stream with N bytes, reading exactly N bytes from the start should not set eos; only reading beyond the available data should set it.

Implements Common::ReadStream.

◆ read()

uint32 Networking::NetworkReadStream::read ( void *  dataPtr,
uint32  dataSize 
)
overridepure virtual

Read data from the stream. Subclasses must implement this method; all other read methods are implemented using it.

Note
The semantics of any implementation of this method are supposed to match those of ISO C fread(), in particular where it concerns setting error and end of file/stream flags.
Parameters
dataPtrpointer to a buffer into which the data is read
dataSizenumber of bytes to be read
Returns
the number of bytes which were actually read.

Implements Common::ReadStream.

Implemented in Networking::NetworkReadStreamCurl, and Networking::NetworkReadStreamAndroid.

◆ httpResponseCode()

virtual long Networking::NetworkReadStream::httpResponseCode ( ) const
pure virtual

Returns HTTP response code from inner CURL handle. It returns -1 to indicate there is no inner handle.

Note
This method should be called when eos() == true.

Implemented in Networking::NetworkReadStreamCurl, and Networking::NetworkReadStreamAndroid.

◆ currentLocation()

virtual Common::String Networking::NetworkReadStream::currentLocation ( ) const
pure virtual

Return current location URL from inner CURL handle. "" is returned to indicate there is no inner handle.

Note
This method should be called when eos() == true.

Implemented in Networking::NetworkReadStreamCurl, and Networking::NetworkReadStreamAndroid.

◆ responseHeadersMap()

virtual Common::HashMap<Common::String, Common::String> Networking::NetworkReadStream::responseHeadersMap ( ) const
pure virtual

Return response headers as HashMap. All header names in it are lowercase.

Note
This method should be called when eos() == true.

Implemented in Networking::NetworkReadStreamCurl, and Networking::NetworkReadStreamAndroid.

◆ getProgress()

virtual double Networking::NetworkReadStream::getProgress ( ) const
pure virtual

Returns a number in range [0, 1], where 1 is "complete".

Implemented in Networking::NetworkReadStreamCurl, and Networking::NetworkReadStreamAndroid.


The documentation for this class was generated from the following file: