房屋组件注册表(按 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 HouseComponent * | find (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.h 第 12 行定义.
成员函数说明
◆ byCategory()
| std::vector< const HouseComponent * > eve::housegen::HouseComponentLibrary::byCategory | ( | const std::string & | category, |
| const std::string & | style = {} |
||
| ) | const |
按分类(可选风格)查询组件。
在文件 HouseComponentLibrary.cpp 第 163 行定义.
引用了 a, b, byCategory() , 以及 c.
被这些函数引用 byCategory() , 以及 eve::housegen::HouseGenerator::generate().
◆ clear()
| void eve::housegen::HouseComponentLibrary::clear | ( | ) |
◆ count()
| int eve::housegen::HouseComponentLibrary::count | ( | ) | const |
组件总数。
在文件 HouseComponentLibrary.cpp 第 161 行定义.
◆ find()
| const HouseComponent * eve::housegen::HouseComponentLibrary::find | ( | const std::string & | id | ) | const |
按 id 查询组件。
在文件 HouseComponentLibrary.cpp 第 160 行定义.
被这些函数引用 eve::housegen::HouseLayout::instantiate() , 以及 eve::housegen::HouseLayout::validate().
◆ ids()
| std::vector< std::string > eve::housegen::HouseComponentLibrary::ids | ( | ) | const |
全部组件 id。
在文件 HouseComponentLibrary.cpp 第 162 行定义.
◆ loadFromFile()
| bool eve::housegen::HouseComponentLibrary::loadFromFile | ( | const std::string & | filename, |
| std::string * | error = nullptr |
||
| ) |
在文件 HouseComponentLibrary.cpp 第 139 行定义.
引用了 error, loadFromJson() , 以及 model.
◆ loadFromJson()
| bool eve::housegen::HouseComponentLibrary::loadFromJson | ( | const std::string & | json, |
| std::string * | error = nullptr |
||
| ) |
从 JSON / 文件加载组件。
在文件 HouseComponentLibrary.cpp 第 123 行定义.
引用了 c, error, eve::json::Document::parse(), registerComponent(), eve::json::Document::root(), eve::json::Document::valid() , 以及 values.
被这些函数引用 eve::housegen::HouseGen::loadComponentsFromJson() , 以及 loadFromFile().
◆ registerComponent()
| bool eve::housegen::HouseComponentLibrary::registerComponent | ( | const HouseComponent & | component, |
| std::string * | error = nullptr |
||
| ) |
该类的文档由以下文件生成:
- src/modules/housegen/HouseComponentLibrary.h
- src/modules/housegen/HouseComponentLibrary.cpp