Kanzi Framework  3.9.0
Kanzi Engine API
kanzi::KzbFile Class Reference

Kzb file loader. More...

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

Public Types

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

Public Member Functions

vector< string > collectFileNames () const
 Collects all file names in a kzb file. More...
 
void collectResourceUrls (ResourceManager::UrlContainer &urls) const
 Collects resource URLs in for a kzb file. More...
 
ColorWorkflow getColorWorkflow () const
 Gets the color workflow The Color workflow that is used to generate a kzb file. More...
 
DomaingetDomain () const
 
ResourceManager::LoadTaskSharedPtr getLoadTask (string_view path)
 Gets load task for given path. More...
 
const MetaclassgetMetaclass (size_t index) const
 Gets metaclass by index. More...
 
string getProjectName () const
 Gets project name. 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...
 
 KzbFile (Domain *domain, unique_ptr< File > file)
 Constructor. More...
 
ResourceSharedPtr loadResource (string_view path)
 Load a resource identified by path. More...
 
ReadOnlyMemoryFilePtr open (string_view path)
 Open a file by path. More...
 
ReadOnlyMemoryFilePtr tryOpen (string_view path)
 Tries to open file by path. More...
 

Static Public Attributes

static const uint16_t KzbFormatVersionMajor
 The version number for the current kzb format. More...
 
static const uint16_t KzbFormatVersionMinor
 

Friends

class KzbMemoryParser
 

Detailed Description

Kzb file loader.

Stores 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

◆ PropertyContainer

Container type for property values.

◆ SizeType

typedef uint32_t kanzi::KzbFile::SizeType

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

Constructor & Destructor Documentation

◆ KzbFile()

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

Constructor.

Parameters
domainThe UI domain.
fileFile to read from.

Member Function Documentation

◆ open()

ReadOnlyMemoryFilePtr 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.

◆ tryOpen()

ReadOnlyMemoryFilePtr 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.

◆ loadResource()

ResourceSharedPtr kanzi::KzbFile::loadResource ( string_view  path)

Load a resource identified by path.

Parameters
pathPath to resource.
Returns
Resource loaded.

◆ getLoadTask()

ResourceManager::LoadTaskSharedPtr kanzi::KzbFile::getLoadTask ( string_view  path)

Gets load task for given path.

Parameters
pathPath to load.
Returns
Load task created.

◆ getDomain()

Domain* kanzi::KzbFile::getDomain ( ) const

◆ getMetaclass()

const Metaclass* kanzi::KzbFile::getMetaclass ( size_t  index) const

Gets metaclass by index.

Parameters
indexIndex of metaclass.
Returns
Metaclass.

◆ getPropertyType()

AbstractPropertyType kanzi::KzbFile::getPropertyType ( size_t  index) const

Gets property type by index.

Parameters
indexIndex of property type.
Returns
Property type.

◆ getString()

string_view kanzi::KzbFile::getString ( size_t  index) const

Gets string from string dictionary by index.

Parameters
indexIndex of string.
Returns
View into string.

◆ getProjectName()

string kanzi::KzbFile::getProjectName ( ) const

Gets project name.

Project name is the base filename part of the URL identifying a kzb file. 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 ResourceManager.

◆ getColorWorkflow()

ColorWorkflow kanzi::KzbFile::getColorWorkflow ( ) const

Gets the color workflow The Color workflow that is used to generate a kzb file.

◆ collectResourceUrls()

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

Collects resource URLs in for a kzb file.

Parameters
urlsList to store URLs to.

◆ collectFileNames()

vector<string> kanzi::KzbFile::collectFileNames ( ) const

Collects all file names in a kzb file.

Returns
Vector of file names.

Friends And Related Function Documentation

◆ KzbMemoryParser

friend class KzbMemoryParser
friend

Member Data Documentation

◆ KzbFormatVersionMajor

const uint16_t kanzi::KzbFile::KzbFormatVersionMajor
static

The version number for the current kzb format.

Increased when the format changes. Major versions represent mainline (master branch) changes. Minor versions represent changes done on a specific branch. Version history:

  • 0.0. The initial version. Used in Kanzi 3.6.1.
  • 1.0. Introduced new versioning format that removes the Kanzi tool version from the kzb. Used in Kanzi 3.6.2.
  • 2.0. Added multisample samples to render target textures. Cubemap images are flipped already in Kanzi Studio.
  • 3.0. Added simple render target mode toggle to render target textures. Used in Kanzi 3.6.4.
  • 4.0. Quaternion field order and Euler to quaternion algorithm changed.
  • 5.0. Added enum to bindings specifying whether they are value sources or property modifiers.
  • 6.0. Added To Source bindings. Changed order of fields in binding data to support To Source bindings.
  • 7.0. Added render pass prefabs and render pass templates.
  • 8.0. Reordered the MessageRouting enum, removed everything related to MessageRoutingDirect from Kanzi Engine.
  • 9.0. Storing resource dictionary text resource strings locally.
  • 10.0 Support for deferred loading of state node component templates.
  • 11.0. Font file converted to FontFile. Font Family resource introduced.
  • 12.0. Added bindings and changed uniform representation in material types. Changed precedence to target type in bindings, added render value binding target.
  • 13.0. Added range binding processors.
  • 14.0. Added color workflow.
  • 15.0. Added Data Triggers.
  • 16.0. Added data type field for shader uniforms.

◆ KzbFormatVersionMinor

const uint16_t kanzi::KzbFile::KzbFormatVersionMinor
static

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