载入中...
搜索中...
未找到
eve::housegen::HouseComponentLibrary类 参考

房屋组件注册表(按 id 索引,支持分类/风格查询)。 更多...

#include <HouseComponentLibrary.h>

Public 成员函数

bool loadFromJson (const std::string &json, std::string *error=nullptr)
 从 JSON / 文件加载组件。
 
bool loadFromFile (const std::string &filename, std::string *error=nullptr)
 
bool registerComponent (const HouseComponent &component, std::string *error=nullptr)
 注册单个组件(id 重复会报错)。
 
void clear ()
 清空注册表。
 
const HouseComponentfind (const std::string &id) const
 按 id 查询组件。
 
std::vector< std::string > ids () const
 全部组件 id。
 
std::vector< const HouseComponent * > byCategory (const std::string &category, const std::string &style={}) const
 按分类(可选风格)查询组件。
 
int count () const
 组件总数。
 

详细描述

房屋组件注册表(按 id 索引,支持分类/风格查询)。

在文件 HouseComponentLibrary.h12 行定义.

成员函数说明

◆ byCategory()

std::vector< const HouseComponent * > eve::housegen::HouseComponentLibrary::byCategory ( const std::string &  category,
const std::string &  style = {} 
) const

按分类(可选风格)查询组件。

在文件 HouseComponentLibrary.cpp163 行定义.

引用了 a, b, byCategory() , 以及 c.

被这些函数引用 byCategory() , 以及 eve::housegen::HouseGenerator::generate().

◆ clear()

void eve::housegen::HouseComponentLibrary::clear ( )

清空注册表。

在文件 HouseComponentLibrary.cpp159 行定义.

被这些函数引用 eve::housegen::HouseGen::clearComponents().

◆ count()

int eve::housegen::HouseComponentLibrary::count ( ) const

组件总数。

在文件 HouseComponentLibrary.cpp161 行定义.

被这些函数引用 eve::housegen::HouseGen::getComponentCount().

◆ find()

const HouseComponent * eve::housegen::HouseComponentLibrary::find ( const std::string &  id) const

按 id 查询组件。

在文件 HouseComponentLibrary.cpp160 行定义.

被这些函数引用 eve::housegen::HouseLayout::instantiate() , 以及 eve::housegen::HouseLayout::validate().

◆ ids()

std::vector< std::string > eve::housegen::HouseComponentLibrary::ids ( ) const

全部组件 id。

在文件 HouseComponentLibrary.cpp162 行定义.

◆ loadFromFile()

bool eve::housegen::HouseComponentLibrary::loadFromFile ( const std::string &  filename,
std::string *  error = nullptr 
)

在文件 HouseComponentLibrary.cpp139 行定义.

引用了 error, loadFromJson() , 以及 model.

被这些函数引用 eve::housegen::HouseGen::loadComponentsFromFile().

◆ loadFromJson()

bool eve::housegen::HouseComponentLibrary::loadFromJson ( const std::string &  json,
std::string *  error = nullptr 
)

◆ registerComponent()

bool eve::housegen::HouseComponentLibrary::registerComponent ( const HouseComponent component,
std::string *  error = nullptr 
)

注册单个组件(id 重复会报错)。

在文件 HouseComponentLibrary.cpp88 行定义.

引用了 c, error , 以及 v.

被这些函数引用 loadFromJson().


该类的文档由以下文件生成: