Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
Ase::Blob Class Reference

Binary large object storage container. More...

#include "blob.hh"

Public Member Functions

String name ()
 Retrieve the Blob's filename or url.
 
const chardata ()
 Retrieve the Blob's data.
 
const uint8bytes ()
 Retrieve the Blob's data as uint8 buffer.
 
size_t size ()
 Retrieve the Blob's data size in bytes.
 
String string ()
 Copy Blob data into a zero terminated string.
 
 Blob ()
 Construct an empty Blob.
 
 Blob (const String &auto_url)
 Construct Blob from url or filename (auto detected).
 
 operator bool () const
 Checks if the Blob contains accessible data.
 

Static Public Member Functions

static Blob from_file (const String &filename)
 Create Blob by loading from filename.
 
static Blob from_url (const String &url)
 Create Blob by opening a url.
 

Detailed Description

Binary large object storage container.

Definition at line 12 of file blob.hh.

Constructor & Destructor Documentation

◆ Blob() [1/2]

Ase::Blob::Blob ( )
explicit

Construct an empty Blob.

Definition at line 122 of file blob.cc.

Referenced by from_file(), and from_url().

◆ Blob() [2/2]

Ase::Blob::Blob ( const String auto_url)
explicit

Construct Blob from url or filename (auto detected).

Definition at line 129 of file blob.cc.

References from_file(), and from_url().

Member Function Documentation

◆ bytes()

const uint8 * Ase::Blob::bytes ( )

Retrieve the Blob's data as uint8 buffer.

Definition at line 105 of file blob.cc.

References data().

◆ data()

const char * Ase::Blob::data ( )

Retrieve the Blob's data.

Definition at line 99 of file blob.cc.

Referenced by bytes().

◆ from_file()

Blob Ase::Blob::from_file ( const String filename)
static

Create Blob by loading from filename.

Definition at line 196 of file blob.cc.

References Blob(), std::string::c_str(), close(), ENOENT, errno(), fstat(), std::make_shared(), mmap(), munmap(), open(), and stat().

Referenced by Blob(), from_url(), and Ase::WebSocketConnection::http_request().

◆ from_url()

Blob Ase::Blob::from_url ( const String url)
static

Create Blob by opening a url.

Definition at line 152 of file blob.cc.

References Blob(), std::string::c_str(), std::string::compare(), ENOENT, errno(), from_file(), and Ase::string_tolower().

Referenced by Blob().

◆ name()

String Ase::Blob::name ( )

Retrieve the Blob's filename or url.

Definition at line 88 of file blob.cc.

Referenced by Ase::IniFile::IniFile().

◆ operator bool()

Ase::Blob::operator bool ( ) const
explicit

Checks if the Blob contains accessible data.

Definition at line 93 of file blob.cc.

◆ size()

size_t Ase::Blob::size ( )

Retrieve the Blob's data size in bytes.

Definition at line 111 of file blob.cc.

◆ string()

String Ase::Blob::string ( )

Copy Blob data into a zero terminated string.

Definition at line 117 of file blob.cc.

Referenced by Ase::WebSocketConnection::http_request(), and Ase::IniFile::IniFile().


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