|
Beatmup
|
File containing chunks. More...
#include <chunkfile.h>
Public Member Functions | |
| ChunkFile (const std::string &filename, bool openNow=true) | |
| Creates a read-only chunk collection from a file. 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 () |
Static Public Member Functions | |
| static bool | readable (const std::string &filename) |
Returns true if a given file is readable. More... | |
Private Attributes | |
| const std::string | filename |
| FileInputStream | 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... | |
File containing chunks.
The file is not loaded in memory, but is scanned when first opened to collect the information about available chunks.
Definition at line 167 of file chunkfile.h.
| ChunkFile::ChunkFile | ( | const std::string & | filename, |
| bool | openNow = true |
||
| ) |
Creates a read-only chunk collection from a file.
| [in] | filename | The file name / path |
| [in] | openNow | If true, the file is read right away. Otherwise it is done on open() call. No information is available about chunks in the file until it is opened. |
Definition at line 111 of file chunkfile.cpp.
|
static |
Returns true if a given file is readable.
Definition at line 105 of file chunkfile.cpp.
|
virtual |
Opens the collection to read chunks from it.
Implements Beatmup::ChunkCollection.
Definition at line 120 of file chunkfile.cpp.
|
virtual |
Closes the collection after a reading session.
Implements Beatmup::ChunkCollection.
Definition at line 127 of file chunkfile.cpp.
|
private |
Definition at line 169 of file chunkfile.h.
|
private |
Definition at line 170 of file chunkfile.h.