载入中...
搜索中...
未找到
HouseComponentLibrary.cpp
浏览该文件的文档.
24 eve::DiagnosticCode::InvalidArgument, "socket direction is invalid", "direction", {}, "housegen.components"));
48 eve::DiagnosticCode::ParseError, "socket must be an object", "sockets", {}, "housegen.components"));
58 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "socket needs a valid direction and type",
122 !inUnitRange(component.material.cellBombStrength) || !inUnitRange(component.material.cellBombRotation))
135 eve::DiagnosticCode::Conflict, "duplicate component id: " + component.id, "id", {}, "housegen.components"));
143 const eve::json::Document document = eve::json::Document::parse(std::string(json), &parseError);
146 eve::DiagnosticCode::ParseError, parseError.empty() ? "invalid component manifest" : parseError, {}, {},
153 eve::DiagnosticCode::ParseError, "expected components array", "components", {}, "housegen.components"));
171 eve::DiagnosticCode::NotFound, "cannot open component manifest: " + path, path, {}, "housegen.components"));
179 const std::filesystem::path assetRoot = std::filesystem::absolute(std::filesystem::path(path)).parent_path();
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
房屋组件注册表(按 id 索引,支持分类/风格查询)。
Definition HouseComponentLibrary.h:18
eve::Result< void > loadFromJson(std::string_view json)
从 JSON / 文件加载组件。
Definition HouseComponentLibrary.cpp:141
std::vector< std::string > completePacks() const
所有能构成完整组件包(五个核心分类齐全)的风格标签。
Definition HouseComponentLibrary.cpp:236
eve::Result< void > loadFromFile(std::string_view filename)
Definition HouseComponentLibrary.cpp:166
eve::OptionalRef< const HouseComponent > find(std::string_view id) const
按 id 查询组件;缺失是正常查询结果。
Definition HouseComponentLibrary.cpp:190
std::vector< std::reference_wrapper< const HouseComponent > > byCategory(std::string_view category, std::string_view style={}) const
按分类(可选风格)查询组件。
Definition HouseComponentLibrary.cpp:206
eve::Result< void > registerComponent(const HouseComponent &component)
注册单个组件(id 重复会报错)。
Definition HouseComponentLibrary.cpp:100
bool hasCompletePack(std::string_view style) const
报告一个风格是否构成完整组件包。
Definition HouseComponentLibrary.cpp:220
static Document parse(const std::string &text, std::string *error=nullptr)
Parse.
Definition Json.cpp:581
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:26
Definition HouseGenTarget.h:15
@ InvalidArgument
@ NotFound
@ ParseError
@ Conflict
@ Applied
std::optional< std::reference_wrapper< T > > OptionalRef
Optional borrowed reference; it does not extend T's lifetime.
Definition BorrowedRef.h:24
float parallaxMaxLayers
Definition HouseGenTypes.h:35
float cellBombStrength
Definition HouseGenTypes.h:37
float parallaxMinLayers
Definition HouseGenTypes.h:34
float cellBombRotation
Definition HouseGenTypes.h:38