载入中...
搜索中...
未找到
eve::economy::ResourceTypeRegistry类 参考

资源类型注册表:注册 / 查询 / 清理。 更多...

#include <ResourceType.h>

静态 Public 成员函数

static bool registerType (const ResourceTypeDef &def)
 注册或替换一个资源类型定义。
 
static const ResourceTypeDef * find (const std::string &id)
 按 id 查询;未注册时返回 nullptr。
 
static int count ()
 已注册类型数量。
 
static const ResourceTypeDef * typeAt (int index)
 按 id 字典序返回第 index 个类型定义。
 
static void clear ()
 清空注册表(测试用)。
 

详细描述

资源类型注册表:注册 / 查询 / 清理。

在文件 ResourceType.h 第 32 行定义.

成员函数说明

◆ clear()

void eve::economy::ResourceTypeRegistry::clear ( )
static

清空注册表(测试用)。

在文件 ResourceType.cpp 第 37 行定义.

被这些函数引用 eve::economy::Economy::clearTypes().

◆ count()

int eve::economy::ResourceTypeRegistry::count ( )
static

已注册类型数量。

在文件 ResourceType.cpp 第 25 行定义.

被这些函数引用 eve::economy::Economy::typeCount().

◆ find()

const ResourceTypeDef * eve::economy::ResourceTypeRegistry::find ( const std::string &  id)
static

◆ registerType()

bool eve::economy::ResourceTypeRegistry::registerType ( const ResourceTypeDef &  def)
static

注册或替换一个资源类型定义。

返回
false 当 id 为空。

在文件 ResourceType.cpp 第 13 行定义.

引用了 eve::economy::ResourceTypeDef::id.

被这些函数引用 eve::economy::Economy::registerResourceType().

◆ typeAt()

const ResourceTypeDef * eve::economy::ResourceTypeRegistry::typeAt ( int  index)
static

按 id 字典序返回第 index 个类型定义。

参数
index从 0 开始的序号。
返回
借用注册表内的定义,越界返回 nullptr;顺序稳定(便于观察与脚本遍历)。 @lifetime The returned pointer is borrowed from the registry: it stays valid until the next registerType/clear call on that registry.

在文件 ResourceType.cpp 第 27 行定义.

引用了 find(), ids, index, left, right , 以及 size.

被这些函数引用 eve::economy::Economy::getTypeId().


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