Skip to content

Commit

Permalink
Make set_doc_* methods const
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderMertens committed Jun 22, 2024
1 parent feb3d84 commit 731c8f6
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 12 deletions.
10 changes: 5 additions & 5 deletions flecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -24459,7 +24459,7 @@ struct entity_builder : entity_view {
* @memberof flecs::entity_builder
* @ingroup cpp_addons_doc
*/
const Self& set_doc_name(const char *name) {
const Self& set_doc_name(const char *name) const {
ecs_doc_set_name(world_, id_, name);
return to_base();
}
Expand All @@ -24474,7 +24474,7 @@ const Self& set_doc_name(const char *name) {
* @memberof flecs::entity_builder
* @ingroup cpp_addons_doc
*/
const Self& set_doc_brief(const char *brief) {
const Self& set_doc_brief(const char *brief) const {
ecs_doc_set_brief(world_, id_, brief);
return to_base();
}
Expand All @@ -24489,7 +24489,7 @@ const Self& set_doc_brief(const char *brief) {
* @memberof flecs::entity_builder
* @ingroup cpp_addons_doc
*/
const Self& set_doc_detail(const char *detail) {
const Self& set_doc_detail(const char *detail) const {
ecs_doc_set_detail(world_, id_, detail);
return to_base();
}
Expand All @@ -24504,7 +24504,7 @@ const Self& set_doc_detail(const char *detail) {
* @memberof flecs::entity_builder
* @ingroup cpp_addons_doc
*/
const Self& set_doc_link(const char *link) {
const Self& set_doc_link(const char *link) const {
ecs_doc_set_link(world_, id_, link);
return to_base();
}
Expand All @@ -24519,7 +24519,7 @@ const Self& set_doc_link(const char *link) {
* @memberof flecs::entity_builder
* @ingroup cpp_addons_doc
*/
const Self& set_doc_color(const char *link) {
const Self& set_doc_color(const char *link) const {
ecs_doc_set_color(world_, id_, link);
return to_base();
}
Expand Down
10 changes: 5 additions & 5 deletions include/flecs/addons/cpp/mixins/doc/entity_builder.inl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @memberof flecs::entity_builder
* @ingroup cpp_addons_doc
*/
const Self& set_doc_name(const char *name) {
const Self& set_doc_name(const char *name) const {
ecs_doc_set_name(world_, id_, name);
return to_base();
}
Expand All @@ -28,7 +28,7 @@ const Self& set_doc_name(const char *name) {
* @memberof flecs::entity_builder
* @ingroup cpp_addons_doc
*/
const Self& set_doc_brief(const char *brief) {
const Self& set_doc_brief(const char *brief) const {
ecs_doc_set_brief(world_, id_, brief);
return to_base();
}
Expand All @@ -43,7 +43,7 @@ const Self& set_doc_brief(const char *brief) {
* @memberof flecs::entity_builder
* @ingroup cpp_addons_doc
*/
const Self& set_doc_detail(const char *detail) {
const Self& set_doc_detail(const char *detail) const {
ecs_doc_set_detail(world_, id_, detail);
return to_base();
}
Expand All @@ -58,7 +58,7 @@ const Self& set_doc_detail(const char *detail) {
* @memberof flecs::entity_builder
* @ingroup cpp_addons_doc
*/
const Self& set_doc_link(const char *link) {
const Self& set_doc_link(const char *link) const {
ecs_doc_set_link(world_, id_, link);
return to_base();
}
Expand All @@ -73,7 +73,7 @@ const Self& set_doc_link(const char *link) {
* @memberof flecs::entity_builder
* @ingroup cpp_addons_doc
*/
const Self& set_doc_color(const char *link) {
const Self& set_doc_color(const char *link) const {
ecs_doc_set_color(world_, id_, link);
return to_base();
}
3 changes: 2 additions & 1 deletion test/cpp/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@
"const_entity_get_mut",
"const_entity_ensure",
"const_entity_destruct",
"const_entity_emit_after_build"
"const_entity_emit_after_build",
"const_entity_set_doc"
]
}, {
"id": "Pairs",
Expand Down
18 changes: 18 additions & 0 deletions test/cpp/src/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4665,3 +4665,21 @@ void Entity_const_entity_emit_after_build(void) {

test_int(count, 1);
}

void Entity_const_entity_set_doc(void) {
flecs::world world;

const flecs::entity e = world.entity();

e.set_doc_name("name");
e.set_doc_color("color");
e.set_doc_detail("detail");
e.set_doc_brief("brief");
e.set_doc_link("link");

test_str(e.doc_name(), "name");
test_str(e.doc_color(), "color");
test_str(e.doc_detail(), "detail");
test_str(e.doc_brief(), "brief");
test_str(e.doc_link(), "link");
}
7 changes: 6 additions & 1 deletion test/cpp/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ void Entity_const_entity_get_mut(void);
void Entity_const_entity_ensure(void);
void Entity_const_entity_destruct(void);
void Entity_const_entity_emit_after_build(void);
void Entity_const_entity_set_doc(void);

// Testsuite 'Pairs'
void Pairs_add_component_pair(void);
Expand Down Expand Up @@ -2370,6 +2371,10 @@ bake_test_case Entity_testcases[] = {
{
"const_entity_emit_after_build",
Entity_const_entity_emit_after_build
},
{
"const_entity_set_doc",
Entity_const_entity_set_doc
}
};

Expand Down Expand Up @@ -6392,7 +6397,7 @@ static bake_test_suite suites[] = {
"Entity",
NULL,
NULL,
263,
264,
Entity_testcases
},
{
Expand Down

0 comments on commit 731c8f6

Please sign in to comment.