Blender  V3.3
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
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. More...
 

Detailed Description

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

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

Definition at line 536 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 564 of file asset_indexer.cc.

References blender::ed::asset::index::ATTRIBUTE_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 578 of file asset_indexer.cc.

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 606 of file asset_indexer.cc.

References blender::io::serialize::Value::as_dictionary_value(), and 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 596 of file asset_indexer.cc.

Member Data Documentation

◆ contents

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

blender::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 558 of file asset_indexer.cc.

Referenced by 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 544 of file asset_indexer.cc.

Referenced by 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 549 of file asset_indexer.cc.


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