implement ikarus_project_get_*_by_name functions

Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
Folling 2024-01-30 09:44:55 +01:00 committed by Folling
parent 0ace4243cf
commit 52dead0c06
No known key found for this signature in database
6 changed files with 80 additions and 19 deletions

View file

@ -96,15 +96,18 @@ name_is_unique(IkarusProject * project, std::string_view name, IkarusProperty co
return name_is_unique(project, name, scope.get(), error_out);
}
#define IKARUS_FAIL_IF_NAME_INVALID(name, project, object, ret, ...) \
IKARUS_FAIL_IF_NULL(name, ret); \
IKARUS_FAIL_IF(cppbase::is_empty_or_blank(name), ret, "name must not be empty", IkarusErrorInfo_Client_InvalidInput); \
IKARUS_FAIL_IF( \
!ikarus::util::name_is_unique(project, name, object, error_out), \
ret, \
"name must be unique", \
IkarusErrorInfo_Client_InvalidInput \
); \
#define IKARUS_FAIL_IF_NAME_INVALID(name, ret) \
IKARUS_FAIL_IF_NULL(name, ret); \
IKARUS_FAIL_IF(cppbase::is_empty_or_blank(name), ret, "name must not be empty", IkarusErrorInfo_Client_InvalidInput);
#define IKARUS_FAIL_IF_NAME_INVALID_OR_DUPLICATE(name, project, object, ret, ...) \
IKARUS_FAIL_IF_NAME_INVALID(name, ret); \
IKARUS_FAIL_IF( \
!ikarus::util::name_is_unique(project, name, object, error_out), \
ret, \
"name must be unique", \
IkarusErrorInfo_Client_InvalidInput \
); \
IKARUS_FAIL_IF_ERROR(ret);
template<typename O>
@ -112,7 +115,7 @@ void object_set_name(O * object, char const * name, IkarusErrorData * error_out)
IKARUS_FAIL_IF_NULL(object, );
IKARUS_FAIL_IF_OBJECT_MISSING(object, );
IKARUS_FAIL_IF_NULL(name, );
IKARUS_FAIL_IF_NAME_INVALID(name, object->project, object, );
IKARUS_FAIL_IF_NAME_INVALID_OR_DUPLICATE(name, object->project, object, );
IKARUS_TRYRV_OR_FAIL(
,