Blender V5.0
blender::ed::asset::index::AssetIndex Struct Reference

Public Member Functions

 AssetIndex (const FileIndexerEntries &indexer_entries)
 AssetIndex (std::unique_ptr< Value > &value)
int get_version () const
bool is_latest_version () const
int extract_into (FileIndexerEntries &indexer_entries) const

Public Attributes

const int UNKNOWN_VERSION = -1
std::unique_ptr< Valuecontents

Static Public Attributes

static const int CURRENT_VERSION = 1
 Version to store in new index files.

Detailed Description

Instance of this class represents the contents of an asset index file.

{
"version": {version},
"entries": ...
}

Definition at line 445 of file asset_indexer.cc.

Constructor & Destructor Documentation

◆ AssetIndex() [1/2]

blender::ed::asset::index::AssetIndex::AssetIndex ( const FileIndexerEntries & indexer_entries)
inline

Constructor for when creating/updating an asset index file. #AssetIndex.contents are filled from the given indexer_entries.

Definition at line 473 of file asset_indexer.cc.

References blender::ed::asset::index::ATTRIBUTE_VERSION(), CURRENT_VERSION, and blender::ed::asset::index::init_value_from_file_indexer_entries().

◆ AssetIndex() [2/2]

blender::ed::asset::index::AssetIndex::AssetIndex ( std::unique_ptr< Value > & value)
inline

Constructor when reading an asset index file. #AssetIndex.contents are read from the given value.

Definition at line 486 of file asset_indexer.cc.

References contents.

Member Function Documentation

◆ extract_into()

int blender::ed::asset::index::AssetIndex::extract_into ( FileIndexerEntries & indexer_entries) const
inline

Extract the contents of this index into the given indexer_entries.

Returns
The number of entries read from the given entries.

Definition at line 508 of file asset_indexer.cc.

References blender::ed::asset::index::init_indexer_entries_from_value().

◆ get_version()

int blender::ed::asset::index::AssetIndex::get_version ( ) const
inline

◆ is_latest_version()

bool blender::ed::asset::index::AssetIndex::is_latest_version ( ) const
inline

Definition at line 498 of file asset_indexer.cc.

References CURRENT_VERSION, and get_version().

Member Data Documentation

◆ contents

std::unique_ptr<Value> blender::ed::asset::index::AssetIndex::contents

io::serialize::Value representing the contents of an index file.

Value is used over DictionaryValue as the contents of the index could be corrupted and doesn't represent an object. In case corrupted files are detected the get_version would return UNKNOWN_VERSION.

Definition at line 467 of file asset_indexer.cc.

Referenced by AssetIndex(), and blender::ed::asset::index::AssetIndexFile::write_contents().

◆ CURRENT_VERSION

const int blender::ed::asset::index::AssetIndex::CURRENT_VERSION = 1
static

Version to store in new index files.

Versions are written to each index file. When reading the version is checked against CURRENT_VERSION to make sure we can use the index. Developer should increase CURRENT_VERSION when changes are made to the structure of the stored index.

Definition at line 453 of file asset_indexer.cc.

Referenced by AssetIndex(), is_latest_version(), and blender::ed::asset::index::read_index().

◆ UNKNOWN_VERSION

const int blender::ed::asset::index::AssetIndex::UNKNOWN_VERSION = -1

Version number to use when version couldn't be read from an index file.

Definition at line 458 of file asset_indexer.cc.

Referenced by get_version().


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