RLLib  0.1
Public Member Functions | Static Public Member Functions | List of all members
rl::Bundle Class Reference

A bundle is a collection of files packed in a big single file. More...

#include <Bundle.hpp>

Public Member Functions

 Bundle ()=default
 Creates an empty bundle.
 
 Bundle (FilePath path)
 Creates a bundle loaded from a file. More...
 
void load (FilePath path)
 Load the bundle from a file. More...
 
ByteStream readFile (const FilePath &path) const
 Reads a file in the bundle and returns its content. More...
 
void writeFile (const FilePath &path, const ByteStream &data)
 Overwrites a file in the bundle. More...
 

Static Public Member Functions

static Bundle create (FilePath bundlePath, const std::vector< std::pair< FilePath, ByteStream >> &files)
 Creates a new bundle file and returns its instance. More...
 

Detailed Description

A bundle is a collection of files packed in a big single file.

It is used to store all the game assets. In particular, this is where scene are being extracted from the game.

Constructor & Destructor Documentation

◆ Bundle()

rl::Bundle::Bundle ( FilePath  path)
explicit

Creates a bundle loaded from a file.

Parameters
pathThe path to the bundle file

Member Function Documentation

◆ create()

static Bundle rl::Bundle::create ( FilePath  bundlePath,
const std::vector< std::pair< FilePath, ByteStream >> &  files 
)
static

Creates a new bundle file and returns its instance.

Parameters
bundlePathThe path to the new bundle file that is to be created
filesA list of pairs containing file paths with associated contents
Returns
The instance of the new bundle

◆ load()

void rl::Bundle::load ( FilePath  path)

Load the bundle from a file.

Parameters
pathThe path to the bundle file

◆ readFile()

ByteStream rl::Bundle::readFile ( const FilePath path) const

Reads a file in the bundle and returns its content.

Parameters
pathThe path to the file in the bundle
Returns
The content of the file

◆ writeFile()

void rl::Bundle::writeFile ( const FilePath path,
const ByteStream data 
)

Overwrites a file in the bundle.

The file path must already exist in the bundle.

Warning
The original content will be lost.
Parameters
pathThe path to the file in the bundle
dataThe data that is to be written

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