#include <WMemoryResource>
Public Member Functions | |
WMemoryResource (const std::string &mimeType, const std::vector< char > &data) | |
Create a new resource with given mime-type and data. | |
void | setData (const std::vector< char > &data) |
Set new data for the resource to serve. | |
const std::string | mimeType () const |
Get the mime-type. | |
void | setMimeType (const std::string &mimeType) |
Set the mime-type. | |
Protected Member Functions | |
virtual const std::string | resourceMimeType () const |
Return the mimetype. | |
virtual bool | streamResourceData (std::ostream &stream, const ArgumentMap &arguments) |
Stream the data for this resource. |
Use this resource if you want to serve resource data from memory. This is suitable for relatively small resources, which still require some computation.
If you require little computation for creating the data, then you may want to reimplement WResource and compute the data on the fly while streaming.
If you have a lot of data, you may want to use a WFileResource instead.