DART
6.7.3
|
Resource provides file-like access to a resource loaded from URI. More...
#include <Resource.hpp>
Public Types | |
enum | SeekType { SEEKTYPE_CUR , SEEKTYPE_END , SEEKTYPE_SET } |
Position to seek relative to. More... | |
Public Member Functions | |
virtual | ~Resource ()=default |
virtual std::size_t | getSize ()=0 |
Return the size of the resource, in bytes. More... | |
virtual std::size_t | tell ()=0 |
Return the current value of the position indicator. More... | |
virtual bool | seek (ptrdiff_t _offset, SeekType _origin)=0 |
Set the position indicator to a new position. More... | |
virtual std::size_t | read (void *_buffer, std::size_t _size, std::size_t _count)=0 |
Read _count element, each of size _size, into _buffer. More... | |
virtual std::string | readAll () |
Reads all data from this resource, and returns it as a string. More... | |
Resource provides file-like access to a resource loaded from URI.
It is expected that each ResourceRetriever will provide a concrete / instantiation of the Resource class. This interface exposes an similar API to that of the the standard C file manipulation functions.
|
virtualdefault |
|
pure virtual |
Return the size of the resource, in bytes.
Implemented in dart::common::LocalResource.
|
pure virtual |
Read _count element, each of size _size, into _buffer.
[out] | _buffer | Pointer to a block of memory with a size of at least (_size * _count) bytes. |
[in] | _size | Size, in bytes, of each element. |
[in] | _count | Number of elements, each of _size bytes. |
Implemented in dart::common::LocalResource.
|
virtual |
Reads all data from this resource, and returns it as a string.
std::runtime_error | when failed to read sucessfully. |
|
pure virtual |
Set the position indicator to a new position.
[in] | _offset | Offset, in bytes, relative to _origin. |
[in] | _origin | Position used as the reference of _offset. |
Implemented in dart::common::LocalResource.
|
pure virtual |
Return the current value of the position indicator.
Implemented in dart::common::LocalResource.