kanzi::KzbFile Class Reference

KZB file loader. More...

#include <kanzi/core.ui/kzb/kzb_file.hpp>

Public Types

typedef vector< pair< AbstractPropertyType, Variant > > PropertyContainer
 
typedef uint32_t SizeType
 Type specifying maximum size of files. Currently at 4Gb. More...
 

Public Member Functions

 KzbFile (Domain *domain, unique_ptr< File > file)
 Constructor. More...
 
unique_ptr< ReadOnlyMemoryFileopen (string_view path)
 Open a file by path. More...
 
unique_ptr< ReadOnlyMemoryFiletryOpen (string_view path)
 Tries to open file by path. More...
 
ResourceSharedPtr loadResource (string_view path)
 Load a resource identified by path. More...
 
ResourceManager::LoadTaskSharedPtr getLoadTask (string_view path)
 Gets load task for given path. More...
 
DomaingetDomain () const
 
const MetaclassgetMetaclass (size_t index) const
 Gets metaclass by index. More...
 
AbstractPropertyType getPropertyType (size_t index) const
 Gets property type by index. More...
 
string_view getString (size_t index) const
 Gets string from string dictionary by index. More...
 
string getProjectName () const
 Gets project name. More...
 
void collectResourceUrls (ResourceManager::UrlContainer &urls)
 Collects resource urls for this kzb file. More...
 

Friends

class KzbMemoryParser
 

Detailed Description

KZB file loader.

Used to store all KZB information. This includes dictionaries for strings, files, property types, metaclasses. Resource manager refers to the KzbFile dictionaries when loading resources. Internally uses KzbMemoryParser to parse the values from files.

Member Typedef Documentation

typedef uint32_t kanzi::KzbFile::SizeType

Type specifying maximum size of files. Currently at 4Gb.

Constructor & Destructor Documentation

kanzi::KzbFile::KzbFile ( Domain domain,
unique_ptr< File file 
)
explicit

Constructor.

Parameters
domain.
fileFile to read from.

Member Function Documentation

unique_ptr<ReadOnlyMemoryFile> kanzi::KzbFile::open ( string_view  path)

Open a file by path.

Throws an error if file is not found.

Parameters
pathto open.
Returns
File opened.
unique_ptr<ReadOnlyMemoryFile> kanzi::KzbFile::tryOpen ( string_view  path)

Tries to open file by path.

Silently returns an empty unique pointer if file is not found.

Parameters
pathPath to open.
Returns
File opened.
ResourceSharedPtr kanzi::KzbFile::loadResource ( string_view  path)

Load a resource identified by path.

Parameters
pathPath to resource.
Returns
Resource loaded.
ResourceManager::LoadTaskSharedPtr kanzi::KzbFile::getLoadTask ( string_view  path)

Gets load task for given path.

Parameters
pathPath to load.
Returns
Load task created.
Domain* kanzi::KzbFile::getDomain ( ) const
const Metaclass* kanzi::KzbFile::getMetaclass ( size_t  index) const

Gets metaclass by index.

Parameters
indexIndex of metaclass.
Returns
Metaclass.
AbstractPropertyType kanzi::KzbFile::getPropertyType ( size_t  index) const

Gets property type by index.

Parameters
indexIndex of property type.
Returns
Property type.
string_view kanzi::KzbFile::getString ( size_t  index) const

Gets string from string dictionary by index.

Parameters
indexIndex of string.
Returns
View into string.
string kanzi::KzbFile::getProjectName ( ) const

Gets project name.

Project name is the base filename part of the URL identifying the KZB. This corresponds to what is called a 'hostname' in URLs. KZB files loaded are identified by this name. Multiple .kzb -files can correspond to the same project name in the resource manager.

void kanzi::KzbFile::collectResourceUrls ( ResourceManager::UrlContainer urls)

Collects resource urls for this kzb file.

Parameters
urlsList to store URLs to.

Friends And Related Function Documentation

friend class KzbMemoryParser
friend

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