Beatmup
Beatmup::Android::ChunkAsset Class Reference

Asset containing chunks. More...

#include <asset.h>

Inheritance diagram for Beatmup::Android::ChunkAsset:
Beatmup::ChunkStream Beatmup::ChunkCollection Beatmup::Object

Public Member Functions

 ChunkAsset (AAssetManager *manager, const std::string &filename)
 Creates a read-only chunk collection from an asset. More...
 
void open ()
 Opens the collection to read chunks from it. More...
 
void close ()
 Closes the collection after a reading session. More...
 
- Public Member Functions inherited from Beatmup::ChunkStream
size_t size () const
 Returns the number of chunks available in the collection after it is opened. More...
 
bool chunkExists (const std::string &id) const
 Check if a specific chunk exists. More...
 
chunksize_t chunkSize (const std::string &id) const
 Retrieves size of a specific chunk. More...
 
chunksize_t fetch (const std::string &id, void *data, const chunksize_t limit)
 Reads a chunk. More...
 
void save (const std::string &filename, bool append=false)
 Saves the collection to a file. More...
 
- Public Member Functions inherited from Beatmup::ChunkCollection
template<typename datatype >
datatype read (const std::string &id)
 Reads a chunk and casts it into a given type. More...
 
template<typename datatype >
std::vector< datatype > readVector (const std::string &id)
 Reads a chunk into a vector of a specific type. More...
 
template<>
std::string read (const std::string &id)
 
- Public Member Functions inherited from Beatmup::Object
virtual ~Object ()
 

Private Attributes

Asset stream
 

Additional Inherited Members

- Protected Member Functions inherited from Beatmup::ChunkStream
 ChunkStream (InputStream &stream)
 
bool parse ()
 Goes through the input stream to build the list of existing chunks. More...
 

Detailed Description

Asset containing chunks.

Definition at line 80 of file asset.h.

Constructor & Destructor Documentation

◆ ChunkAsset()

ChunkAsset::ChunkAsset ( AAssetManager *  manager,
const std::string &  filename 
)

Creates a read-only chunk collection from an asset.

Parameters
[in]managerAAssetManager instance
[in]filenameThe asset file name / path

Definition at line 99 of file asset.cpp.

99  :
100  stream(manager, filename.c_str()),
102 {
103  if (!parse())
104  throw IOError(filename, "Cannot parse asset");
105 }
ChunkStream(InputStream &stream)
Definition: chunkfile.h:143
bool parse()
Goes through the input stream to build the list of existing chunks.
Definition: chunkfile.cpp:39
JNIEnv jlong jstring filename

Member Function Documentation

◆ open()

void Beatmup::Android::ChunkAsset::open ( )
inlinevirtual

Opens the collection to read chunks from it.

Implements Beatmup::ChunkCollection.

Definition at line 90 of file asset.h.

90 {}

◆ close()

void Beatmup::Android::ChunkAsset::close ( )
inlinevirtual

Closes the collection after a reading session.

Implements Beatmup::ChunkCollection.

Definition at line 91 of file asset.h.

91 {}

Member Data Documentation

◆ stream

Asset Beatmup::Android::ChunkAsset::stream
private

Definition at line 82 of file asset.h.


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