Class BlobResource

Inheritance Relationships

Base Type

Class Documentation

class BlobResource : public Cacao::Resource

Resource that holds a blob of data.

Public Functions

inline const std::vector<unsigned char> &GetData()

Access the stored data.

Returns:

A constant reference to the data

inline std::string_view GetDataAsString()

Access the stored data as a string.

Returns:

A constant reference to the data

Public Static Functions

static inline std::shared_ptr<BlobResource> Create(std::vector<unsigned char> &&data, const std::string &addr)

Create a new blob from binary data.

Parameters:
  • data – The data blob to store

  • addr – The resource address to associate with the blob

Throws:

BadValueException – If the address is malformed

static inline std::shared_ptr<BlobResource> Create(std::string &&data, const std::string &addr)

Create a new blob from textual data.

Parameters:
  • data – The string to store

  • addr – The resource address to associate with the blob

Throws:

BadValueException – If the address is malformed