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< ReadOnlyMemoryFile > | open (string_view path) |
Open a file by path. More... | |
unique_ptr< ReadOnlyMemoryFile > | tryOpen (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... | |
Domain * | getDomain () const |
const Metaclass * | getMetaclass (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 |
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.
typedef vector<pair<AbstractPropertyType, Variant> > kanzi::KzbFile::PropertyContainer |
typedef uint32_t kanzi::KzbFile::SizeType |
Type specifying maximum size of files. Currently at 4Gb.
Constructor.
domain. | |
file | File to read from. |
unique_ptr<ReadOnlyMemoryFile> kanzi::KzbFile::open | ( | string_view | path | ) |
Open a file by path.
Throws an error if file is not found.
path | to open. |
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.
path | Path to open. |
ResourceSharedPtr kanzi::KzbFile::loadResource | ( | string_view | path | ) |
ResourceManager::LoadTaskSharedPtr kanzi::KzbFile::getLoadTask | ( | string_view | path | ) |
Gets load task for given path.
path | Path to load. |
Domain* kanzi::KzbFile::getDomain | ( | ) | const |
const Metaclass* kanzi::KzbFile::getMetaclass | ( | size_t | index | ) | const |
AbstractPropertyType kanzi::KzbFile::getPropertyType | ( | size_t | index | ) | const |
Gets property type by index.
index | Index of property type. |
string_view kanzi::KzbFile::getString | ( | size_t | index | ) | const |
Gets string from string dictionary by index.
index | Index of 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.
urls | List to store URLs to. |
|
friend |