From 1066e0dc1dea443c95f3b8ec60f3b4fe9af0b021 Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Mon, 9 Feb 2026 15:17:49 +0530 Subject: [PATCH 01/16] clang-mirror generated IDs in place. --- CxxTestRegistration/inc/TestMirrorProvider.h | 13 +- CxxTestRegistration/inc/reg_decls.h | 96 ++ CxxTestRegistration/inc/reg_ids.h | 895 ++++++++++++++++++ .../src/AnimalRegistration.cpp | 73 -- CxxTestRegistration/src/BookRegistration.cpp | 65 -- CxxTestRegistration/src/CMakeLists.txt | 34 +- .../src/CalenderRegistration.cpp | 45 - .../src/ComplexRegistration.cpp | 30 - CxxTestRegistration/src/DateRegistration.cpp | 44 - CxxTestRegistration/src/EventRegistration.cpp | 28 - .../src/LibraryRegistration.cpp | 35 - .../src/PersonRegistration.cpp | 77 -- .../src/PodStdRegistration.cpp | 70 -- .../src/StrConstOverloadRegistration.cpp | 33 - .../src/StrConstRegistration.cpp | 101 -- .../src/StrFuncsRegistration.cpp | 76 -- .../src/StrMuteRegistration.cpp | 102 -- .../src/StrStaticRegistration.cpp | 101 -- .../src/StrWrapRegistration.cpp | 74 -- .../src/TestMirrorProvider.cpp | 212 +++-- CxxTestRegistration/src/regs0_Animal.cpp | 58 ++ CxxTestRegistration/src/regs10_Complex.cpp | 25 + .../src/regs11_StringConst.cpp | 84 ++ CxxTestRegistration/src/regs1_Date.cpp | 96 ++ CxxTestRegistration/src/regs2_Book.cpp | 59 ++ CxxTestRegistration/src/regs3_Person.cpp | 75 ++ CxxTestRegistration/src/regs4_StringMute.cpp | 84 ++ .../src/regs5_StringStatic.cpp | 84 ++ .../src/regs6_StringConstOverload.cpp | 24 + CxxTestRegistration/src/regs7_StringOps.cpp | 64 ++ CxxTestRegistration/src/regs8_StringWrap.cpp | 86 ++ CxxTestRegistration/src/regs9_Library.cpp | 33 + CxxTestUtils/inc/GlobalTestUtils.h | 2 +- .../FunctionalityTests/ClassMethodsTests.cpp | 51 +- .../ConstMethodOverloadTests.cpp | 2 +- .../FunctionalityTests/ConstructorTests.cpp | 2 +- .../CopyConstructorTests.cpp | 2 +- .../MoveConstructorTests.cpp | 2 +- .../NameSpaceGlobalsTests.cpp | 2 +- .../PerfectForwardingTests.cpp | 2 +- .../ReflectionOpErrorCodeTests.cpp | 2 +- .../ReturnValueReflectionTest.cpp | 2 +- .../FunctionalityTests/StaticMethodTests.cpp | 2 +- .../TypeAware_ConstMethod.cpp | 6 +- .../TypeAware_Function.cpp | 2 +- .../TypeAware_Method.cpp | 2 +- .../TypeAware_StaticMethod.cpp | 2 +- .../ReturnAndTargetErased_ConstMethod.cpp | 2 +- .../ReturnErased_Constructor.cpp | 2 +- .../ReturnErased_Function.cpp | 2 +- .../ReturnErased_Method.cpp | 2 +- .../ReturnErased_StaticMethod.cpp | 2 +- .../rtl/detail/src/CxxReflection.cpp | 2 +- ReflectionTemplateLib/rtl/inc/CxxMirror.h | 4 +- ReflectionTemplateLib/rtl/inc/Record.h | 4 +- ReflectionTemplateLib/rtl/src/CxxMirror.cpp | 8 +- 56 files changed, 1987 insertions(+), 1100 deletions(-) create mode 100644 CxxTestRegistration/inc/reg_decls.h create mode 100644 CxxTestRegistration/inc/reg_ids.h delete mode 100644 CxxTestRegistration/src/AnimalRegistration.cpp delete mode 100644 CxxTestRegistration/src/BookRegistration.cpp delete mode 100644 CxxTestRegistration/src/CalenderRegistration.cpp delete mode 100644 CxxTestRegistration/src/ComplexRegistration.cpp delete mode 100644 CxxTestRegistration/src/DateRegistration.cpp delete mode 100644 CxxTestRegistration/src/EventRegistration.cpp delete mode 100644 CxxTestRegistration/src/LibraryRegistration.cpp delete mode 100644 CxxTestRegistration/src/PersonRegistration.cpp delete mode 100644 CxxTestRegistration/src/PodStdRegistration.cpp delete mode 100644 CxxTestRegistration/src/StrConstOverloadRegistration.cpp delete mode 100644 CxxTestRegistration/src/StrConstRegistration.cpp delete mode 100644 CxxTestRegistration/src/StrFuncsRegistration.cpp delete mode 100644 CxxTestRegistration/src/StrMuteRegistration.cpp delete mode 100644 CxxTestRegistration/src/StrStaticRegistration.cpp delete mode 100644 CxxTestRegistration/src/StrWrapRegistration.cpp create mode 100644 CxxTestRegistration/src/regs0_Animal.cpp create mode 100644 CxxTestRegistration/src/regs10_Complex.cpp create mode 100644 CxxTestRegistration/src/regs11_StringConst.cpp create mode 100644 CxxTestRegistration/src/regs1_Date.cpp create mode 100644 CxxTestRegistration/src/regs2_Book.cpp create mode 100644 CxxTestRegistration/src/regs3_Person.cpp create mode 100644 CxxTestRegistration/src/regs4_StringMute.cpp create mode 100644 CxxTestRegistration/src/regs5_StringStatic.cpp create mode 100644 CxxTestRegistration/src/regs6_StringConstOverload.cpp create mode 100644 CxxTestRegistration/src/regs7_StringOps.cpp create mode 100644 CxxTestRegistration/src/regs8_StringWrap.cpp create mode 100644 CxxTestRegistration/src/regs9_Library.cpp diff --git a/CxxTestRegistration/inc/TestMirrorProvider.h b/CxxTestRegistration/inc/TestMirrorProvider.h index f908b031..2353ff4a 100644 --- a/CxxTestRegistration/inc/TestMirrorProvider.h +++ b/CxxTestRegistration/inc/TestMirrorProvider.h @@ -2,16 +2,15 @@ #include +#include "reg_ids.h" + namespace rtl { class CxxMirror; } -namespace test_mirror -{ - struct cxx { +namespace cxx { - static const rtl::CxxMirror& mirror(); + const rtl::CxxMirror& mirror(); - static const rtl::traits::uid_t reflected_id(const std::string& pRecordName); - }; -} \ No newline at end of file + const rtl::traits::uid_t reflected_id(const std::string& pRecordName); +}; diff --git a/CxxTestRegistration/inc/reg_decls.h b/CxxTestRegistration/inc/reg_decls.h new file mode 100644 index 00000000..009dbcbe --- /dev/null +++ b/CxxTestRegistration/inc/reg_decls.h @@ -0,0 +1,96 @@ + +#pragma once +#include + +#include "rtl_builder.h" + + +namespace regs7::fn { + void init(std::vector&); +} + + +namespace regs10::fn { + void init(std::vector&); +} + + +namespace regs1::type0 { + void init(std::vector&); +} + + +namespace regs1::type1 { + void init(std::vector&); +} + + +namespace regs1::type2 { + void init(std::vector&); +} + + +namespace regs0::type0 { + void init(std::vector&); +} + + +namespace regs3::type0 { + void init(std::vector&); +} + + +namespace regs2::type0 { + void init(std::vector&); +} + + +namespace regs4::type0 { + void init(std::vector&); +} + + +namespace regs5::type0 { + void init(std::vector&); +} + + +namespace regs6::type0 { + void init(std::vector&); +} + + +namespace regs8::type0 { + void init(std::vector&); +} + + +namespace regs8::type1 { + void init(std::vector&); +} + + +namespace regs8::type2 { + void init(std::vector&); +} + + +namespace regs8::type3 { + void init(std::vector&); +} + + +namespace regs8::type4 { + void init(std::vector&); +} + + +namespace regs9::type0 { + void init(std::vector&); +} + + +namespace regs11::type0 { + void init(std::vector&); +} + diff --git a/CxxTestRegistration/inc/reg_ids.h b/CxxTestRegistration/inc/reg_ids.h new file mode 100644 index 00000000..18513f3b --- /dev/null +++ b/CxxTestRegistration/inc/reg_ids.h @@ -0,0 +1,895 @@ + +#pragma once +#include +#include + +namespace cxx { + +namespace fn { +namespace revStrOverloadValCRef { + inline constexpr std::string_view id = "revStrOverloadValCRef"; + inline constexpr std::array signatures = { + "std::string(std::string_view)", + "std::string(const std::string_view &)" + }; +}} + +namespace fn { +namespace reverseString { + inline constexpr std::string_view id = "reverseString"; + inline constexpr std::array signatures = { + "std::string(void)", + "std::string(const char *)", + "std::string(std::string)", + "std::string(std::string &)", + "std::string(std::string &&)", + "std::string(const std::string &)", + "std::string(std::string *)", + "std::string(const std::string *)" + }; +}} + +namespace fn { +namespace revStrConstRefArg { + inline constexpr std::string_view id = "revStrConstRefArg"; + inline constexpr std::array signatures = { + "std::string(const std::string_view &)" + }; +}} + +namespace fn { +namespace revStrRValueRefArg { + inline constexpr std::string_view id = "revStrRValueRefArg"; + inline constexpr std::array signatures = { + "std::string(std::string_view &&)" + }; +}} + +namespace fn { +namespace revStrNonConstRefArg { + inline constexpr std::string_view id = "revStrNonConstRefArg"; + inline constexpr std::array signatures = { + "std::string(std::string_view &)" + }; +}} + +namespace fn { +namespace revStrOverloadRefAndCRef { + inline constexpr std::string_view id = "revStrOverloadRefAndCRef"; + inline constexpr std::array signatures = { + "std::string(std::string_view &)", + "std::string(const std::string_view &)" + }; +}} + +namespace fn { +namespace revStrOverloadValRef { + inline constexpr std::string_view id = "revStrOverloadValRef"; + inline constexpr std::array signatures = { + "std::string(std::string_view)", + "std::string(std::string_view &)" + }; +}} + +namespace fn { +namespace complex { +namespace getMagnitude { + inline constexpr std::string_view id = "complex::getMagnitude"; + inline constexpr std::array signatures = { + "double(void)" + }; +}}} + +namespace fn { +namespace complex { +namespace setReal { + inline constexpr std::string_view id = "complex::setReal"; + inline constexpr std::array signatures = { + "void(double)" + }; +}}} + +namespace fn { +namespace complex { +namespace setImaginary { + inline constexpr std::string_view id = "complex::setImaginary"; + inline constexpr std::array signatures = { + "void(double)" + }; +}}} + +namespace fn { +namespace getComplexNumAsString { + inline constexpr std::string_view id = "getComplexNumAsString"; + inline constexpr std::array signatures = { + "std::string(void)" + }; +}} + +namespace type { +namespace nsdate { +namespace Calender { + inline constexpr std::string_view id = "nsdate::Calender"; +}}} + +namespace type { +namespace nsdate { +namespace Calender { +namespace fn { +namespace resetMoveOpsCounter { + inline constexpr std::string_view id = "resetMoveOpsCounter"; + inline constexpr std::array signatures = { + "void(void)" + }; +}}}}} + +namespace type { +namespace nsdate { +namespace Calender { +namespace fn { +namespace getMoveOpsCount { + inline constexpr std::string_view id = "getMoveOpsCount"; + inline constexpr std::array signatures = { + "unsigned long long(void)" + }; +}}}}} + +namespace type { +namespace nsdate { +namespace Calender { +namespace fn { +namespace create { + inline constexpr std::string_view id = "create"; + inline constexpr std::array signatures = { + "nsdate::Calender(void)" + }; +}}}}} + +namespace type { +namespace nsdate { +namespace Calender { +namespace fn { +namespace getSavedDate { + inline constexpr std::string_view id = "getSavedDate"; + inline constexpr std::array signatures = { + "nsdate::Date &(void)" + }; +}}}}} + +namespace type { +namespace nsdate { +namespace Calender { +namespace fn { +namespace getTheDate { + inline constexpr std::string_view id = "getTheDate"; + inline constexpr std::array signatures = { + "nsdate::Date &(void)" + }; +}}}}} + +namespace type { +namespace nsdate { +namespace Calender { +namespace fn { +namespace getSavedEvent { + inline constexpr std::string_view id = "getSavedEvent"; + inline constexpr std::array signatures = { + "const nsdate::Event &(void)" + }; +}}}}} + +namespace type { +namespace nsdate { +namespace Calender { +namespace fn { +namespace getTheEvent { + inline constexpr std::string_view id = "getTheEvent"; + inline constexpr std::array signatures = { + "const nsdate::Event &(void)" + }; +}}}}} + +namespace type { +namespace nsdate { +namespace Calender { +namespace fn { +namespace instanceCount { + inline constexpr std::string_view id = "instanceCount"; + inline constexpr std::array signatures = { + "unsigned long long(void)" + }; +}}}}} + + +namespace type { +namespace nsdate { +namespace Date { + inline constexpr std::string_view id = "nsdate::Date"; +}}} + +namespace type { +namespace nsdate { +namespace Date { +namespace fn { +namespace instanceCount { + inline constexpr std::string_view id = "instanceCount"; + inline constexpr std::array signatures = { + "unsigned long long(void)" + }; +}}}}} + +namespace type { +namespace nsdate { +namespace Date { +namespace fn { +namespace getAsString { + inline constexpr std::string_view id = "getAsString"; + inline constexpr std::array signatures = { + "std::string(void)" + }; +}}}}} + +namespace type { +namespace nsdate { +namespace Date { +namespace fn { +namespace updateDate { + inline constexpr std::string_view id = "updateDate"; + inline constexpr std::array signatures = { + "void(std::string)" + }; +}}}}} + + +namespace type { +namespace nsdate { +namespace Event { + inline constexpr std::string_view id = "nsdate::Event"; +}}} + +namespace type { +namespace nsdate { +namespace Event { +namespace fn { +namespace instanceCount { + inline constexpr std::string_view id = "instanceCount"; + inline constexpr std::array signatures = { + "unsigned long long(void)" + }; +}}}}} + +namespace type { +namespace nsdate { +namespace Event { +namespace fn { +namespace getEventDate { + inline constexpr std::string_view id = "getEventDate"; + inline constexpr std::array signatures = { + "const nsdate::Date &(void)" + }; +}}}}} + +namespace type { +namespace nsdate { +namespace Event { +namespace fn { +namespace reset { + inline constexpr std::string_view id = "reset"; + inline constexpr std::array signatures = { + "void(void)" + }; +}}}}} + + +namespace type { +namespace Animal { + inline constexpr std::string_view id = "Animal"; +}} + +namespace type { +namespace Animal { +namespace fn { +namespace getFamilyName { + inline constexpr std::string_view id = "getFamilyName"; + inline constexpr std::array signatures = { + "std::string(void)" + }; +}}}} + +namespace type { +namespace Animal { +namespace fn { +namespace setAnimalName { + inline constexpr std::string_view id = "setAnimalName"; + inline constexpr std::array signatures = { + "void(std::string &)", + "void(std::string &&)", + "void(const std::string &)", + "void(const std::string &)" + }; +}}}} + +namespace type { +namespace Animal { +namespace fn { +namespace setFamilyName { + inline constexpr std::string_view id = "setFamilyName"; + inline constexpr std::array signatures = { + "void(const std::string)" + }; +}}}} + +namespace type { +namespace Animal { +namespace fn { +namespace getInstanceCount { + inline constexpr std::string_view id = "getInstanceCount"; + inline constexpr std::array signatures = { + "unsigned int(void)" + }; +}}}} + +namespace type { +namespace Animal { +namespace fn { +namespace updateZooKeeper { + inline constexpr std::string_view id = "updateZooKeeper"; + inline constexpr std::array signatures = { + "std::string(std::string &)", + "std::string(std::string &&)", + "std::string(const std::string &)" + }; +}}}} + + +namespace type { +namespace Person { + inline constexpr std::string_view id = "Person"; +}} + +namespace type { +namespace Person { +namespace fn { +namespace getInstanceCount { + inline constexpr std::string_view id = "getInstanceCount"; + inline constexpr std::array signatures = { + "unsigned int(void)" + }; +}}}} + +namespace type { +namespace Person { +namespace fn { +namespace createConst { + inline constexpr std::string_view id = "createConst"; + inline constexpr std::array signatures = { + "const Person(void)" + }; +}}}} + +namespace type { +namespace Person { +namespace fn { +namespace updateAddress { + inline constexpr std::string_view id = "updateAddress"; + inline constexpr std::array signatures = { + "void(void)", + "void(void)", + "void(std::string)", + "void(std::string)" + }; +}}}} + +namespace type { +namespace Person { +namespace fn { +namespace getProfile { + inline constexpr std::string_view id = "getProfile"; + inline constexpr std::array signatures = { + "std::string(void)", + "std::string(std::string, unsigned long long)", + "std::string(bool)" + }; +}}}} + +namespace type { +namespace Person { +namespace fn { +namespace getFirstName { + inline constexpr std::string_view id = "getFirstName"; + inline constexpr std::array signatures = { + "std::string(void)" + }; +}}}} + +namespace type { +namespace Person { +namespace fn { +namespace createPtr { + inline constexpr std::string_view id = "createPtr"; + inline constexpr std::array signatures = { + "const Person *(void)" + }; +}}}} + +namespace type { +namespace Person { +namespace fn { +namespace getDefaults { + inline constexpr std::string_view id = "getDefaults"; + inline constexpr std::array signatures = { + "std::string(void)" + }; +}}}} + +namespace type { +namespace Person { +namespace fn { +namespace deletePtr { + inline constexpr std::string_view id = "deletePtr"; + inline constexpr std::array signatures = { + "void(const Person *)" + }; +}}}} + +namespace type { +namespace Person { +namespace fn { +namespace updateLastName { + inline constexpr std::string_view id = "updateLastName"; + inline constexpr std::array signatures = { + "void(std::string)" + }; +}}}} + + +namespace type { +namespace Book { + inline constexpr std::string_view id = "Book"; +}} + +namespace type { +namespace Book { +namespace fn { +namespace setAuthor { + inline constexpr std::string_view id = "setAuthor"; + inline constexpr std::array signatures = { + "void(std::string)" + }; +}}}} + +namespace type { +namespace Book { +namespace fn { +namespace getTitle { + inline constexpr std::string_view id = "getTitle"; + inline constexpr std::array signatures = { + "std::string(void)" + }; +}}}} + +namespace type { +namespace Book { +namespace fn { +namespace addCopyrightTag { + inline constexpr std::string_view id = "addCopyrightTag"; + inline constexpr std::array signatures = { + "void(const std::string)" + }; +}}}} + +namespace type { +namespace Book { +namespace fn { +namespace setDescription { + inline constexpr std::string_view id = "setDescription"; + inline constexpr std::array signatures = { + "void(std::string)" + }; +}}}} + +namespace type { +namespace Book { +namespace fn { +namespace getPublishedOn { + inline constexpr std::string_view id = "getPublishedOn"; + inline constexpr std::array signatures = { + "std::string(void)" + }; +}}}} + +namespace type { +namespace Book { +namespace fn { +namespace getInstanceCount { + inline constexpr std::string_view id = "getInstanceCount"; + inline constexpr std::array signatures = { + "int(void)" + }; +}}}} + +namespace type { +namespace Book { +namespace fn { +namespace updateBookInfo { + inline constexpr std::string_view id = "updateBookInfo"; + inline constexpr std::array signatures = { + "void(void)", + "void(const char *, double, std::string)", + "void(std::string, double, const char *)" + }; +}}}} + +namespace type { +namespace Book { +namespace fn { +namespace addPreface { + inline constexpr std::string_view id = "addPreface"; + inline constexpr std::array signatures = { + "void(const std::string, const std::string &)" + }; +}}}} + + +namespace type { +namespace StrMute { + inline constexpr std::string_view id = "StrMute"; +}} + +namespace type { +namespace StrMute { +namespace fn { +namespace revStrOverloadValCRef { + inline constexpr std::string_view id = "revStrOverloadValCRef"; + inline constexpr std::array signatures = { + "std::string(std::string_view)", + "std::string(const std::string_view &)" + }; +}}}} + +namespace type { +namespace StrMute { +namespace fn { +namespace reverseString { + inline constexpr std::string_view id = "reverseString"; + inline constexpr std::array signatures = { + "std::string(void)", + "std::string(const char *)", + "std::string(std::string)", + "std::string(std::string &)", + "std::string(std::string &&)", + "std::string(const std::string &)", + "std::string(std::string *)", + "std::string(const std::string *)" + }; +}}}} + +namespace type { +namespace StrMute { +namespace fn { +namespace revStrConstRefArg { + inline constexpr std::string_view id = "revStrConstRefArg"; + inline constexpr std::array signatures = { + "std::string(const std::string_view &)" + }; +}}}} + +namespace type { +namespace StrMute { +namespace fn { +namespace revStrRValueRefArg { + inline constexpr std::string_view id = "revStrRValueRefArg"; + inline constexpr std::array signatures = { + "std::string(std::string_view &&)" + }; +}}}} + +namespace type { +namespace StrMute { +namespace fn { +namespace revStrNonConstRefArg { + inline constexpr std::string_view id = "revStrNonConstRefArg"; + inline constexpr std::array signatures = { + "std::string(std::string_view &)" + }; +}}}} + +namespace type { +namespace StrMute { +namespace fn { +namespace revStrOverloadRefAndCRef { + inline constexpr std::string_view id = "revStrOverloadRefAndCRef"; + inline constexpr std::array signatures = { + "std::string(std::string_view &)", + "std::string(const std::string_view &)" + }; +}}}} + +namespace type { +namespace StrMute { +namespace fn { +namespace revStrOverloadValRef { + inline constexpr std::string_view id = "revStrOverloadValRef"; + inline constexpr std::array signatures = { + "std::string(std::string_view)", + "std::string(std::string_view &)" + }; +}}}} + + +namespace type { +namespace StrStatic { + inline constexpr std::string_view id = "StrStatic"; +}} + +namespace type { +namespace StrStatic { +namespace fn { +namespace revStrOverloadValCRef { + inline constexpr std::string_view id = "revStrOverloadValCRef"; + inline constexpr std::array signatures = { + "std::string(std::string_view)", + "std::string(const std::string_view &)" + }; +}}}} + +namespace type { +namespace StrStatic { +namespace fn { +namespace reverseString { + inline constexpr std::string_view id = "reverseString"; + inline constexpr std::array signatures = { + "std::string(void)", + "std::string(const char *)", + "std::string(std::string)", + "std::string(std::string &)", + "std::string(std::string &&)", + "std::string(const std::string &)", + "std::string(std::string *)", + "std::string(const std::string *)" + }; +}}}} + +namespace type { +namespace StrStatic { +namespace fn { +namespace revStrConstRefArg { + inline constexpr std::string_view id = "revStrConstRefArg"; + inline constexpr std::array signatures = { + "std::string(const std::string_view &)" + }; +}}}} + +namespace type { +namespace StrStatic { +namespace fn { +namespace revStrRValueRefArg { + inline constexpr std::string_view id = "revStrRValueRefArg"; + inline constexpr std::array signatures = { + "std::string(std::string_view &&)" + }; +}}}} + +namespace type { +namespace StrStatic { +namespace fn { +namespace revStrNonConstRefArg { + inline constexpr std::string_view id = "revStrNonConstRefArg"; + inline constexpr std::array signatures = { + "std::string(std::string_view &)" + }; +}}}} + +namespace type { +namespace StrStatic { +namespace fn { +namespace revStrOverloadRefAndCRef { + inline constexpr std::string_view id = "revStrOverloadRefAndCRef"; + inline constexpr std::array signatures = { + "std::string(std::string_view &)", + "std::string(const std::string_view &)" + }; +}}}} + +namespace type { +namespace StrStatic { +namespace fn { +namespace revStrOverloadValRef { + inline constexpr std::string_view id = "revStrOverloadValRef"; + inline constexpr std::array signatures = { + "std::string(std::string_view)", + "std::string(std::string_view &)" + }; +}}}} + + +namespace type { +namespace StrConstOverload { + inline constexpr std::string_view id = "StrConstOverload"; +}} + +namespace type { +namespace StrConstOverload { +namespace fn { +namespace reverseString { + inline constexpr std::string_view id = "reverseString"; + inline constexpr std::array signatures = { + "std::string(void)", + "std::string(void)" + }; +}}}} + + +namespace type { +namespace StrWrap { + inline constexpr std::string_view id = "StrWrap"; +}} + +namespace type { +namespace StrWrap { +namespace fn { +namespace sstr { + inline constexpr std::string_view id = "sstr"; + inline constexpr std::array signatures = { + "const std::string &(void)" + }; +}}}} + + +namespace type { +namespace StrWrapA { + inline constexpr std::string_view id = "StrWrapA"; +}} + + +namespace type { +namespace StrWrapB { + inline constexpr std::string_view id = "StrWrapB"; +}} + + +namespace type { +namespace StrWrapC { + inline constexpr std::string_view id = "StrWrapC"; +}} + + +namespace type { +namespace StrWrapD { + inline constexpr std::string_view id = "StrWrapD"; +}} + + +namespace type { +namespace Library { + inline constexpr std::string_view id = "Library"; +}} + +namespace type { +namespace Library { +namespace fn { +namespace getBookByTitle { + inline constexpr std::string_view id = "getBookByTitle"; + inline constexpr std::array signatures = { + "Book(const std::string &)" + }; +}}}} + +namespace type { +namespace Library { +namespace fn { +namespace getInstanceCount { + inline constexpr std::string_view id = "getInstanceCount"; + inline constexpr std::array signatures = { + "unsigned long long(void)" + }; +}}}} + +namespace type { +namespace Library { +namespace fn { +namespace getBooksCount { + inline constexpr std::string_view id = "getBooksCount"; + inline constexpr std::array signatures = { + "int(void)" + }; +}}}} + +namespace type { +namespace Library { +namespace fn { +namespace addBook { + inline constexpr std::string_view id = "addBook"; + inline constexpr std::array signatures = { + "void(const Book &)" + }; +}}}} + + +namespace type { +namespace StrConst { + inline constexpr std::string_view id = "StrConst"; +}} + +namespace type { +namespace StrConst { +namespace fn { +namespace revStrOverloadValCRef { + inline constexpr std::string_view id = "revStrOverloadValCRef"; + inline constexpr std::array signatures = { + "std::string(std::string_view)", + "std::string(const std::string_view &)" + }; +}}}} + +namespace type { +namespace StrConst { +namespace fn { +namespace reverseString { + inline constexpr std::string_view id = "reverseString"; + inline constexpr std::array signatures = { + "std::string(void)", + "std::string(const char *)", + "std::string(std::string)", + "std::string(std::string &)", + "std::string(std::string &&)", + "std::string(const std::string &)", + "std::string(std::string *)", + "std::string(const std::string *)" + }; +}}}} + +namespace type { +namespace StrConst { +namespace fn { +namespace revStrConstRefArg { + inline constexpr std::string_view id = "revStrConstRefArg"; + inline constexpr std::array signatures = { + "std::string(const std::string_view &)" + }; +}}}} + +namespace type { +namespace StrConst { +namespace fn { +namespace revStrRValueRefArg { + inline constexpr std::string_view id = "revStrRValueRefArg"; + inline constexpr std::array signatures = { + "std::string(std::string_view &&)" + }; +}}}} + +namespace type { +namespace StrConst { +namespace fn { +namespace revStrNonConstRefArg { + inline constexpr std::string_view id = "revStrNonConstRefArg"; + inline constexpr std::array signatures = { + "std::string(std::string_view &)" + }; +}}}} + +namespace type { +namespace StrConst { +namespace fn { +namespace revStrOverloadRefAndCRef { + inline constexpr std::string_view id = "revStrOverloadRefAndCRef"; + inline constexpr std::array signatures = { + "std::string(std::string_view &)", + "std::string(const std::string_view &)" + }; +}}}} + +namespace type { +namespace StrConst { +namespace fn { +namespace revStrOverloadValRef { + inline constexpr std::string_view id = "revStrOverloadValRef"; + inline constexpr std::array signatures = { + "std::string(std::string_view)", + "std::string(std::string_view &)" + }; +}}}} + + +} \ No newline at end of file diff --git a/CxxTestRegistration/src/AnimalRegistration.cpp b/CxxTestRegistration/src/AnimalRegistration.cpp deleted file mode 100644 index 91342bff..00000000 --- a/CxxTestRegistration/src/AnimalRegistration.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -#include - -#include "Animal.h" -#include "Registration.h" -#include "TestUtilsAnimal.h" - -using namespace test_utils; - -namespace test_mirror -{ - void Register::typeIdAnimal(std::unordered_map& id) - { - id.insert(std::make_pair(animal::class_, rtl::traits::uid::value)); - } - - void Register::typeAnimal(std::vector& fns) - { - // class 'Animal', methods & constructors. - fns.push_back(rtl::type().record(animal::class_) - .build()); - - fns.push_back(rtl::type().member() - .constructor() - .build()); //overloaded constructor. - - fns.push_back(rtl::type().member() - .method(animal::str_setFamilyName) - .build(&Animal::setFamilyName)); //unique method, no overloads. - - // Unique const-method, no overloads. - fns.push_back(rtl::type().member() - .methodConst(animal::str_getFamilyName) - .build(&Animal::getFamilyName)); - - // Overloaded method, taking const-ref as argument. - fns.push_back(rtl::type().member() - .method(animal::str_setAnimalName) - .build(&Animal::setAnimalName)); - - // Overloaded const-method, taking const-ref as argument. - fns.push_back(rtl::type().member() - .methodConst(animal::str_setAnimalName) - .build(&Animal::setAnimalName)); - - // Static method, taking const-ref as argument. - fns.push_back(rtl::type().member() - .methodStatic(animal::str_updateZooKeeper) - .build(&Animal::updateZooKeeper)); -/* - GCC here fails to automatically resolve the correct overloaded functor - when both a lvalue reference and an rvalue overload exist. - To disambiguate, explicitly cast the member function pointer, e.g.: - - static_cast(&Animal::setAnimalName) -*/ - fns.push_back(rtl::type().member() - .method(animal::str_setAnimalName) - .build(static_cast(&Animal::setAnimalName))); //overloaded method, taking non-const lvalue reference as argument. - - fns.push_back(rtl::type().member() - .method(animal::str_setAnimalName) - .build(static_cast(&Animal::setAnimalName))); //overloaded method, taking rvalue reference as argument. - - fns.push_back(rtl::type().member() - .methodStatic(animal::str_updateZooKeeper) - .build(static_cast(&Animal::updateZooKeeper))); //static method, taking non-const lvalue reference as argument. - - fns.push_back(rtl::type().member() - .methodStatic(animal::str_updateZooKeeper) - .build(static_cast(&Animal::updateZooKeeper))); //static method, taking rvalue reference as argument. - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/BookRegistration.cpp b/CxxTestRegistration/src/BookRegistration.cpp deleted file mode 100644 index f6321ad6..00000000 --- a/CxxTestRegistration/src/BookRegistration.cpp +++ /dev/null @@ -1,65 +0,0 @@ - -#include - -#include "Book.h" -#include "Registration.h" -#include "TestUtilsBook.h" - -using namespace test_utils; - -namespace test_mirror -{ - void Register::typeIdBook(std::unordered_map& id) - { - id.insert(std::make_pair(book::class_, rtl::traits::uid::value)); - } - - void Register::typeBook(std::vector& fns) - { - // class 'Book', methods & constructors. - // Registering default constructor. - fns.push_back(rtl::type().record(book::class_) - .build()); - - // Registering overloaded constructor, signature must be specified as template parameter. - fns.push_back(rtl::type().member() - .constructor() - .build()); - - // Unique methods, no overloads. - fns.push_back(rtl::type().member() - .method(book::str_setAuthor) - .build(&Book::setAuthor)); - - // Unique method, taking 'std::string' & 'const std::string&' as argument, auto deduced via function-pointer. - fns.push_back(rtl::type().member() - .method(book::str_addPreface) - .build(&Book::addPreface)); - - // Furthur registrations of unique-menthods, signature auto-deduced via function pointer. - fns.push_back(rtl::type().member() - .method(book::str_setDescription) - .build(&Book::setDescription)); - - fns.push_back(rtl::type().member() - .method(book::str_getPublishedOn) - .build(&Book::getPublishedOn)); - - fns.push_back(rtl::type().member() - .method(book::str_addCopyrightTag) - .build(&Book::addCopyrightTag)); - - // Registering overloaded methods, signature must be specified as template params since other overloads exists, else compiler error. - fns.push_back(rtl::type().member() - .method(book::str_updateBookInfo) - .build(&Book::updateBookInfo)); - - fns.push_back(rtl::type().member() - .method(book::str_updateBookInfo) - .build(&Book::updateBookInfo)); - - fns.push_back(rtl::type().member() - .method(book::str_updateBookInfo) - .build(&Book::updateBookInfo)); - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/CMakeLists.txt b/CxxTestRegistration/src/CMakeLists.txt index 21cf3de4..271a36ed 100644 --- a/CxxTestRegistration/src/CMakeLists.txt +++ b/CxxTestRegistration/src/CMakeLists.txt @@ -4,29 +4,25 @@ cmake_minimum_required(VERSION 3.20) project(CxxTestRegistration) # Create a variable containing the source files for your target -set(LOCAL_SOURCES - "${CMAKE_CURRENT_LIST_DIR}/AnimalRegistration.cpp" - "${CMAKE_CURRENT_LIST_DIR}/BookRegistration.cpp" - "${CMAKE_CURRENT_LIST_DIR}/CalenderRegistration.cpp" - "${CMAKE_CURRENT_LIST_DIR}/ComplexRegistration.cpp" - "${CMAKE_CURRENT_LIST_DIR}/DateRegistration.cpp" - "${CMAKE_CURRENT_LIST_DIR}/EventRegistration.cpp" - "${CMAKE_CURRENT_LIST_DIR}/LibraryRegistration.cpp" - "${CMAKE_CURRENT_LIST_DIR}/PersonRegistration.cpp" - "${CMAKE_CURRENT_LIST_DIR}/PodStdRegistration.cpp" - - "${CMAKE_CURRENT_LIST_DIR}/StrWrapRegistration.cpp" - "${CMAKE_CURRENT_LIST_DIR}/StrMuteRegistration.cpp" - "${CMAKE_CURRENT_LIST_DIR}/StrConstRegistration.cpp" - "${CMAKE_CURRENT_LIST_DIR}/StrFuncsRegistration.cpp" - "${CMAKE_CURRENT_LIST_DIR}/StrStaticRegistration.cpp" - "${CMAKE_CURRENT_LIST_DIR}/StrConstOverloadRegistration.cpp" - +set(LOCAL_SOURCES + "${CMAKE_CURRENT_LIST_DIR}/regs0_Animal.cpp" + "${CMAKE_CURRENT_LIST_DIR}/regs1_Date.cpp" + "${CMAKE_CURRENT_LIST_DIR}/regs2_Book.cpp" + "${CMAKE_CURRENT_LIST_DIR}/regs3_Person.cpp" + "${CMAKE_CURRENT_LIST_DIR}/regs4_StringMute.cpp" + "${CMAKE_CURRENT_LIST_DIR}/regs5_StringStatic.cpp" + "${CMAKE_CURRENT_LIST_DIR}/regs6_StringConstOverload.cpp" + "${CMAKE_CURRENT_LIST_DIR}/regs7_StringOps.cpp" + "${CMAKE_CURRENT_LIST_DIR}/regs8_StringWrap.cpp" + "${CMAKE_CURRENT_LIST_DIR}/regs9_Library.cpp" + "${CMAKE_CURRENT_LIST_DIR}/regs10_Complex.cpp" + "${CMAKE_CURRENT_LIST_DIR}/regs11_StringConst.cpp" "${CMAKE_CURRENT_LIST_DIR}/TestMirrorProvider.cpp" ) SET(LOCAL_HEADERS - "${PROJECT_SOURCE_DIR}/inc/Registration.h" + "${PROJECT_SOURCE_DIR}/inc/reg_ids.h" + "${PROJECT_SOURCE_DIR}/inc/reg_decls.h" "${PROJECT_SOURCE_DIR}/inc/TestMirrorProvider.h" ) diff --git a/CxxTestRegistration/src/CalenderRegistration.cpp b/CxxTestRegistration/src/CalenderRegistration.cpp deleted file mode 100644 index e2ec873d..00000000 --- a/CxxTestRegistration/src/CalenderRegistration.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -#include - -#include "Date.h" -#include "Registration.h" -#include "TestUtilsDate.h" - -using namespace test_utils; - -namespace test_mirror -{ - void Register::typeIdCalender(std::unordered_map& id) - { - id.insert(std::make_pair(calender::struct_, rtl::traits::uid::value)); - } - - void Register::typeCalender(std::vector& fns) - { - // Registring static-method, 'methodStatic()' function must be used. compiler error otherwise. - fns.push_back(rtl::type().member() - .methodStatic(calender::str_create) - .build(&nsdate::Calender::create)); - - // Registring unique methods of class Calender, no overloads. - fns.push_back(rtl::type().member() - .method(calender::str_getTheEvent) - .build(&nsdate::Calender::getTheEvent)); - - fns.push_back(rtl::type().member() - .method(calender::str_getTheDate) - .build(&nsdate::Calender::getTheDate)); - - fns.push_back(rtl::type().member() - .method(calender::str_getSavedEvent) - .build(&nsdate::Calender::getSavedEvent)); - - fns.push_back(rtl::type().member() - .method(calender::str_getSavedDate) - .build(&nsdate::Calender::getSavedDate)); - - // class Calender, registering after the methods. (order doesn't matter) - fns.push_back(rtl::type().record(calender::struct_) - .build()); - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/ComplexRegistration.cpp b/CxxTestRegistration/src/ComplexRegistration.cpp deleted file mode 100644 index 7eb24553..00000000 --- a/CxxTestRegistration/src/ComplexRegistration.cpp +++ /dev/null @@ -1,30 +0,0 @@ - -#include - -#include "Complex.h" -#include "Registration.h" -#include "GlobalTestUtils.h" - -using namespace test_utils; - -namespace test_mirror -{ - void Register::typeComplex(std::vector& fns) - { - // Unique function, no overloads, no need to specify signature as template parameters. - fns.push_back(rtl::type().function(str_getComplexNumAsString) - .build(getComplexNumAsString)); - - /* Grouping functions under a namespace, which is optional. they can be registered without it as well. - but if registered under namspace, then to retrieve it from CxxMirror object, namespace name must be passed, - e.g. cxx::mirror().getFunction("namespace_name", "function_name") & cxx::mirror().getRecord("namespace_name", "record_name") */ - fns.push_back(rtl::type().function(str_setReal) - .build(complex::setReal)); - - fns.push_back(rtl::type().function(str_setImaginary) - .build(complex::setImaginary)); - - fns.push_back(rtl::type().function(str_getMagnitude) - .build(complex::getMagnitude)); - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/DateRegistration.cpp b/CxxTestRegistration/src/DateRegistration.cpp deleted file mode 100644 index 0921adba..00000000 --- a/CxxTestRegistration/src/DateRegistration.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -#include - -#include "Date.h" -#include "Registration.h" -#include "TestUtilsDate.h" - -using namespace test_utils; - -namespace test_mirror -{ - void Register::typeIdDate(std::unordered_map& id) - { - id.insert(std::make_pair(date::struct_, rtl::traits::uid::value)); - } - - void Register::typeDate(std::vector& fns) - { - // Constructors registration, class/struct name and type must be passed 'record("NAME")'. - // Registers default constructor with implicit registration of destructor & copy-constructor. - fns.push_back(rtl::type().record(date::struct_) - .build()); - - // Overloaded constructor, taking 'string' as argument, signature must be specified as template parameter. - fns.push_back(rtl::type().member() - .constructor() - .build()); - - // Again, register an overloaded constructor with diffeent signature. - fns.push_back(rtl::type().member() - .constructor() - .build()); - - // Registring, Unique method, no overloads. Taking param 'std::string', auto deduced via function-pointer. - fns.push_back(rtl::type().member() - .method(date::str_updateDate) - .build(&nsdate::Date::updateDate)); - - // Registring const-method, 'methodConst()' function must be used. compiler error otherwise. - fns.push_back(rtl::type().member() - .methodConst(date::str_getAsString) - .build(&nsdate::Date::getAsString)); - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/EventRegistration.cpp b/CxxTestRegistration/src/EventRegistration.cpp deleted file mode 100644 index 02f49172..00000000 --- a/CxxTestRegistration/src/EventRegistration.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -#include - -#include "Date.h" -#include "Registration.h" -#include "TestUtilsDate.h" - -using namespace test_utils; - -namespace test_mirror -{ - void Register::typeIdEvent(std::unordered_map& id) - { - id.insert(std::make_pair(event::struct_, rtl::traits::uid::value)); - } - - void Register::typeEvent(std::vector& fns) - { - // Registering 'Event' for reflection; instance creation via reflection fails since its default constructor is private or deleted. - // At least one member must be registered for RTL to recognize the type. be it property, member-function or constructor. - fns.push_back(rtl::type().record(event::struct_) - .build()); - - fns.push_back(rtl::type().member() - .method(event::str_reset) - .build(&nsdate::Event::reset)); - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/LibraryRegistration.cpp b/CxxTestRegistration/src/LibraryRegistration.cpp deleted file mode 100644 index cf9c1c06..00000000 --- a/CxxTestRegistration/src/LibraryRegistration.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -#include - -#include "Book.h" -#include "Library.h" -#include "Registration.h" -#include "TestUtilsBook.h" - -using namespace test_utils; - -namespace test_mirror -{ - void Register::typeIdLibrary(std::unordered_map& id) - { - id.insert(std::make_pair(library::class_, rtl::traits::uid::value)); - } - - void Register::typeLibrary(std::vector& fns) - { - // Registering Library's constructor. Stack allocation (rtl::alloc::Stack) will fail since its copy constructor is deleted - // and its required by 'std::any' to store its object via copy-construction. But instance on heap (rtl::alloc::HEAP) can be - // constructed since, in that case, 'std::any' stores only the poiner which does not requires copy constructor to be called. - fns.push_back(rtl::type().record(library::class_) - .build()); - - // Registring static-method, 'methodStatic()' function must be used. compiler error otherwise. - fns.push_back(rtl::type().member() - .methodStatic(library::str_addBook) - .build(&Library::addBook)); - - fns.push_back(rtl::type().member() - .methodStatic(library::str_getBookByTitle) - .build(&Library::getBookByTitle)); - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/PersonRegistration.cpp b/CxxTestRegistration/src/PersonRegistration.cpp deleted file mode 100644 index 05594da8..00000000 --- a/CxxTestRegistration/src/PersonRegistration.cpp +++ /dev/null @@ -1,77 +0,0 @@ - -#include - -#include "Person.h" -#include "Registration.h" -#include "TestUtilsPerson.h" - -using namespace test_utils; - -namespace test_mirror -{ - void Register::typeIdPerson(std::unordered_map& id) - { - id.insert(std::make_pair(person::class_, rtl::traits::uid::value)); - } - - void Register::typePerson(std::vector& fns) - { - // class 'Person', methods & constructors. - fns.push_back(rtl::type().record(person::class_) - .build()); - - fns.push_back(rtl::type().member() - .constructor() - .build()); - - fns.push_back(rtl::type().member() - .methodStatic(person::str_createPtr) - .build(&Person::createPtr)); - - fns.push_back(rtl::type().member() - .method(person::str_updateAddress) - .build(&Person::updateAddress)); - - fns.push_back(rtl::type().member() - .method(person::str_updateAddress) - .build(&Person::updateAddress)); - - fns.push_back(rtl::type().member() - .method(person::str_getFirstName) - .build(&Person::getFirstName)); - - // Registring const-method, 'methodConst()' function must be used. compiler error otherwise. - fns.push_back(rtl::type().member() - .methodConst(person::str_updateLastName) - .build(&Person::updateLastName)); - - // Registring const-method overload, non-const overloaded method already registered above. - fns.push_back(rtl::type().member() - .methodConst(person::str_updateAddress) - .build(&Person::updateAddress)); - - fns.push_back(rtl::type().member() - .methodConst(person::str_updateAddress) - .build(&Person::updateAddress)); - - fns.push_back(rtl::type().member() - .methodStatic(person::str_getDefaults) - .build(&Person::getDefaults)); - - fns.push_back(rtl::type().member() - .methodStatic(person::str_createConst) - .build(&Person::createConst)); - - fns.push_back(rtl::type().member() - .methodStatic(person::str_getProfile) - .build(&Person::getProfile)); - - fns.push_back(rtl::type().member() - .methodStatic(person::str_getProfile) - .build(&Person::getProfile)); - - fns.push_back(rtl::type().member() - .methodStatic(person::str_getProfile) - .build(&Person::getProfile)); - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/PodStdRegistration.cpp b/CxxTestRegistration/src/PodStdRegistration.cpp deleted file mode 100644 index 761dade3..00000000 --- a/CxxTestRegistration/src/PodStdRegistration.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -#include - -#include "Registration.h" - -namespace test_mirror -{ - void Register::typeIdPodStd(std::unordered_map& id) - { - id.insert(std::make_pair("int", rtl::traits::uid::value)); - id.insert(std::make_pair("char", rtl::traits::uid::value)); - id.insert(std::make_pair("std::string", rtl::traits::uid::value)); - id.insert(std::make_pair("std::string_view", rtl::traits::uid::value)); - } - - void Register::stdTypes(std::vector& fns) - { - // Registering int. - fns.push_back(rtl::type().record("int") - .build()); - - // Registering type 'int' again, ignored & emits- - // [WARNING] Multiple registrations of the same type detected. - fns.push_back(rtl::type().record("int") - .build()); - - // Registering type 'int' again, but with different name. ignored & emits- - // [WARNING] Multiple registrations of the same type detected. - fns.push_back(rtl::type().record("ccint") - .build()); - - // Registering pod, reflecting- constructor, copy-constructor & destructor. - fns.push_back(rtl::type().record("char") - .build()); - - fns.push_back(rtl::type().record("std::string_view") - .build()); - - // Registers std::string class - fns.push_back(rtl::type().member() - .methodConst("empty") - .build(&std::string::empty)); - - /* Attempting to register the same type(`std::string`) again under a different name. - * RTL will ignore this duplicate registration and retain the first one. Emits a warning on the console: - * "[WARNING] Multiple registrations of the same type with different names detected." - */ fns.push_back(rtl::type().member() - .methodConst("empty") - .build(&std::string::empty)); - - fns.push_back(rtl::type().record("std::string") - .build()); - - fns.push_back(rtl::type().member() - .constructor() - .build()); - - /* Attempting to register std::string_view, but the provided member function pointer belongs to std::string. - * RTL will ignore this registration. Emits a warning on the console: - * "[WARNING] Member function pointer does not belong to the class being registered!" - */ fns.push_back(rtl::type().member() - .methodConst("empty") - .build(&std::string::empty)); - - // Finally, register std::string_view with correct member-function-pointer - fns.push_back(rtl::type().member() - .methodConst("empty") - .build(&std::string_view::empty)); - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/StrConstOverloadRegistration.cpp b/CxxTestRegistration/src/StrConstOverloadRegistration.cpp deleted file mode 100644 index fdf9315a..00000000 --- a/CxxTestRegistration/src/StrConstOverloadRegistration.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -#include - -#include "StringConstOverload.h" -#include "Registration.h" -#include "GlobalTestUtils.h" - -using namespace test_utils; - -namespace test_mirror -{ - void Register::typeIdStringConstOverload(std::unordered_map& id) - { - const StrConstOverload obj; - obj.reverseString(); - - id.insert(std::make_pair(StrConstOverload::struct_, rtl::traits::uid::value)); - } - - void Register::typeStringConstOverload(std::vector& fns) - { - fns.push_back(rtl::type().record(StrConstOverload::struct_) - .build()); - - fns.push_back(rtl::type().member() - .method(str_reverseString) - .build(&StrConstOverload::reverseString)); - - fns.push_back(rtl::type().member() - .methodConst(str_reverseString) - .build(&StrConstOverload::reverseString)); - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/StrConstRegistration.cpp b/CxxTestRegistration/src/StrConstRegistration.cpp deleted file mode 100644 index 79cf5fea..00000000 --- a/CxxTestRegistration/src/StrConstRegistration.cpp +++ /dev/null @@ -1,101 +0,0 @@ - -#include - -#include "StringConst.h" -#include "Registration.h" -#include "GlobalTestUtils.h" - -using namespace test_utils; - -namespace test_mirror -{ - void Register::typeIdStringConst(std::unordered_map& id) - { - id.insert(std::make_pair(StrConst::struct_, rtl::traits::uid::value)); - } - - void Register::typeStringConst(std::vector& fns) - { - fns.push_back(rtl::type().record(StrConst::struct_) - .build()); - - // Function taking no arguments. '' must be specified if other overload exists else not needed. compiler error otherwise. - fns.push_back(rtl::type().member() - .methodConst(str_reverseString) - .build(&StrConst::reverseString)); - - // Overloaded function, takes 'string' arguments. '' must be specified as template parameter. - fns.push_back(rtl::type().member() - .methodConst(str_reverseString) - .build(&StrConst::reverseString)); - - // Overloaded function, takes 'const char*' arguments. - fns.push_back(rtl::type().member() - .methodConst(str_reverseString) - .build(&StrConst::reverseString)); - - // numereous other overloads. - /* - GCC here fails to automatically resolve the correct overloaded functor - when both a lvalue reference and an rvalue overload exist. - To disambiguate, explicitly cast the function pointer, e.g.: - - static_cast(reverseString) - */ - fns.push_back(rtl::type().member() - .methodConst(str_reverseString) - .build(static_cast(&StrConst::reverseString))); - - fns.push_back(rtl::type().member() - .methodConst(str_reverseString) - .build(static_cast(&StrConst::reverseString))); - - fns.push_back(rtl::type().member() - .methodConst(str_reverseString) - .build(static_cast(&StrConst::reverseString))); - - fns.push_back(rtl::type().member() - .methodConst(str_reverseString) - .build(&StrConst::reverseString)); - - fns.push_back(rtl::type().member() - .methodConst(str_reverseString) - .build(&StrConst::reverseString)); - - fns.push_back(rtl::type().member() - .methodConst(str_revStrNonConstRefArg) - .build(&StrConst::revStrNonConstRefArg)); - - fns.push_back(rtl::type().member() - .methodConst(str_revStrRValueRefArg) - .build(&StrConst::revStrRValueRefArg)); - - fns.push_back(rtl::type().member() - .methodConst(str_revStrConstRefArg) - .build(&StrConst::revStrConstRefArg)); - - fns.push_back(rtl::type().member() - .methodConst(str_revStrOverloadValRef) - .build(&StrConst::revStrOverloadValRef)); - - fns.push_back(rtl::type().member() - .methodConst(str_revStrOverloadValRef) - .build(&StrConst::revStrOverloadValRef)); - - fns.push_back(rtl::type().member() - .methodConst(str_revStrOverloadValCRef) - .build(&StrConst::revStrOverloadValCRef)); - - fns.push_back(rtl::type().member() - .methodConst(str_revStrOverloadValCRef) - .build(&StrConst::revStrOverloadValCRef)); - - fns.push_back(rtl::type().member() - .methodConst(str_revStrOverloadValRefAndCRef) - .build(&StrConst::revStrOverloadRefAndCRef)); - - fns.push_back(rtl::type().member() - .methodConst(str_revStrOverloadValRefAndCRef) - .build(&StrConst::revStrOverloadRefAndCRef)); - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/StrFuncsRegistration.cpp b/CxxTestRegistration/src/StrFuncsRegistration.cpp deleted file mode 100644 index 6142147c..00000000 --- a/CxxTestRegistration/src/StrFuncsRegistration.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -#include - -#include "StringOps.h" -#include "Registration.h" -#include "GlobalTestUtils.h" - -using namespace test_utils; - -namespace test_mirror -{ - void Register::typeStringFuncs(std::vector& fns) - { - // Function taking no arguments. '' must be specified if other overload exists else not needed. compiler error otherwise. - fns.push_back(rtl::type().function(str_reverseString) - .build(reverseString)); - - // Overloaded function, takes 'string' arguments. '' must be specified as template parameter. - fns.push_back(rtl::type().function(str_reverseString) - .build(reverseString)); - - // Overloaded function, takes 'const char*' arguments. - fns.push_back(rtl::type().function(str_reverseString) - .build(reverseString)); - // numereous other overloads. - -/* - GCC here fails to automatically resolve the correct overloaded functor - when both a lvalue reference and an rvalue overload exist. - To disambiguate, explicitly cast the function pointer, e.g.: - - static_cast(reverseString) -*/ - fns.push_back(rtl::type().function(str_reverseString) - .build(static_cast(reverseString))); - - fns.push_back(rtl::type().function(str_reverseString) - .build(static_cast(reverseString))); - - fns.push_back(rtl::type().function(str_reverseString) - .build(static_cast(reverseString))); - - fns.push_back(rtl::type().function(str_reverseString) - .build(reverseString)); - - fns.push_back(rtl::type().function(str_reverseString) - .build(reverseString)); - - fns.push_back(rtl::type().function(str_revStrNonConstRefArg) - .build(revStrNonConstRefArg)); - - fns.push_back(rtl::type().function(str_revStrRValueRefArg) - .build(revStrRValueRefArg)); - - fns.push_back(rtl::type().function(str_revStrConstRefArg) - .build(revStrConstRefArg)); - - fns.push_back(rtl::type().function(str_revStrOverloadValRef) - .build(revStrOverloadValRef)); - - fns.push_back(rtl::type().function(str_revStrOverloadValRef) - .build(revStrOverloadValRef)); - - fns.push_back(rtl::type().function(str_revStrOverloadValCRef) - .build(revStrOverloadValCRef)); - - fns.push_back(rtl::type().function(str_revStrOverloadValCRef) - .build(revStrOverloadValCRef)); - - fns.push_back(rtl::type().function(str_revStrOverloadValRefAndCRef) - .build(revStrOverloadRefAndCRef)); - - fns.push_back(rtl::type().function(str_revStrOverloadValRefAndCRef) - .build(revStrOverloadRefAndCRef)); - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/StrMuteRegistration.cpp b/CxxTestRegistration/src/StrMuteRegistration.cpp deleted file mode 100644 index 7476529b..00000000 --- a/CxxTestRegistration/src/StrMuteRegistration.cpp +++ /dev/null @@ -1,102 +0,0 @@ - -#include - -#include "StringMute.h" -#include "Registration.h" -#include "GlobalTestUtils.h" - -using namespace test_utils; - -namespace test_mirror -{ - void Register::typeIdStringMute(std::unordered_map& id) - { - id.insert(std::make_pair(StrMute::struct_, rtl::traits::uid::value)); - } - - void Register::typeStringMute(std::vector& fns) - { - fns.push_back(rtl::type().record(StrMute::struct_) - .build()); - - // Function taking no arguments. '' must be specified if other overload exists else not needed. compiler error otherwise. - fns.push_back(rtl::type().member() - .method(str_reverseString) - .build(&StrMute::reverseString)); - - // Overloaded function, takes 'string' arguments. '' must be specified as template parameter. - fns.push_back(rtl::type().member() - .method(str_reverseString) - .build(&StrMute::reverseString)); - - // Overloaded function, takes 'const char*' arguments. - fns.push_back(rtl::type().member() - .method(str_reverseString) - .build(&StrMute::reverseString)); - - // numereous other overloads. - - /* - GCC here fails to automatically resolve the correct overloaded functor - when both a lvalue reference and an rvalue overload exist. - To disambiguate, explicitly cast the function pointer, e.g.: - - static_cast(reverseString) - */ - fns.push_back(rtl::type().member() - .method(str_reverseString) - .build(static_cast(&StrMute::reverseString))); - - fns.push_back(rtl::type().member() - .method(str_reverseString) - .build(static_cast(&StrMute::reverseString))); - - fns.push_back(rtl::type().member() - .method(str_reverseString) - .build(static_cast(&StrMute::reverseString))); - - fns.push_back(rtl::type().member() - .method(str_reverseString) - .build(&StrMute::reverseString)); - - fns.push_back(rtl::type().member() - .method(str_reverseString) - .build(&StrMute::reverseString)); - - fns.push_back(rtl::type().member() - .method(str_revStrNonConstRefArg) - .build(&StrMute::revStrNonConstRefArg)); - - fns.push_back(rtl::type().member() - .method(str_revStrRValueRefArg) - .build(&StrMute::revStrRValueRefArg)); - - fns.push_back(rtl::type().member() - .method(str_revStrConstRefArg) - .build(&StrMute::revStrConstRefArg)); - - fns.push_back(rtl::type().member() - .method(str_revStrOverloadValRef) - .build(&StrMute::revStrOverloadValRef)); - - fns.push_back(rtl::type().member() - .method(str_revStrOverloadValRef) - .build(&StrMute::revStrOverloadValRef)); - - fns.push_back(rtl::type().member() - .method(str_revStrOverloadValCRef) - .build(&StrMute::revStrOverloadValCRef)); - - fns.push_back(rtl::type().member() - .method(str_revStrOverloadValCRef) - .build(&StrMute::revStrOverloadValCRef)); - - fns.push_back(rtl::type().member() - .method(str_revStrOverloadValRefAndCRef) - .build(&StrMute::revStrOverloadRefAndCRef)); - - fns.push_back(rtl::type().member() - .method(str_revStrOverloadValRefAndCRef) - .build(&StrMute::revStrOverloadRefAndCRef)); - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/StrStaticRegistration.cpp b/CxxTestRegistration/src/StrStaticRegistration.cpp deleted file mode 100644 index b75a7829..00000000 --- a/CxxTestRegistration/src/StrStaticRegistration.cpp +++ /dev/null @@ -1,101 +0,0 @@ - -#include - -#include "StringStatic.h" -#include "Registration.h" -#include "GlobalTestUtils.h" - -using namespace test_utils; - -namespace test_mirror -{ - void Register::typeIdStringStatic(std::unordered_map& id) - { - id.insert(std::make_pair(StrStatic::struct_, rtl::traits::uid::value)); - } - - void Register::typeStringStatic(std::vector& fns) - { - fns.push_back(rtl::type().record(StrStatic::struct_) - .build()); - - // Function taking no arguments. '' must be specified if other overload exists else not needed. compiler error otherwise. - fns.push_back(rtl::type().member() - .methodStatic(str_reverseString) - .build(&StrStatic::reverseString)); - - // Overloaded function, takes 'string' arguments. '' must be specified as template parameter. - fns.push_back(rtl::type().member() - .methodStatic(str_reverseString) - .build(&StrStatic::reverseString)); - - // Overloaded function, takes 'const char*' arguments. - fns.push_back(rtl::type().member() - .methodStatic(str_reverseString) - .build(&StrStatic::reverseString)); - - // numereous other overloads. - /* - GCC here fails to automatically resolve the correct overloaded functor - when both a lvalue reference and an rvalue overload exist. - To disambiguate, explicitly cast the function pointer, e.g.: - - static_cast(reverseString) - */ - fns.push_back(rtl::type().member() - .methodStatic(str_reverseString) - .build(static_cast(&StrStatic::reverseString))); - - fns.push_back(rtl::type().member() - .methodStatic(str_reverseString) - .build(static_cast(&StrStatic::reverseString))); - - fns.push_back(rtl::type().member() - .methodStatic(str_reverseString) - .build(static_cast(&StrStatic::reverseString))); - - fns.push_back(rtl::type().member() - .methodStatic(str_reverseString) - .build(&StrStatic::reverseString)); - - fns.push_back(rtl::type().member() - .methodStatic(str_reverseString) - .build(&StrStatic::reverseString)); - - fns.push_back(rtl::type().member() - .methodStatic(str_revStrNonConstRefArg) - .build(&StrStatic::revStrNonConstRefArg)); - - fns.push_back(rtl::type().member() - .methodStatic(str_revStrRValueRefArg) - .build(&StrStatic::revStrRValueRefArg)); - - fns.push_back(rtl::type().member() - .methodStatic(str_revStrConstRefArg) - .build(&StrStatic::revStrConstRefArg)); - - fns.push_back(rtl::type().member() - .methodStatic(str_revStrOverloadValRef) - .build(&StrStatic::revStrOverloadValRef)); - - fns.push_back(rtl::type().member() - .methodStatic(str_revStrOverloadValRef) - .build(&StrStatic::revStrOverloadValRef)); - - fns.push_back(rtl::type().member() - .methodStatic(str_revStrOverloadValCRef) - .build(&StrStatic::revStrOverloadValCRef)); - - fns.push_back(rtl::type().member() - .methodStatic(str_revStrOverloadValCRef) - .build(&StrStatic::revStrOverloadValCRef)); - - fns.push_back(rtl::type().member() - .methodStatic(str_revStrOverloadValRefAndCRef) - .build(&StrStatic::revStrOverloadRefAndCRef)); - - fns.push_back(rtl::type().member() - .methodStatic(str_revStrOverloadValRefAndCRef) - .build(&StrStatic::revStrOverloadRefAndCRef)); - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/StrWrapRegistration.cpp b/CxxTestRegistration/src/StrWrapRegistration.cpp deleted file mode 100644 index 128fe3b5..00000000 --- a/CxxTestRegistration/src/StrWrapRegistration.cpp +++ /dev/null @@ -1,74 +0,0 @@ - -#include - -#include "StringWrap.h" -#include "Registration.h" -#include "GlobalTestUtils.h" - -using namespace test_utils; - -namespace test_mirror -{ - void Register::typeIdStringWrap(std::unordered_map& id) - { - id.insert(std::make_pair(StrWrapA::struct_, rtl::traits::uid::value)); - id.insert(std::make_pair(StrWrapB::struct_, rtl::traits::uid::value)); - id.insert(std::make_pair(StrWrapC::struct_, rtl::traits::uid::value)); - id.insert(std::make_pair(StrWrapD::struct_, rtl::traits::uid::value)); - } - - void Register::typeStringWrap(std::vector& fns) - { - //------------------StrWrapA-------------------------------- - fns.push_back(rtl::type().record(StrWrapA::struct_) // Registers default constructor as well. - .build()); - - fns.push_back(rtl::type().member() - .constructor() - .build()); - - fns.push_back(rtl::type().member() - .constructor() - .build()); - - fns.push_back(rtl::type().member() - .constructor() - .build()); - - fns.push_back(rtl::type().member() - .constructor() - .build()); - - fns.push_back(rtl::type().member() - .constructor() - .build()); - - //------------------StrWrapB-------------------------------- - fns.push_back(rtl::type().record(StrWrapB::struct_) // Registers default constructor as well. - .build()); - - fns.push_back(rtl::type().member() - .constructor() - .build()); - - fns.push_back(rtl::type().member() - .constructor() - .build()); - - //------------------StrWrapC-------------------------------- - fns.push_back(rtl::type().record(StrWrapC::struct_) // Registers default constructor as well. - .build()); - - fns.push_back(rtl::type().member() - .constructor() - .build()); - - //------------------StrWrapD-------------------------------- - fns.push_back(rtl::type().record(StrWrapD::struct_) // Registers default constructor as well. - .build()); - - fns.push_back(rtl::type().member() - .constructor() - .build()); - } -} \ No newline at end of file diff --git a/CxxTestRegistration/src/TestMirrorProvider.cpp b/CxxTestRegistration/src/TestMirrorProvider.cpp index 04dd7d86..e69caa42 100644 --- a/CxxTestRegistration/src/TestMirrorProvider.cpp +++ b/CxxTestRegistration/src/TestMirrorProvider.cpp @@ -5,75 +5,153 @@ #include #include -#include "Registration.h" +#include "reg_decls.h" #include "TestMirrorProvider.h" -namespace test_mirror +#include "Book.h" +#include "Person.h" +#include "Animal.h" +#include "Library.h" +#include "Complex.h" +#include "StringWrap.h" +#include "StringOps.h" +#include "StringMute.h" +#include "StringConst.h" +#include "StringStatic.h" +#include "StringConstOverload.h" + +namespace { + + void registerStdTypes(std::vector& fns) + { + // Registering int. + fns.push_back(rtl::type().record("int") + .build()); + + // Registering type 'int' again, ignored & emits- + // [WARNING] Multiple registrations of the same type detected. + fns.push_back(rtl::type().record("int") + .build()); + + // Registering type 'int' again, but with different name. ignored & emits- + // [WARNING] Multiple registrations of the same type detected. + fns.push_back(rtl::type().record("ccint") + .build()); + + // Registering pod, reflecting- constructor, copy-constructor & destructor. + fns.push_back(rtl::type().record("char") + .build()); + + fns.push_back(rtl::type().record("std::string_view") + .build()); + + // Registers std::string class + fns.push_back(rtl::type().member() + .methodConst("empty") + .build(&std::string::empty)); + + /* Attempting to register the same type(`std::string`) again under a different name. + * RTL will ignore this duplicate registration and retain the first one. Emits a warning on the console: + * "[WARNING] Multiple registrations of the same type with different names detected." + */ fns.push_back(rtl::type().member() + .methodConst("empty") + .build(&std::string::empty)); + + fns.push_back(rtl::type().record("std::string") + .build()); + + fns.push_back(rtl::type().member() + .constructor() + .build()); + + /* Attempting to register std::string_view, but the provided member function pointer belongs to std::string. + * RTL will ignore this registration. Emits a warning on the console: + * "[WARNING] Member function pointer does not belong to the class being registered!" + */ fns.push_back(rtl::type().member() + .methodConst("empty") + .build(&std::string::empty)); + + // Finally, register std::string_view with correct member-function-pointer + fns.push_back(rtl::type().member() + .methodConst("empty") + .build(&std::string_view::empty)); + } +} + + +const rtl::CxxMirror& cxx::mirror() { - const rtl::CxxMirror& cxx::mirror() - { - static auto cxx_mirror = rtl::CxxMirror( - []() { - - std::vector fns; - - Register::stdTypes(fns); - Register::typeBook(fns); - Register::typeDate(fns); - Register::typeEvent(fns); - Register::typePerson(fns); - Register::typeAnimal(fns); - Register::typeLibrary(fns); - Register::typeComplex(fns); - Register::typeCalender(fns); - - Register::typeStringWrap(fns); - Register::typeStringMute(fns); - Register::typeStringConst(fns); - Register::typeStringFuncs(fns); - Register::typeStringStatic(fns); - Register::typeStringConstOverload(fns); - - return fns; - }() - ); - - static const auto _= [&]() - { - const std::string pathStr = std::filesystem::current_path().string() + "/MyReflection.json"; - std::cout << "\n[ OUTPUT] test_mirror::cxx::mirror() ==> dumping 'CxxMirror' as JSON." - << "\n file path: " << pathStr << "\n" << std::endl; - rtl::CxxMirrorToJson::dump(cxx_mirror, pathStr); - return 0; - }(); - - return cxx_mirror; - } - - const rtl::traits::uid_t cxx::reflected_id(const std::string& pRecordName) + static auto cxx_mirror = rtl::CxxMirror( + []() { + + std::vector fns; + + registerStdTypes(fns); + + regs7::fn::init(fns); + regs10::fn::init(fns); + regs1::type0::init(fns); + regs1::type1::init(fns); + regs1::type2::init(fns); + regs0::type0::init(fns); + regs3::type0::init(fns); + regs2::type0::init(fns); + regs4::type0::init(fns); + regs5::type0::init(fns); + regs6::type0::init(fns); + regs8::type0::init(fns); + regs8::type1::init(fns); + regs8::type2::init(fns); + regs8::type3::init(fns); + regs8::type4::init(fns); + regs9::type0::init(fns); + regs11::type0::init(fns); + + return fns; + }() + ); + + static const auto _= [&]() { - static std::unordered_map nameIdMap = []() - { - std::unordered_map ids; - - Register::typeIdBook(ids); - Register::typeIdDate(ids); - Register::typeIdEvent(ids); - Register::typeIdPerson(ids); - Register::typeIdPodStd(ids); - Register::typeIdAnimal(ids); - Register::typeIdLibrary(ids); - Register::typeIdCalender(ids); - Register::typeIdStringWrap(ids); - Register::typeIdStringMute(ids); - Register::typeIdStringConst(ids); - Register::typeIdStringStatic(ids); - Register::typeIdStringConstOverload(ids); - - return ids; - }(); - - const auto& itr = nameIdMap.find(pRecordName); - return (itr == nameIdMap.end() ? rtl::index_none : itr->second); - } + const std::string pathStr = std::filesystem::current_path().string() + "/MyReflection.json"; + std::cout << "\n[ OUTPUT] test_mirror::cxx::mirror() ==> dumping 'CxxMirror' as JSON." + << "\n file path: " << pathStr << "\n" << std::endl; + rtl::CxxMirrorToJson::dump(cxx_mirror, pathStr); + return 0; + }(); + + return cxx_mirror; +} + +const rtl::traits::uid_t cxx::reflected_id(const std::string& pRecordName) +{ + static std::unordered_map nameIdMap = { + + {cxx::type::Book::id, rtl::traits::uid::value}, + {cxx::type::Person::id, rtl::traits::uid::value}, + {cxx::type::Animal::id, rtl::traits::uid::value}, + {cxx::type::Library::id, rtl::traits::uid::value}, + {cxx::type::nsdate::Date::id, rtl::traits::uid::value}, + {cxx::type::nsdate::Event::id, rtl::traits::uid::value}, + {cxx::type::nsdate::Calender::id, rtl::traits::uid::value}, + + {cxx::type::StrWrap::id, rtl::traits::uid::value}, + {cxx::type::StrWrapA::id, rtl::traits::uid::value}, + {cxx::type::StrWrapB::id, rtl::traits::uid::value}, + {cxx::type::StrWrapC::id, rtl::traits::uid::value}, + {cxx::type::StrWrapD::id, rtl::traits::uid::value}, + + {cxx::type::StrMute::id, rtl::traits::uid::value}, + {cxx::type::StrConst::id, rtl::traits::uid::value}, + {cxx::type::StrStatic::id, rtl::traits::uid::value}, + {cxx::type::StrConstOverload::id, rtl::traits::uid::value}, + + { "int", rtl::traits::uid::value }, + { "char", rtl::traits::uid::value }, + { "std::string", rtl::traits::uid::value }, + { "std::string_view", rtl::traits::uid::value } + }; + + const auto& itr = nameIdMap.find(pRecordName); + return (itr == nameIdMap.end() ? rtl::index_none : itr->second); } \ No newline at end of file diff --git a/CxxTestRegistration/src/regs0_Animal.cpp b/CxxTestRegistration/src/regs0_Animal.cpp new file mode 100644 index 00000000..337de82e --- /dev/null +++ b/CxxTestRegistration/src/regs0_Animal.cpp @@ -0,0 +1,58 @@ + + +#include "reg_ids.h" +#include "reg_decls.h" + +#include "Animal.h" + +namespace regs0::type0 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::Animal::id) + .build()); + + fns.push_back(rtl::type().member() + .constructor().build()); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::Animal::fn::getFamilyName::id) + .build(&Animal::getFamilyName)); + + fns.push_back(rtl::type().member() + .method(cxx::type::Animal::fn::setAnimalName::id) + .build(&Animal::setAnimalName)); + + fns.push_back(rtl::type().member() + .method(cxx::type::Animal::fn::setAnimalName::id) + .build(&Animal::setAnimalName)); + + fns.push_back(rtl::type().member() + .method(cxx::type::Animal::fn::setAnimalName::id) + .build(&Animal::setAnimalName)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::Animal::fn::setAnimalName::id) + .build(&Animal::setAnimalName)); + + fns.push_back(rtl::type().member() + .method(cxx::type::Animal::fn::setFamilyName::id) + .build(&Animal::setFamilyName)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Animal::fn::getInstanceCount::id) + .build(&Animal::getInstanceCount)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Animal::fn::updateZooKeeper::id) + .build(&Animal::updateZooKeeper)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Animal::fn::updateZooKeeper::id) + .build(&Animal::updateZooKeeper)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Animal::fn::updateZooKeeper::id) + .build(&Animal::updateZooKeeper)); + } +} + diff --git a/CxxTestRegistration/src/regs10_Complex.cpp b/CxxTestRegistration/src/regs10_Complex.cpp new file mode 100644 index 00000000..ff056e31 --- /dev/null +++ b/CxxTestRegistration/src/regs10_Complex.cpp @@ -0,0 +1,25 @@ + + +#include "reg_ids.h" +#include "reg_decls.h" + +#include "Complex.h" + + +namespace regs10::fn { + void init(std::vector& fns) { + + fns.push_back(rtl::type().function(cxx::fn::complex::getMagnitude::id) + .build(&complex::getMagnitude)); + + fns.push_back(rtl::type().function(cxx::fn::complex::setReal::id) + .build(&complex::setReal)); + + fns.push_back(rtl::type().function(cxx::fn::complex::setImaginary::id) + .build(&complex::setImaginary)); + + fns.push_back(rtl::type().function(cxx::fn::getComplexNumAsString::id) + .build(&getComplexNumAsString)); + } +} + diff --git a/CxxTestRegistration/src/regs11_StringConst.cpp b/CxxTestRegistration/src/regs11_StringConst.cpp new file mode 100644 index 00000000..13d0fbaf --- /dev/null +++ b/CxxTestRegistration/src/regs11_StringConst.cpp @@ -0,0 +1,84 @@ + + +#include "reg_ids.h" +#include "reg_decls.h" + +#include "StringConst.h" + + +namespace regs11::type0 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::StrConst::id) + .build()); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::revStrOverloadValCRef::id) + .build(&StrConst::revStrOverloadValCRef)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::revStrOverloadValCRef::id) + .build(&StrConst::revStrOverloadValCRef)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::reverseString::id) + .build(&StrConst::reverseString)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::reverseString::id) + .build(&StrConst::reverseString)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::reverseString::id) + .build(&StrConst::reverseString)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::reverseString::id) + .build(&StrConst::reverseString)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::reverseString::id) + .build(&StrConst::reverseString)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::reverseString::id) + .build(&StrConst::reverseString)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::reverseString::id) + .build(&StrConst::reverseString)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::reverseString::id) + .build(&StrConst::reverseString)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::revStrConstRefArg::id) + .build(&StrConst::revStrConstRefArg)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::revStrRValueRefArg::id) + .build(&StrConst::revStrRValueRefArg)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::revStrNonConstRefArg::id) + .build(&StrConst::revStrNonConstRefArg)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::revStrOverloadRefAndCRef::id) + .build(&StrConst::revStrOverloadRefAndCRef)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::revStrOverloadRefAndCRef::id) + .build(&StrConst::revStrOverloadRefAndCRef)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::revStrOverloadValRef::id) + .build(&StrConst::revStrOverloadValRef)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::revStrOverloadValRef::id) + .build(&StrConst::revStrOverloadValRef)); + } +} + diff --git a/CxxTestRegistration/src/regs1_Date.cpp b/CxxTestRegistration/src/regs1_Date.cpp new file mode 100644 index 00000000..f3450c4f --- /dev/null +++ b/CxxTestRegistration/src/regs1_Date.cpp @@ -0,0 +1,96 @@ + + +#include "reg_ids.h" +#include "reg_decls.h" + +#include "Date.h" + + +namespace regs1::type0 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::nsdate::Calender::id) + .build()); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::nsdate::Calender::fn::resetMoveOpsCounter::id) + .build(&nsdate::Calender::resetMoveOpsCounter)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::nsdate::Calender::fn::getMoveOpsCount::id) + .build(&nsdate::Calender::getMoveOpsCount)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::nsdate::Calender::fn::create::id) + .build(&nsdate::Calender::create)); + + fns.push_back(rtl::type().member() + .method(cxx::type::nsdate::Calender::fn::getSavedDate::id) + .build(&nsdate::Calender::getSavedDate)); + + fns.push_back(rtl::type().member() + .method(cxx::type::nsdate::Calender::fn::getTheDate::id) + .build(&nsdate::Calender::getTheDate)); + + fns.push_back(rtl::type().member() + .method(cxx::type::nsdate::Calender::fn::getSavedEvent::id) + .build(&nsdate::Calender::getSavedEvent)); + + fns.push_back(rtl::type().member() + .method(cxx::type::nsdate::Calender::fn::getTheEvent::id) + .build(&nsdate::Calender::getTheEvent)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::nsdate::Calender::fn::instanceCount::id) + .build(&nsdate::Calender::instanceCount)); + } +} + + +namespace regs1::type1 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::nsdate::Date::id) + .build()); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::nsdate::Date::fn::instanceCount::id) + .build(&nsdate::Date::instanceCount)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::nsdate::Date::fn::getAsString::id) + .build(&nsdate::Date::getAsString)); + + fns.push_back(rtl::type().member() + .method(cxx::type::nsdate::Date::fn::updateDate::id) + .build(&nsdate::Date::updateDate)); + + fns.push_back(rtl::type().member() + .constructor().build()); + + fns.push_back(rtl::type().member() + .constructor().build()); + } +} + + +namespace regs1::type2 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::nsdate::Event::id) + .build()); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::nsdate::Event::fn::instanceCount::id) + .build(&nsdate::Event::instanceCount)); + + fns.push_back(rtl::type().member() + .method(cxx::type::nsdate::Event::fn::getEventDate::id) + .build(&nsdate::Event::getEventDate)); + + fns.push_back(rtl::type().member() + .method(cxx::type::nsdate::Event::fn::reset::id) + .build(&nsdate::Event::reset)); + } +} + diff --git a/CxxTestRegistration/src/regs2_Book.cpp b/CxxTestRegistration/src/regs2_Book.cpp new file mode 100644 index 00000000..85bf209b --- /dev/null +++ b/CxxTestRegistration/src/regs2_Book.cpp @@ -0,0 +1,59 @@ + + +#include "reg_ids.h" +#include "reg_decls.h" + +#include "Book.h" + + +namespace regs2::type0 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::Book::id) + .build()); + + fns.push_back(rtl::type().member() + .constructor().build()); + + fns.push_back(rtl::type().member() + .method(cxx::type::Book::fn::setAuthor::id) + .build(&Book::setAuthor)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::Book::fn::getTitle::id) + .build(&Book::getTitle)); + + fns.push_back(rtl::type().member() + .method(cxx::type::Book::fn::addCopyrightTag::id) + .build(&Book::addCopyrightTag)); + + fns.push_back(rtl::type().member() + .method(cxx::type::Book::fn::setDescription::id) + .build(&Book::setDescription)); + + fns.push_back(rtl::type().member() + .method(cxx::type::Book::fn::getPublishedOn::id) + .build(&Book::getPublishedOn)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Book::fn::getInstanceCount::id) + .build(&Book::getInstanceCount)); + + fns.push_back(rtl::type().member() + .method(cxx::type::Book::fn::updateBookInfo::id) + .build(&Book::updateBookInfo)); + + fns.push_back(rtl::type().member() + .method(cxx::type::Book::fn::updateBookInfo::id) + .build(&Book::updateBookInfo)); + + fns.push_back(rtl::type().member() + .method(cxx::type::Book::fn::updateBookInfo::id) + .build(&Book::updateBookInfo)); + + fns.push_back(rtl::type().member() + .method(cxx::type::Book::fn::addPreface::id) + .build(&Book::addPreface)); + } +} + diff --git a/CxxTestRegistration/src/regs3_Person.cpp b/CxxTestRegistration/src/regs3_Person.cpp new file mode 100644 index 00000000..ea32ec16 --- /dev/null +++ b/CxxTestRegistration/src/regs3_Person.cpp @@ -0,0 +1,75 @@ + + +#include "reg_ids.h" +#include "reg_decls.h" + +#include "Person.h" + + +namespace regs3::type0 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::Person::id) + .build()); + + fns.push_back(rtl::type().member() + .constructor().build()); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Person::fn::getInstanceCount::id) + .build(&Person::getInstanceCount)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Person::fn::createConst::id) + .build(&Person::createConst)); + + fns.push_back(rtl::type().member() + .method(cxx::type::Person::fn::updateAddress::id) + .build(&Person::updateAddress)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::Person::fn::updateAddress::id) + .build(&Person::updateAddress)); + + fns.push_back(rtl::type().member() + .method(cxx::type::Person::fn::updateAddress::id) + .build(&Person::updateAddress)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::Person::fn::updateAddress::id) + .build(&Person::updateAddress)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Person::fn::getProfile::id) + .build(&Person::getProfile)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Person::fn::getProfile::id) + .build(&Person::getProfile)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Person::fn::getProfile::id) + .build(&Person::getProfile)); + + fns.push_back(rtl::type().member() + .method(cxx::type::Person::fn::getFirstName::id) + .build(&Person::getFirstName)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Person::fn::createPtr::id) + .build(&Person::createPtr)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Person::fn::getDefaults::id) + .build(&Person::getDefaults)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Person::fn::deletePtr::id) + .build(&Person::deletePtr)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::Person::fn::updateLastName::id) + .build(&Person::updateLastName)); + } +} + diff --git a/CxxTestRegistration/src/regs4_StringMute.cpp b/CxxTestRegistration/src/regs4_StringMute.cpp new file mode 100644 index 00000000..15fa3278 --- /dev/null +++ b/CxxTestRegistration/src/regs4_StringMute.cpp @@ -0,0 +1,84 @@ + + +#include "reg_ids.h" +#include "reg_decls.h" + +#include "StringMute.h" + + +namespace regs4::type0 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::StrMute::id) + .build()); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::revStrOverloadValCRef::id) + .build(&StrMute::revStrOverloadValCRef)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::revStrOverloadValCRef::id) + .build(&StrMute::revStrOverloadValCRef)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::reverseString::id) + .build(&StrMute::reverseString)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::reverseString::id) + .build(&StrMute::reverseString)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::reverseString::id) + .build(&StrMute::reverseString)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::reverseString::id) + .build(&StrMute::reverseString)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::reverseString::id) + .build(&StrMute::reverseString)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::reverseString::id) + .build(&StrMute::reverseString)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::reverseString::id) + .build(&StrMute::reverseString)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::reverseString::id) + .build(&StrMute::reverseString)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::revStrConstRefArg::id) + .build(&StrMute::revStrConstRefArg)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::revStrRValueRefArg::id) + .build(&StrMute::revStrRValueRefArg)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::revStrNonConstRefArg::id) + .build(&StrMute::revStrNonConstRefArg)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::revStrOverloadRefAndCRef::id) + .build(&StrMute::revStrOverloadRefAndCRef)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::revStrOverloadRefAndCRef::id) + .build(&StrMute::revStrOverloadRefAndCRef)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::revStrOverloadValRef::id) + .build(&StrMute::revStrOverloadValRef)); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::revStrOverloadValRef::id) + .build(&StrMute::revStrOverloadValRef)); + } +} + diff --git a/CxxTestRegistration/src/regs5_StringStatic.cpp b/CxxTestRegistration/src/regs5_StringStatic.cpp new file mode 100644 index 00000000..6f513e9d --- /dev/null +++ b/CxxTestRegistration/src/regs5_StringStatic.cpp @@ -0,0 +1,84 @@ + + +#include "reg_ids.h" +#include "reg_decls.h" + +#include "StringStatic.h" + + +namespace regs5::type0 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::StrStatic::id) + .build()); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::revStrOverloadValCRef::id) + .build(&StrStatic::revStrOverloadValCRef)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::revStrOverloadValCRef::id) + .build(&StrStatic::revStrOverloadValCRef)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::reverseString::id) + .build(&StrStatic::reverseString)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::reverseString::id) + .build(&StrStatic::reverseString)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::reverseString::id) + .build(&StrStatic::reverseString)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::reverseString::id) + .build(&StrStatic::reverseString)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::reverseString::id) + .build(&StrStatic::reverseString)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::reverseString::id) + .build(&StrStatic::reverseString)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::reverseString::id) + .build(&StrStatic::reverseString)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::reverseString::id) + .build(&StrStatic::reverseString)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::revStrConstRefArg::id) + .build(&StrStatic::revStrConstRefArg)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::revStrRValueRefArg::id) + .build(&StrStatic::revStrRValueRefArg)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::revStrNonConstRefArg::id) + .build(&StrStatic::revStrNonConstRefArg)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::revStrOverloadRefAndCRef::id) + .build(&StrStatic::revStrOverloadRefAndCRef)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::revStrOverloadRefAndCRef::id) + .build(&StrStatic::revStrOverloadRefAndCRef)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::revStrOverloadValRef::id) + .build(&StrStatic::revStrOverloadValRef)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::revStrOverloadValRef::id) + .build(&StrStatic::revStrOverloadValRef)); + } +} + diff --git a/CxxTestRegistration/src/regs6_StringConstOverload.cpp b/CxxTestRegistration/src/regs6_StringConstOverload.cpp new file mode 100644 index 00000000..9f140c25 --- /dev/null +++ b/CxxTestRegistration/src/regs6_StringConstOverload.cpp @@ -0,0 +1,24 @@ + + +#include "reg_ids.h" +#include "reg_decls.h" + +#include "StringConstOverload.h" + + +namespace regs6::type0 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::StrConstOverload::id) + .build()); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrConstOverload::fn::reverseString::id) + .build(&StrConstOverload::reverseString)); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConstOverload::fn::reverseString::id) + .build(&StrConstOverload::reverseString)); + } +} + diff --git a/CxxTestRegistration/src/regs7_StringOps.cpp b/CxxTestRegistration/src/regs7_StringOps.cpp new file mode 100644 index 00000000..09406c7f --- /dev/null +++ b/CxxTestRegistration/src/regs7_StringOps.cpp @@ -0,0 +1,64 @@ + + +#include "reg_ids.h" +#include "reg_decls.h" + +#include "StringOps.h" + + +namespace regs7::fn { + void init(std::vector& fns) { + + fns.push_back(rtl::type().function(cxx::fn::revStrOverloadValCRef::id) + .build(&revStrOverloadValCRef)); + + fns.push_back(rtl::type().function(cxx::fn::revStrOverloadValCRef::id) + .build(&revStrOverloadValCRef)); + + fns.push_back(rtl::type().function(cxx::fn::reverseString::id) + .build(&reverseString)); + + fns.push_back(rtl::type().function(cxx::fn::reverseString::id) + .build(&reverseString)); + + fns.push_back(rtl::type().function(cxx::fn::reverseString::id) + .build(&reverseString)); + + fns.push_back(rtl::type().function(cxx::fn::reverseString::id) + .build(&reverseString)); + + fns.push_back(rtl::type().function(cxx::fn::reverseString::id) + .build(&reverseString)); + + fns.push_back(rtl::type().function(cxx::fn::reverseString::id) + .build(&reverseString)); + + fns.push_back(rtl::type().function(cxx::fn::reverseString::id) + .build(&reverseString)); + + fns.push_back(rtl::type().function(cxx::fn::reverseString::id) + .build(&reverseString)); + + fns.push_back(rtl::type().function(cxx::fn::revStrConstRefArg::id) + .build(&revStrConstRefArg)); + + fns.push_back(rtl::type().function(cxx::fn::revStrRValueRefArg::id) + .build(&revStrRValueRefArg)); + + fns.push_back(rtl::type().function(cxx::fn::revStrNonConstRefArg::id) + .build(&revStrNonConstRefArg)); + + fns.push_back(rtl::type().function(cxx::fn::revStrOverloadRefAndCRef::id) + .build(&revStrOverloadRefAndCRef)); + + fns.push_back(rtl::type().function(cxx::fn::revStrOverloadRefAndCRef::id) + .build(&revStrOverloadRefAndCRef)); + + fns.push_back(rtl::type().function(cxx::fn::revStrOverloadValRef::id) + .build(&revStrOverloadValRef)); + + fns.push_back(rtl::type().function(cxx::fn::revStrOverloadValRef::id) + .build(&revStrOverloadValRef)); + } +} + diff --git a/CxxTestRegistration/src/regs8_StringWrap.cpp b/CxxTestRegistration/src/regs8_StringWrap.cpp new file mode 100644 index 00000000..7878f1bb --- /dev/null +++ b/CxxTestRegistration/src/regs8_StringWrap.cpp @@ -0,0 +1,86 @@ + + +#include "reg_ids.h" +#include "reg_decls.h" + +#include "StringWrap.h" + + +namespace regs8::type0 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::StrWrap::id) + .build()); + + fns.push_back(rtl::type().member() + .constructor().build()); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrWrap::fn::sstr::id) + .build(&StrWrap::sstr)); + } +} + + +namespace regs8::type1 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::StrWrapA::id) + .build()); + + fns.push_back(rtl::type().member() + .constructor().build()); + + fns.push_back(rtl::type().member() + .constructor().build()); + + fns.push_back(rtl::type().member() + .constructor().build()); + + fns.push_back(rtl::type().member() + .constructor().build()); + + fns.push_back(rtl::type().member() + .constructor().build()); + } +} + + +namespace regs8::type2 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::StrWrapB::id) + .build()); + + fns.push_back(rtl::type().member() + .constructor().build()); + + fns.push_back(rtl::type().member() + .constructor().build()); + } +} + + +namespace regs8::type3 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::StrWrapC::id) + .build()); + + fns.push_back(rtl::type().member() + .constructor().build()); + } +} + + +namespace regs8::type4 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::StrWrapD::id) + .build()); + + fns.push_back(rtl::type().member() + .constructor().build()); + } +} + diff --git a/CxxTestRegistration/src/regs9_Library.cpp b/CxxTestRegistration/src/regs9_Library.cpp new file mode 100644 index 00000000..7abaadc3 --- /dev/null +++ b/CxxTestRegistration/src/regs9_Library.cpp @@ -0,0 +1,33 @@ + + +#include "reg_ids.h" +#include "reg_decls.h" + +#include "Book.h" +#include "Library.h" + + +namespace regs9::type0 { + void init(std::vector& fns) { + + fns.push_back(rtl::type().record(cxx::type::Library::id) + .build()); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Library::fn::getBookByTitle::id) + .build(&Library::getBookByTitle)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Library::fn::getInstanceCount::id) + .build(&Library::getInstanceCount)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Library::fn::getBooksCount::id) + .build(&Library::getBooksCount)); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Library::fn::addBook::id) + .build(&Library::addBook)); + } +} + diff --git a/CxxTestUtils/inc/GlobalTestUtils.h b/CxxTestUtils/inc/GlobalTestUtils.h index 63457ac7..135ba098 100755 --- a/CxxTestUtils/inc/GlobalTestUtils.h +++ b/CxxTestUtils/inc/GlobalTestUtils.h @@ -25,7 +25,7 @@ namespace test_utils { static constexpr const char* str_revStrNonConstRefArg = "revStrNonConstRefArg"; static constexpr const char* str_revStrOverloadValRef = "revStrOverloadValRef"; static constexpr const char* str_revStrOverloadValCRef = "revStrOverloadValCRef"; - static constexpr const char* str_revStrOverloadValRefAndCRef = "revStrOverloadValRefAndCRef"; + static constexpr const char* str_revStrOverloadValRefAndCRef = "revStrOverloadRefAndCRef"; static constexpr const char* str_getComplexNumAsString = "getComplexNumAsString"; diff --git a/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp index 301bb4fc..f8d70d51 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp @@ -13,13 +13,12 @@ using namespace std; using namespace rtl; using namespace test_utils; -using namespace test_mirror; namespace rtl_tests { TEST(RTLInterfaceCxxMirror, get_class_methods_with_wrong_names) { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); optional badMethod = classBook->getMethod("no_method"); @@ -43,12 +42,12 @@ namespace rtl_tests auto [err, robj] = reflectedClass.ctorT<>()(rtl::alloc::Stack); - if (recordName == event::struct_) { + if (recordName == cxx::type::nsdate::Event::id) { //Event's default constructor is private or deleted. EXPECT_TRUE(err == rtl::error::TypeNotDefaultConstructible); ASSERT_TRUE(robj.isEmpty()); } - else if (recordName == library::class_) { + else if (recordName == cxx::type::Library::id) { //Library's copy-constructor is deleted or private. EXPECT_TRUE(err == rtl::error::TypeNotCopyConstructible); ASSERT_TRUE(robj.isEmpty()); @@ -58,12 +57,14 @@ namespace rtl_tests EXPECT_TRUE(err == rtl::error::TypeNotDefaultConstructible); ASSERT_TRUE(robj.isEmpty()); } - else if (recordName == StrWrapB::struct_ || - recordName == StrWrapC::struct_ || - recordName == StrWrapD::struct_) { - EXPECT_TRUE(err == rtl::error::TypeNotDefaultConstructible); + else if (recordName == cxx::type::StrWrap::id || + recordName == cxx::type::StrWrapB::id || + recordName == cxx::type::StrWrapC::id || + recordName == cxx::type::StrWrapD::id) { + EXPECT_TRUE(err == rtl::error::TypeNotDefaultConstructible); } else { + EXPECT_TRUE(err == rtl::error::None); ASSERT_FALSE(robj.isEmpty()); EXPECT_TRUE(robj.getTypeId() == recordId); @@ -75,7 +76,7 @@ namespace rtl_tests TEST(ReflectionMethodCall_heapInstance, wrong_args) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Heap); @@ -83,7 +84,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oSetAuthor = classBook->getMethod(book::str_setAuthor); + optional oSetAuthor = classBook->getMethod(cxx::type::Book::fn::setAuthor::id); ASSERT_TRUE(oSetAuthor); EXPECT_FALSE(oSetAuthor->hasSignature()); @@ -104,7 +105,7 @@ namespace rtl_tests TEST(ReflectionMethodCall_stackInstance, wrong_args) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Stack); @@ -133,7 +134,7 @@ namespace rtl_tests TEST(ClassBookMethod_heapInstance, args_void) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Stack); @@ -165,7 +166,7 @@ namespace rtl_tests TEST(ClassBookMethod_stackInstance, args_void) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Stack); @@ -197,7 +198,7 @@ namespace rtl_tests TEST(ClassBookMethod_heapInstance, args_string) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Heap); @@ -226,7 +227,7 @@ namespace rtl_tests TEST(ClassBookMethod_stackInstance, args_string) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Stack); @@ -255,7 +256,7 @@ namespace rtl_tests TEST(ClassBookMethodOverload_heapInstance, args_void) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Heap); @@ -284,7 +285,7 @@ namespace rtl_tests TEST(ClassBookMethodOverload_stackInstance, args_void) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Stack); @@ -313,7 +314,7 @@ namespace rtl_tests TEST(ClassBookMethodOverload_heapInstance, args_string_double_charPtr) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Heap); @@ -344,7 +345,7 @@ namespace rtl_tests TEST(ClassBookMethodOverload_stackInstance, args_string_double_charPtr) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Stack); @@ -375,7 +376,7 @@ namespace rtl_tests TEST(ClassBookMethodOverload_heapInstance, args_charPtr_double_string) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Heap); @@ -406,7 +407,7 @@ namespace rtl_tests TEST(ClassBookMethodOverload_stackInstance, args_charPtr_double_string) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Stack); @@ -437,7 +438,7 @@ namespace rtl_tests TEST(ClassBookMethodOverload_stackInstance, method_args_const_string___call_with_non_const_string) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Stack); @@ -470,7 +471,7 @@ namespace rtl_tests TEST(ClassBookMethodOverload_heapInstance, method_args_const_string___call_with_non_const_string) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Heap); @@ -503,7 +504,7 @@ namespace rtl_tests TEST(ClassBookMethodOverload_stackInstance, method_taking_args_const_string_and_const_string_ref) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Stack); @@ -540,7 +541,7 @@ namespace rtl_tests TEST(ClassBookMethodOverload_heapInstance, method_taking_args_const_string_and_const_string_ref) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Heap); diff --git a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp index 6d5da6fb..d47141cd 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp @@ -11,7 +11,7 @@ using namespace std; using namespace rtl; using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp index 5ae96280..478eea66 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp @@ -10,7 +10,7 @@ using namespace std; using namespace rtl; using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp index 1113fbf8..3c06cd80 100644 --- a/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp @@ -10,7 +10,7 @@ using namespace std; using namespace rtl; using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp index 2695339b..1c424e0b 100644 --- a/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp @@ -9,7 +9,7 @@ using namespace std; using namespace rtl; using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp b/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp index 061305d1..9cf3ab1f 100644 --- a/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp @@ -11,7 +11,7 @@ using namespace std; using namespace rtl; using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp b/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp index bb743143..d2860be0 100644 --- a/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp @@ -27,7 +27,7 @@ using namespace std; using namespace rtl; using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp index 809b78d6..a77b3608 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp @@ -29,7 +29,7 @@ using namespace std; using namespace rtl; using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp b/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp index 1f594f0c..940ef651 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp @@ -6,7 +6,7 @@ #include "TestUtilsDate.h" using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp b/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp index a9e80956..723dd918 100644 --- a/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp @@ -9,7 +9,7 @@ using namespace std; using namespace rtl; using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_ConstMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_ConstMethod.cpp index 3603a545..e173e78b 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_ConstMethod.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_ConstMethod.cpp @@ -7,7 +7,7 @@ #include "../CxxTestProps/inc/StringConst.h" using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { @@ -23,6 +23,10 @@ namespace rtl_tests .argsT<>() .returnT(); EXPECT_FALSE(is_empty); + + // TODO: this should return proper error that the 'const' version is present but non-const not. + EXPECT_EQ(is_empty.get_init_error(), rtl::error::SignatureMismatch); + } { rtl::const_method is_empty = isStringEmpty->targetT() .argsT<>() diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp index f59e35db..0624bb19 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp @@ -8,7 +8,7 @@ using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Method.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Method.cpp index 8013e060..fd5662e8 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Method.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Method.cpp @@ -9,7 +9,7 @@ #include "../CxxTestProps/inc/StringMute.h" using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_StaticMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_StaticMethod.cpp index b8009f6d..2e2247b0 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_StaticMethod.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_StaticMethod.cpp @@ -9,7 +9,7 @@ #include "../CxxTestProps/inc/StringStatic.h" using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnAndTargetErased_ConstMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnAndTargetErased_ConstMethod.cpp index a68000d9..f5a8d8d0 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnAndTargetErased_ConstMethod.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnAndTargetErased_ConstMethod.cpp @@ -7,7 +7,7 @@ #include "../CxxTestProps/inc/StringConstOverload.h" using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Constructor.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Constructor.cpp index 4957d63c..c2ee4c23 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Constructor.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Constructor.cpp @@ -7,7 +7,7 @@ #include "../CxxTestProps/inc/StringWrap.h" using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp index 2cfd9420..70aaeca4 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp @@ -8,7 +8,7 @@ #include "GlobalTestUtils.h" using namespace test_utils; -using namespace test_mirror; + // TODO: test cases for functions with return type 'void'. diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Method.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Method.cpp index c2fb873e..be7930f6 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Method.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Method.cpp @@ -9,7 +9,7 @@ #include "../CxxTestProps/inc/StringMute.h" using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_StaticMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_StaticMethod.cpp index c75d8796..94253959 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_StaticMethod.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_StaticMethod.cpp @@ -10,7 +10,7 @@ #include "../CxxTestProps/inc/StringStatic.h" using namespace test_utils; -using namespace test_mirror; + namespace rtl_tests { diff --git a/ReflectionTemplateLib/rtl/detail/src/CxxReflection.cpp b/ReflectionTemplateLib/rtl/detail/src/CxxReflection.cpp index 41b50d01..97d6b7a2 100644 --- a/ReflectionTemplateLib/rtl/detail/src/CxxReflection.cpp +++ b/ReflectionTemplateLib/rtl/detail/src/CxxReflection.cpp @@ -190,7 +190,7 @@ namespace rtl { } return true; } - return false; + return (memberKind == member::UserCtor || memberKind == member::DefaultCtor); } } } \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/inc/CxxMirror.h b/ReflectionTemplateLib/rtl/inc/CxxMirror.h index a2222ff7..c3045d98 100644 --- a/ReflectionTemplateLib/rtl/inc/CxxMirror.h +++ b/ReflectionTemplateLib/rtl/inc/CxxMirror.h @@ -57,9 +57,9 @@ namespace rtl std::optional getRecord(const traits::uid_t pRecordId) const; // Returns a valid Record if the type is found by name in default namespace group; otherwise, std::nullopt. - std::optional getRecord(const std::string& pRecordName) const; + std::optional getRecord(const std::string_view pRecordName) const; // Returns a valid Function if found by name in default namespace group; otherwise, std::nullopt. - std::optional getFunction(const std::string& pFunctionName) const; + std::optional getFunction(const std::string_view pFunctionName) const; }; } \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/inc/Record.h b/ReflectionTemplateLib/rtl/inc/Record.h index dd40cc89..7ee5d64a 100644 --- a/ReflectionTemplateLib/rtl/inc/Record.h +++ b/ReflectionTemplateLib/rtl/inc/Record.h @@ -59,9 +59,9 @@ namespace rtl @param: const std::string& (name of the method) @return: std::optional * if the method isn't found by the given name, std::nullopt is returned. -*/ std::optional getMethod(const std::string& pMethod) const +*/ std::optional getMethod(std::string_view pMethod) const { - const auto& itr = m_methods.find(pMethod); + const auto& itr = m_methods.find(std::string(pMethod)); if (itr != m_methods.end()) { return std::optional(itr->second); } diff --git a/ReflectionTemplateLib/rtl/src/CxxMirror.cpp b/ReflectionTemplateLib/rtl/src/CxxMirror.cpp index e00cf5d1..c30b649d 100644 --- a/ReflectionTemplateLib/rtl/src/CxxMirror.cpp +++ b/ReflectionTemplateLib/rtl/src/CxxMirror.cpp @@ -48,10 +48,10 @@ namespace rtl * Returns a valid Record if the type is found by name in the given namespace group; otherwise, std::nullopt. * * Retrieves the class or struct registered under the specified namespace. */ - std::optional CxxMirror::getRecord(const std::string& pRecordName) const + std::optional CxxMirror::getRecord(const std::string_view pRecordName) const { const auto& recordMap = getRecordsMap(); - const auto& itr = recordMap.find(pRecordName); + const auto& itr = recordMap.find(std::string(pRecordName)); if (itr != recordMap.end()) { return std::make_optional(itr->second); } @@ -67,10 +67,10 @@ namespace rtl * Returns a valid Function if found by name in the given namespace group; otherwise, std::nullopt. * * Retrieves the non-member function registered under the specified namespace. */ - std::optional CxxMirror::getFunction(const std::string& pFunctionName) const + std::optional CxxMirror::getFunction(const std::string_view pFunctionName) const { const auto& functionMap = getFunctionsMap(); - const auto& itr = functionMap.find(pFunctionName); + const auto& itr = functionMap.find(std::string(pFunctionName)); if (itr != functionMap.end()) { return std::make_optional(itr->second); } From d4dd2e4b937240db2329c50beb02493fdf3ba8fd Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Mon, 9 Feb 2026 15:33:43 +0530 Subject: [PATCH 02/16] clang-mirror generated IDs integration. --- CxxTestUtils/inc/TestUtilsBook.h | 9 ------ .../CxxMirrorTests/CxxMirrorThreadingTest.cpp | 20 ++++++------ .../FunctionalityTests/ClassMethodsTests.cpp | 30 ++++++++--------- .../ConstMethodOverloadTests.cpp | 2 +- .../FunctionalityTests/ConstructorTests.cpp | 16 +++++----- .../CopyConstructorTests.cpp | 32 +++++++++---------- .../ReflectionOpErrorCodeTests.cpp | 12 +++---- 7 files changed, 57 insertions(+), 64 deletions(-) diff --git a/CxxTestUtils/inc/TestUtilsBook.h b/CxxTestUtils/inc/TestUtilsBook.h index 1b380af2..2d400b00 100644 --- a/CxxTestUtils/inc/TestUtilsBook.h +++ b/CxxTestUtils/inc/TestUtilsBook.h @@ -33,15 +33,6 @@ namespace test_utils static constexpr const char* PREFACE = "This is a preface."; static constexpr const char* ACKNOWLEDGEMENTS = "This is an acknowledgement."; - static constexpr const char* class_ = "Book"; - static constexpr const char* str_setAuthor = "setAuthor"; - static constexpr const char* str_addPreface = "addPreface"; - static constexpr const char* str_setDescription = "setDescription"; - static constexpr const char* str_getPublishedOn = "getPublishedOn"; - static constexpr const char* str_setPublishedOn = "setPublishedOn"; - static constexpr const char* str_updateBookInfo = "updateBookInfo"; - static constexpr const char* str_addCopyrightTag = "addCopyrightTag"; - static const int get_book_instance_count(); static const bool assert_zero_instance_count(); diff --git a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp index e38f677d..7306a410 100644 --- a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp +++ b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp @@ -14,6 +14,8 @@ #include "../../CxxTestProps/inc/StringOps.h" #include "../MyReflectionTests/MyReflectingType.h" +#include "reg_ids.h" + #include "TestUtilsBook.h" #include "TestUtilsDate.h" #include "TestUtilsPerson.h" @@ -156,25 +158,25 @@ namespace rtl_tests { auto _ = rtl::CxxMirror({ - rtl::type().record(book::class_).build(), + rtl::type().record(cxx::type::Book::id).build(), rtl::type().member().constructor().build(), - rtl::type().member().method(book::str_setAuthor).build(&Book::setAuthor), + rtl::type().member().method(cxx::type::Book::fn::setAuthor::id).build(&Book::setAuthor), - rtl::type().member().method(book::str_addPreface).build(&Book::addPreface), + rtl::type().member().method(cxx::type::Book::fn::addPreface::id).build(&Book::addPreface), - rtl::type().member().method(book::str_setDescription).build(&Book::setDescription), + rtl::type().member().method(cxx::type::Book::fn::setDescription::id).build(&Book::setDescription), - rtl::type().member().method(book::str_getPublishedOn).build(&Book::getPublishedOn), + rtl::type().member().method(cxx::type::Book::fn::getPublishedOn::id).build(&Book::getPublishedOn), - rtl::type().member().method(book::str_addCopyrightTag).build(&Book::addCopyrightTag), + rtl::type().member().method(cxx::type::Book::fn::addCopyrightTag::id).build(&Book::addCopyrightTag), - rtl::type().member().method(book::str_updateBookInfo).build(&Book::updateBookInfo), + rtl::type().member().method(cxx::type::Book::fn::updateBookInfo::id).build(&Book::updateBookInfo), - rtl::type().member().method(book::str_updateBookInfo).build(&Book::updateBookInfo), + rtl::type().member().method(cxx::type::Book::fn::updateBookInfo::id).build(&Book::updateBookInfo), - rtl::type().member().method(book::str_updateBookInfo).build(&Book::updateBookInfo) + rtl::type().member().method(cxx::type::Book::fn::updateBookInfo::id).build(&Book::updateBookInfo) }); std::cout << "\n [t0]\trtl_tests::InitMirror::reflectingBook() ==> Done.\n"; diff --git a/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp index f8d70d51..07423656 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp @@ -113,7 +113,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oSetAuthor = classBook->getMethod(book::str_setAuthor); + optional oSetAuthor = classBook->getMethod(cxx::type::Book::fn::setAuthor::id); ASSERT_TRUE(oSetAuthor); EXPECT_FALSE(oSetAuthor->hasSignature()); @@ -142,7 +142,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oGetPublishedOn = classBook->getMethod(book::str_getPublishedOn); + optional oGetPublishedOn = classBook->getMethod(cxx::type::Book::fn::getPublishedOn::id); ASSERT_TRUE(oGetPublishedOn); EXPECT_TRUE(oGetPublishedOn->hasSignature<>()); //empty template params checks for zero arguments. @@ -174,7 +174,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oGetPublishedOn = classBook->getMethod(book::str_getPublishedOn); + optional oGetPublishedOn = classBook->getMethod(cxx::type::Book::fn::getPublishedOn::id); ASSERT_TRUE(oGetPublishedOn); EXPECT_TRUE(oGetPublishedOn->hasSignature<>()); //empty template params checks for zero arguments. @@ -206,7 +206,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oSetAuthor = classBook->getMethod(book::str_setAuthor); + optional oSetAuthor = classBook->getMethod(cxx::type::Book::fn::setAuthor::id); ASSERT_TRUE(oSetAuthor); EXPECT_TRUE(oSetAuthor->hasSignature()); @@ -235,7 +235,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oSetAuthor = classBook->getMethod(book::str_setAuthor); + optional oSetAuthor = classBook->getMethod(cxx::type::Book::fn::setAuthor::id); ASSERT_TRUE(oSetAuthor); EXPECT_TRUE(oSetAuthor->hasSignature()); @@ -264,7 +264,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oUpdateBookInfo = classBook->getMethod(book::str_updateBookInfo); + optional oUpdateBookInfo = classBook->getMethod(cxx::type::Book::fn::updateBookInfo::id); ASSERT_TRUE(oUpdateBookInfo); EXPECT_TRUE(oUpdateBookInfo->hasSignature<>()); //empty template params checks for zero arguments. @@ -293,7 +293,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oUpdateBookInfo = classBook->getMethod(book::str_updateBookInfo); + optional oUpdateBookInfo = classBook->getMethod(cxx::type::Book::fn::updateBookInfo::id); ASSERT_TRUE(oUpdateBookInfo); EXPECT_TRUE(oUpdateBookInfo->hasSignature<>()); //empty template params checks for zero arguments. @@ -322,7 +322,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oUpdateBookInfo = classBook->getMethod(book::str_updateBookInfo); + optional oUpdateBookInfo = classBook->getMethod(cxx::type::Book::fn::updateBookInfo::id); ASSERT_TRUE(oUpdateBookInfo); EXPECT_TRUE((oUpdateBookInfo->hasSignature())); @@ -353,7 +353,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oUpdateBookInfo = classBook->getMethod(book::str_updateBookInfo); + optional oUpdateBookInfo = classBook->getMethod(cxx::type::Book::fn::updateBookInfo::id); ASSERT_TRUE(oUpdateBookInfo); EXPECT_TRUE((oUpdateBookInfo->hasSignature())); @@ -384,7 +384,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oUpdateBookInfo = classBook->getMethod(book::str_updateBookInfo); + optional oUpdateBookInfo = classBook->getMethod(cxx::type::Book::fn::updateBookInfo::id); ASSERT_TRUE(oUpdateBookInfo); EXPECT_TRUE((oUpdateBookInfo->hasSignature())); @@ -415,7 +415,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oUpdateBookInfo = classBook->getMethod(book::str_updateBookInfo); + optional oUpdateBookInfo = classBook->getMethod(cxx::type::Book::fn::updateBookInfo::id); ASSERT_TRUE(oUpdateBookInfo); EXPECT_TRUE((oUpdateBookInfo->hasSignature())); @@ -446,7 +446,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oAddCopyrightTag = classBook->getMethod(book::str_addCopyrightTag); + optional oAddCopyrightTag = classBook->getMethod(cxx::type::Book::fn::addCopyrightTag::id); ASSERT_TRUE(oAddCopyrightTag); EXPECT_TRUE(oAddCopyrightTag->hasSignature()); @@ -479,7 +479,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oAddCopyrightTag = classBook->getMethod(book::str_addCopyrightTag); + optional oAddCopyrightTag = classBook->getMethod(cxx::type::Book::fn::addCopyrightTag::id); ASSERT_TRUE(oAddCopyrightTag); EXPECT_TRUE((oAddCopyrightTag->hasSignature())); @@ -512,7 +512,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oAddPreface = classBook->getMethod(book::str_addPreface); + optional oAddPreface = classBook->getMethod(cxx::type::Book::fn::addPreface::id); ASSERT_TRUE(oAddPreface); EXPECT_FALSE((oAddPreface->hasSignature())); EXPECT_FALSE((oAddPreface->hasSignature())); @@ -549,7 +549,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oAddPreface = classBook->getMethod(book::str_addPreface); + optional oAddPreface = classBook->getMethod(cxx::type::Book::fn::addPreface::id); ASSERT_TRUE(oAddPreface); EXPECT_FALSE((oAddPreface->hasSignature())); EXPECT_FALSE((oAddPreface->hasSignature())); diff --git a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp index d47141cd..9d7f818a 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp @@ -18,7 +18,7 @@ namespace rtl_tests TEST(ConstMethodOverload, explicitly_making_const_call__on_wrong_target) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT()(alloc::Stack); diff --git a/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp index 478eea66..ebc26389 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp @@ -209,7 +209,7 @@ namespace rtl_tests TEST(HeapAllocConstructorBook, wrong_args) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err, book] = classBook->ctorT()(alloc::Heap, 19.0, 87.5); @@ -225,7 +225,7 @@ namespace rtl_tests TEST(StackAllocConstructorBook, wrong_args) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err, book] = classBook->ctorT()(alloc::Stack, 19.0, 87.5); @@ -241,7 +241,7 @@ namespace rtl_tests TEST(HeapAllocConstructorBook, args_default) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err, book] = classBook->ctorT()(alloc::Heap); @@ -258,7 +258,7 @@ namespace rtl_tests TEST(StackAllocConstructorBook, args_default) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err, book] = classBook->ctorT()(alloc::Stack); @@ -275,7 +275,7 @@ namespace rtl_tests TEST(HeapAllocConstructorBook, args_double_string) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); rtl::constructor ctorT = classBook->ctorT(); @@ -295,7 +295,7 @@ namespace rtl_tests TEST(StackAllocConstructorBook, args_double_string) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); rtl::constructor ctorT = classBook->ctorT(); @@ -315,7 +315,7 @@ namespace rtl_tests TEST(DestructorBook, non_virtual_on_heap) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err, book] = classBook->ctorT()(alloc::Heap); @@ -332,7 +332,7 @@ namespace rtl_tests TEST(DestructorBook, non_virtual_on_stack) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err, book] = classBook->ctorT()(alloc::Stack); diff --git a/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp index 3c06cd80..7cddeebd 100644 --- a/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp @@ -17,7 +17,7 @@ namespace rtl_tests TEST(CopyConstructor, clone_default_instance_on_heap_source_on_heap) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book0] = classBook->ctorT()(alloc::Heap); @@ -42,7 +42,7 @@ namespace rtl_tests TEST(CopyConstructor, clone_default_instance_on_stack_source_on_stack) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book0] = classBook->ctorT()(alloc::Stack); @@ -65,7 +65,7 @@ namespace rtl_tests TEST(CopyConstructor, clone_default_instance_on_heap_source_on_stack) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book0] = classBook->ctorT()(alloc::Stack); @@ -88,7 +88,7 @@ namespace rtl_tests TEST(CopyConstructor, clone_default_instance_on_stack_source_on_heap) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book0] = classBook->ctorT()(alloc::Heap); @@ -111,7 +111,7 @@ namespace rtl_tests TEST(CopyConstructor, clone_mutated_instance_on_heap_source_on_heap) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); rtl::constructor ctorT = classBook->ctorT(); @@ -120,7 +120,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); { - optional oSetAuthor = classBook->getMethod(book::str_setAuthor); + optional oSetAuthor = classBook->getMethod(cxx::type::Book::fn::setAuthor::id); ASSERT_TRUE(oSetAuthor); auto setAuthor = oSetAuthor->targetT().argsT().returnT(); @@ -129,7 +129,7 @@ namespace rtl_tests EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } { - optional oSetDescription = classBook->getMethod(book::str_setDescription); + optional oSetDescription = classBook->getMethod(cxx::type::Book::fn::setDescription::id); ASSERT_TRUE(oSetDescription); auto setDescription = oSetDescription->targetT().argsT().returnT(); @@ -156,7 +156,7 @@ namespace rtl_tests TEST(CopyConstructor, clone_mutated_instance_on_stack_source_on_stack) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); rtl::constructor ctorT = classBook->ctorT(); @@ -165,7 +165,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); { - optional oSetAuthor = classBook->getMethod(book::str_setAuthor); + optional oSetAuthor = classBook->getMethod(cxx::type::Book::fn::setAuthor::id); ASSERT_TRUE(oSetAuthor); auto setAuthor = oSetAuthor->targetT().argsT().returnT(); @@ -174,7 +174,7 @@ namespace rtl_tests EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } { - optional oSetDescription = classBook->getMethod(book::str_setDescription); + optional oSetDescription = classBook->getMethod(cxx::type::Book::fn::setDescription::id); ASSERT_TRUE(oSetDescription); auto setDescription = oSetDescription->targetT().argsT().returnT(); @@ -201,7 +201,7 @@ namespace rtl_tests TEST(CopyConstructor, clone_mutated_instance_on_heap_source_on_stack) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); rtl::constructor ctorT = classBook->ctorT(); @@ -210,7 +210,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); { - optional oSetAuthor = classBook->getMethod(book::str_setAuthor); + optional oSetAuthor = classBook->getMethod(cxx::type::Book::fn::setAuthor::id); ASSERT_TRUE(oSetAuthor); auto setAuthor = oSetAuthor->targetT().argsT().returnT(); @@ -219,7 +219,7 @@ namespace rtl_tests EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } { - optional oSetDescription = classBook->getMethod(book::str_setDescription); + optional oSetDescription = classBook->getMethod(cxx::type::Book::fn::setDescription::id); ASSERT_TRUE(oSetDescription); auto setDescription = oSetDescription->targetT().argsT().returnT(); @@ -246,7 +246,7 @@ namespace rtl_tests TEST(CopyConstructor, clone_mutated_instance_on_stack_source_on_heap) { { - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); rtl::constructor ctorT = classBook->ctorT(); @@ -255,7 +255,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); { - optional oSetAuthor = classBook->getMethod(book::str_setAuthor); + optional oSetAuthor = classBook->getMethod(cxx::type::Book::fn::setAuthor::id); ASSERT_TRUE(oSetAuthor); auto setAuthor = oSetAuthor->targetT().argsT().returnT(); @@ -264,7 +264,7 @@ namespace rtl_tests EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } { - optional oSetDescription = classBook->getMethod(book::str_setDescription); + optional oSetDescription = classBook->getMethod(cxx::type::Book::fn::setDescription::id); ASSERT_TRUE(oSetDescription); auto setDescription = oSetDescription->targetT().argsT().returnT(); diff --git a/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp index a77b3608..185b19b1 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp @@ -287,10 +287,10 @@ namespace rtl_tests RObject emptyObj; ASSERT_TRUE(emptyObj.isEmpty()); - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); - auto [err, ret] = classBook->getMethod(book::str_getPublishedOn) + auto [err, ret] = classBook->getMethod(cxx::type::Book::fn::getPublishedOn::id) ->targetT().argsT().returnT()(emptyObj)(); EXPECT_TRUE(err == error::EmptyRObject); @@ -306,14 +306,14 @@ namespace rtl_tests optional classPerson = cxx::mirror().getRecord(person::class_); ASSERT_TRUE(classPerson); - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, person] = classPerson->ctorT()(alloc::Heap); EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(person.isEmpty()); - optional oGetPublishedOn = classBook->getMethod(book::str_getPublishedOn); + optional oGetPublishedOn = classBook->getMethod(cxx::type::Book::fn::getPublishedOn::id); ASSERT_TRUE(oGetPublishedOn); rtl::method getPublishedOn = oGetPublishedOn->targetT().argsT().returnT(); @@ -334,14 +334,14 @@ namespace rtl_tests optional classPerson = cxx::mirror().getRecord(person::class_); ASSERT_TRUE(classPerson); - optional classBook = cxx::mirror().getRecord(book::class_); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, person] = classPerson->ctorT()(alloc::Stack); EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(person.isEmpty()); - optional oGetPublishedOn = classBook->getMethod(book::str_getPublishedOn); + optional oGetPublishedOn = classBook->getMethod(cxx::type::Book::fn::getPublishedOn::id); ASSERT_TRUE(oGetPublishedOn); rtl::method getPublishedOn = oGetPublishedOn->targetT().argsT().returnT(); From 79aeab3351bcaab1bd1e5855ee9ac29aac7c0f85 Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Mon, 9 Feb 2026 15:52:41 +0530 Subject: [PATCH 03/16] clang-mirror generated IDs integration. --- CxxTestRegistration/inc/TestMirrorProvider.h | 2 +- .../src/TestMirrorProvider.cpp | 2 +- CxxTestUtils/inc/TestUtilsDate.h | 11 ------- .../CxxMirrorTests/CxxMirrorThreadingTest.cpp | 18 +++++------ .../FunctionalityTests/ConstructorTests.cpp | 22 ++++++------- .../CopyConstructorTests.cpp | 32 +++++++++---------- .../MoveConstructorTests.cpp | 12 +++---- .../ReflectionOpErrorCodeTests.cpp | 4 +-- .../ReturnValueReflectionTest.cpp | 4 +-- 9 files changed, 48 insertions(+), 59 deletions(-) diff --git a/CxxTestRegistration/inc/TestMirrorProvider.h b/CxxTestRegistration/inc/TestMirrorProvider.h index 2353ff4a..a825f3de 100644 --- a/CxxTestRegistration/inc/TestMirrorProvider.h +++ b/CxxTestRegistration/inc/TestMirrorProvider.h @@ -12,5 +12,5 @@ namespace cxx { const rtl::CxxMirror& mirror(); - const rtl::traits::uid_t reflected_id(const std::string& pRecordName); + const rtl::traits::uid_t reflected_id(const std::string_view pRecordName); }; diff --git a/CxxTestRegistration/src/TestMirrorProvider.cpp b/CxxTestRegistration/src/TestMirrorProvider.cpp index e69caa42..f07acb5f 100644 --- a/CxxTestRegistration/src/TestMirrorProvider.cpp +++ b/CxxTestRegistration/src/TestMirrorProvider.cpp @@ -123,7 +123,7 @@ const rtl::CxxMirror& cxx::mirror() return cxx_mirror; } -const rtl::traits::uid_t cxx::reflected_id(const std::string& pRecordName) +const rtl::traits::uid_t cxx::reflected_id(const std::string_view pRecordName) { static std::unordered_map nameIdMap = { diff --git a/CxxTestUtils/inc/TestUtilsDate.h b/CxxTestUtils/inc/TestUtilsDate.h index 452efcb2..c1319344 100644 --- a/CxxTestUtils/inc/TestUtilsDate.h +++ b/CxxTestUtils/inc/TestUtilsDate.h @@ -25,13 +25,6 @@ namespace test_utils struct calender { - static constexpr const char* struct_ = "nsdate::Calender"; - static constexpr const char* str_create = "create"; - static constexpr const char* str_getTheDate = "getTheDate"; - static constexpr const char* str_getSavedDate = "getSavedDate"; - static constexpr const char* str_getTheEvent = "getTheEvent"; - static constexpr const char* str_getSavedEvent = "getSavedEvent"; - static void reset_move_ops_counter(); static const bool assert_zero_instance_count(); static const std::size_t get_instance_count(); @@ -46,10 +39,6 @@ namespace test_utils static constexpr const char* DATE_STR0 = "23/12/2024"; static constexpr const char* DATE_STR1 = "04/05/2025"; - static constexpr const char* struct_ = "nsdate::Date"; - static constexpr const char* str_updateDate = "updateDate"; - static constexpr const char* str_getAsString = "getAsString"; - static const std::size_t get_instance_count(); static const bool test_if_obejcts_are_equal(const rtl::RObject& pInstance0, const rtl::RObject& pInstance1); diff --git a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp index 7306a410..2306e382 100644 --- a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp +++ b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp @@ -60,15 +60,15 @@ namespace rtl_tests { auto _ = rtl::CxxMirror({ - rtl::type().record(date::struct_).build(), + rtl::type().record(cxx::type::nsdate::Date::id).build(), rtl::type().member().constructor().build(), rtl::type().member().constructor().build(), - rtl::type().member().method(date::str_updateDate).build(&nsdate::Date::updateDate), + rtl::type().member().method(cxx::type::nsdate::Date::fn::updateDate::id).build(&nsdate::Date::updateDate), - rtl::type().member().methodConst(date::str_getAsString).build(&nsdate::Date::getAsString) + rtl::type().member().methodConst(cxx::type::nsdate::Date::fn::getAsString::id).build(&nsdate::Date::getAsString) }); std::cout << "\n [t1]\trtl_tests::InitMirror::reflectingDate() ==> Done.\n"; @@ -79,17 +79,17 @@ namespace rtl_tests { auto _ = rtl::CxxMirror({ - rtl::type().record(calender::struct_).build(), + rtl::type().record(cxx::type::nsdate::Calender::id).build(), - rtl::type().member().methodStatic(calender::str_create).build(&nsdate::Calender::create), + rtl::type().member().methodStatic(cxx::type::nsdate::Calender::fn::create::id).build(&nsdate::Calender::create), - rtl::type().member().method(calender::str_getTheEvent).build(&nsdate::Calender::getTheEvent), + rtl::type().member().method(cxx::type::nsdate::Calender::fn::getTheEvent::id).build(&nsdate::Calender::getTheEvent), - rtl::type().member().method(calender::str_getTheDate).build(&nsdate::Calender::getTheDate), + rtl::type().member().method(cxx::type::nsdate::Calender::fn::getTheDate::id).build(&nsdate::Calender::getTheDate), - rtl::type().member().method(calender::str_getSavedEvent).build(&nsdate::Calender::getSavedEvent), + rtl::type().member().method(cxx::type::nsdate::Calender::fn::getSavedEvent::id).build(&nsdate::Calender::getSavedEvent), - rtl::type().member().method(calender::str_getSavedDate).build(&nsdate::Calender::getSavedDate) + rtl::type().member().method(cxx::type::nsdate::Calender::fn::getSavedDate::id).build(&nsdate::Calender::getSavedDate) }); std::cout << "\n [t7]\trtl_tests::InitMirror::reflectingCalender() ==> Done.\n"; diff --git a/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp index ebc26389..02d633af 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp @@ -19,7 +19,7 @@ namespace rtl_tests optional badFunc = cxx::mirror().getFunction("wrong_date_struct"); EXPECT_FALSE(badFunc); - optional badRec = cxx::mirror().getRecord("wrong" + std::string(date::struct_)); + optional badRec = cxx::mirror().getRecord("wrong" + std::string(cxx::type::nsdate::Date::id)); EXPECT_FALSE(badRec); } @@ -27,7 +27,7 @@ namespace rtl_tests TEST(HeapAllocConstructorDate, wrong_args) { { - optional classDate = cxx::mirror().getRecord(date::struct_); + optional classDate = cxx::mirror().getRecord(cxx::type::nsdate::Date::id); ASSERT_TRUE(classDate); rtl::constructor ctorT = classDate->ctorT(); @@ -44,7 +44,7 @@ namespace rtl_tests TEST(StackAllocConstructorDate, wrong_args) { { - optional classDate = cxx::mirror().getRecord(date::struct_); + optional classDate = cxx::mirror().getRecord(cxx::type::nsdate::Date::id); ASSERT_TRUE(classDate); rtl::constructor ctorT = classDate->ctorT(); @@ -61,7 +61,7 @@ namespace rtl_tests TEST(HeapAllocConstructorDate, args_void) { { - optional classDate = cxx::mirror().getRecord(date::struct_); + optional classDate = cxx::mirror().getRecord(cxx::type::nsdate::Date::id); ASSERT_TRUE(classDate); auto [err, date] = classDate->ctorT()(alloc::Heap); @@ -78,7 +78,7 @@ namespace rtl_tests TEST(StackAllocConstructorDate, args_void) { { - optional classDate = cxx::mirror().getRecord(date::struct_); + optional classDate = cxx::mirror().getRecord(cxx::type::nsdate::Date::id); ASSERT_TRUE(classDate); auto [err, date] = classDate->ctorT()(alloc::Stack); @@ -95,7 +95,7 @@ namespace rtl_tests TEST(HeapAllocConstructorDate, args_string) { { - optional classDate = cxx::mirror().getRecord(date::struct_); + optional classDate = cxx::mirror().getRecord(cxx::type::nsdate::Date::id); ASSERT_TRUE(classDate); rtl::constructor ctorT = classDate->ctorT(); @@ -113,7 +113,7 @@ namespace rtl_tests TEST(StackAllocConstructorDate, args_string) { { - optional classDate = cxx::mirror().getRecord(date::struct_); + optional classDate = cxx::mirror().getRecord(cxx::type::nsdate::Date::id); ASSERT_TRUE(classDate); rtl::constructor ctorT = classDate->ctorT(); @@ -131,7 +131,7 @@ namespace rtl_tests TEST(HeapAllocConstructorDate, args_unsigned_unsigned_unsigned) { { - optional classDate = cxx::mirror().getRecord(date::struct_); + optional classDate = cxx::mirror().getRecord(cxx::type::nsdate::Date::id); ASSERT_TRUE(classDate); auto ctorT = classDate->ctorT(); @@ -151,7 +151,7 @@ namespace rtl_tests TEST(StackAllocConstructorDate, args_unsigned_unsigned_unsigned) { { - optional classDate = cxx::mirror().getRecord(date::struct_); + optional classDate = cxx::mirror().getRecord(cxx::type::nsdate::Date::id); ASSERT_TRUE(classDate); unsigned day = date::DAY; @@ -175,7 +175,7 @@ namespace rtl_tests TEST(DestructorDate, non_virtual_on_heap) { { - optional classDate = cxx::mirror().getRecord(date::struct_); + optional classDate = cxx::mirror().getRecord(cxx::type::nsdate::Date::id); ASSERT_TRUE(classDate); auto [err, date] = classDate->ctorT()(alloc::Heap); @@ -192,7 +192,7 @@ namespace rtl_tests TEST(DestructorDate, non_virtual_on_stack) { { - optional classDate = cxx::mirror().getRecord(date::struct_); + optional classDate = cxx::mirror().getRecord(cxx::type::nsdate::Date::id); ASSERT_TRUE(classDate); auto [err, date] = classDate->ctorT()(alloc::Stack); diff --git a/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp index 7cddeebd..27291fa3 100644 --- a/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp @@ -292,7 +292,7 @@ namespace rtl_tests { { // Retrieve the reflected Record for the 'Calender' struct - optional typeCalender = cxx::mirror().getRecord(calender::struct_); + optional typeCalender = cxx::mirror().getRecord(cxx::type::nsdate::Calender::id); ASSERT_TRUE(typeCalender); // Create a stack-allocated object via reflection @@ -324,7 +324,7 @@ namespace rtl_tests // 'Event' has a unique_ptr and 3 'Event' instances exists, So- EXPECT_TRUE(date::get_instance_count() == 3); - optional oGetTheDate = typeCalender->getMethod(calender::str_getTheDate); + optional oGetTheDate = typeCalender->getMethod(cxx::type::nsdate::Calender::fn::getTheDate::id); ASSERT_TRUE(oGetTheDate); rtl::method getTheDate = oGetTheDate->targetT().argsT().returnT(); @@ -345,10 +345,10 @@ namespace rtl_tests // both objects must be equal (shared via shared_ptr inside 'Calender') EXPECT_TRUE(date::test_if_obejcts_are_equal(date0, date1)); - optional structDate = cxx::mirror().getRecord(date::struct_); + optional structDate = cxx::mirror().getRecord(cxx::type::nsdate::Date::id); ASSERT_TRUE(structDate); - optional oUpdateDate = structDate->getMethod(date::str_updateDate); + optional oUpdateDate = structDate->getMethod(cxx::type::nsdate::Date::fn::updateDate::id); ASSERT_TRUE(oUpdateDate); method updateDate = oUpdateDate->targetT().argsT().returnT(); @@ -373,7 +373,7 @@ namespace rtl_tests { { // Retrieve the reflected Record for the 'Calender' struct - optional typeCalender = cxx::mirror().getRecord(calender::struct_); + optional typeCalender = cxx::mirror().getRecord(cxx::type::nsdate::Calender::id); ASSERT_TRUE(typeCalender); // Create a stack-allocated object via reflection @@ -405,7 +405,7 @@ namespace rtl_tests // 'Event' has a unique_ptr and 3 'Event' instances exists, So- EXPECT_TRUE(date::get_instance_count() == 3); - optional oGetTheDate = typeCalender->getMethod(calender::str_getTheDate); + optional oGetTheDate = typeCalender->getMethod(cxx::type::nsdate::Calender::fn::getTheDate::id); ASSERT_TRUE(oGetTheDate); rtl::method getTheDate = oGetTheDate->targetT().argsT().returnT(); @@ -426,10 +426,10 @@ namespace rtl_tests // both objects must be equal (shared via shared_ptr inside 'Calender') EXPECT_TRUE(date::test_if_obejcts_are_equal(date0, date1)); - optional structDate = cxx::mirror().getRecord(date::struct_); + optional structDate = cxx::mirror().getRecord(cxx::type::nsdate::Date::id); ASSERT_TRUE(structDate); - optional oUpdateDate = structDate->getMethod(date::str_updateDate); + optional oUpdateDate = structDate->getMethod(cxx::type::nsdate::Date::fn::updateDate::id); ASSERT_TRUE(oUpdateDate); method updateDate = oUpdateDate->targetT().argsT().returnT(); @@ -454,7 +454,7 @@ namespace rtl_tests { { // Retrieve the reflected Record for the 'Calender' struct - optional typeCalender = cxx::mirror().getRecord(calender::struct_); + optional typeCalender = cxx::mirror().getRecord(cxx::type::nsdate::Calender::id); ASSERT_TRUE(typeCalender); // Create a stack-allocated object via reflection @@ -486,7 +486,7 @@ namespace rtl_tests // 'Event' has a unique_ptr and 3 'Event' instances exists, So- EXPECT_TRUE(date::get_instance_count() == 3); - optional oGetTheDate = typeCalender->getMethod(calender::str_getTheDate); + optional oGetTheDate = typeCalender->getMethod(cxx::type::nsdate::Calender::fn::getTheDate::id); ASSERT_TRUE(oGetTheDate); rtl::method getTheDate = oGetTheDate->targetT().argsT().returnT(); @@ -507,10 +507,10 @@ namespace rtl_tests // both objects must be equal (shared via shared_ptr inside 'Calender') EXPECT_TRUE(date::test_if_obejcts_are_equal(date0, date1)); - optional structDate = cxx::mirror().getRecord(date::struct_); + optional structDate = cxx::mirror().getRecord(cxx::type::nsdate::Date::id); ASSERT_TRUE(structDate); - optional oUpdateDate = structDate->getMethod(date::str_updateDate); + optional oUpdateDate = structDate->getMethod(cxx::type::nsdate::Date::fn::updateDate::id); ASSERT_TRUE(oUpdateDate); method updateDate = oUpdateDate->targetT().argsT().returnT(); @@ -535,7 +535,7 @@ namespace rtl_tests { { // Retrieve the reflected Record for the 'Calender' struct - optional typeCalender = cxx::mirror().getRecord(calender::struct_); + optional typeCalender = cxx::mirror().getRecord(cxx::type::nsdate::Calender::id); ASSERT_TRUE(typeCalender); // Create a stack-allocated object via reflection @@ -567,7 +567,7 @@ namespace rtl_tests // 'Event' has a unique_ptr and 3 'Event' instances exists, So- EXPECT_TRUE(date::get_instance_count() == 3); - optional oGetSavedDate = typeCalender->getMethod(calender::str_getSavedDate); + optional oGetSavedDate = typeCalender->getMethod(cxx::type::nsdate::Calender::fn::getSavedDate::id); ASSERT_TRUE(oGetSavedDate); rtl::method getSavedDate = oGetSavedDate->targetT().argsT().returnT(); @@ -588,10 +588,10 @@ namespace rtl_tests // both objects must be equal, created via default-constructor, different instances, not shared. EXPECT_TRUE(date::test_if_obejcts_are_equal(date0, date1)); - optional structDate = cxx::mirror().getRecord(date::struct_); + optional structDate = cxx::mirror().getRecord(cxx::type::nsdate::Date::id); ASSERT_TRUE(structDate); - optional oUpdateDate = structDate->getMethod(date::str_updateDate); + optional oUpdateDate = structDate->getMethod(cxx::type::nsdate::Date::fn::updateDate::id); ASSERT_TRUE(oUpdateDate); method updateDate = oUpdateDate->targetT().argsT().returnT(); diff --git a/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp index 1c424e0b..fe297e40 100644 --- a/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp @@ -17,7 +17,7 @@ namespace rtl_tests { { // Retrieve the reflected Record for the 'Calender' struct - optional classCalender = cxx::mirror().getRecord(calender::struct_); + optional classCalender = cxx::mirror().getRecord(cxx::type::nsdate::Calender::id); ASSERT_TRUE(classCalender); // Create a stack-allocated object via reflection @@ -80,7 +80,7 @@ namespace rtl_tests { { // Retrieve the reflected Record for the 'Calender' struct - optional classCalender = cxx::mirror().getRecord(calender::struct_); + optional classCalender = cxx::mirror().getRecord(cxx::type::nsdate::Calender::id); ASSERT_TRUE(classCalender); // Create a stack-allocated object via reflection @@ -132,10 +132,10 @@ namespace rtl_tests { { // Retrieve the reflected Record for the 'Calender' struct - optional classCalender = cxx::mirror().getRecord(calender::struct_); + optional classCalender = cxx::mirror().getRecord(cxx::type::nsdate::Calender::id); ASSERT_TRUE(classCalender); - optional oGetTheEvent = classCalender->getMethod(calender::str_getTheEvent); + optional oGetTheEvent = classCalender->getMethod(cxx::type::nsdate::Calender::fn::getTheEvent::id); ASSERT_TRUE(oGetTheEvent); // Create a stack-allocated object via reflection @@ -221,10 +221,10 @@ namespace rtl_tests { { // Retrieve the reflected Record for the 'Calender' struct - optional classCalender = cxx::mirror().getRecord(calender::struct_); + optional classCalender = cxx::mirror().getRecord(cxx::type::nsdate::Calender::id); ASSERT_TRUE(classCalender); - optional optCreateCalender = classCalender->getMethod(calender::str_create); + optional optCreateCalender = classCalender->getMethod(cxx::type::nsdate::Calender::fn::create::id); ASSERT_TRUE(optCreateCalender); auto createCalenderFn = optCreateCalender->argsT<>().returnT<>(); diff --git a/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp index 185b19b1..afa5adf3 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp @@ -199,11 +199,11 @@ namespace rtl_tests TEST(ReflectionOpErrorCodeTests, copy_construct__error_TypeNotCopyConstructible) { { - optional classCalender = cxx::mirror().getRecord(calender::struct_); + optional classCalender = cxx::mirror().getRecord(cxx::type::nsdate::Calender::id); ASSERT_TRUE(classCalender); //Events's constructor not registered, get its instance from 'Calander'. - optional getEvent = classCalender->getMethod(calender::str_getTheEvent); + optional getEvent = classCalender->getMethod(cxx::type::nsdate::Calender::fn::getTheEvent::id); ASSERT_TRUE(getEvent); // Create Calender, which will create a Event's instance. diff --git a/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp b/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp index 940ef651..4b37043a 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp @@ -22,7 +22,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == rtl::error::TypeNotDefaultConstructible); ASSERT_TRUE(robj0.isEmpty()); { - auto classCalender = cxx::mirror().getRecord(cxx::reflected_id(calender::struct_)); + auto classCalender = cxx::mirror().getRecord(cxx::reflected_id(cxx::type::nsdate::Calender::id)); ASSERT_TRUE(classCalender); auto [err1, calender] = classCalender->ctorT()(rtl::alloc::Stack); @@ -36,7 +36,7 @@ namespace rtl_tests EXPECT_TRUE(event::get_instance_count() == 2); // Event's object can be obtained from Calender's object ('Calander' has-a 'Event'). - auto getEvent = classCalender->getMethod(calender::str_getTheEvent); + auto getEvent = classCalender->getMethod(cxx::type::nsdate::Calender::fn::getTheEvent::id); ASSERT_TRUE(getEvent); auto get_event = getEvent->targetT<>().argsT<>().returnT<>(); From 163c8e7bcc8f0c882ccf14594e7580df6c391cc9 Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Mon, 9 Feb 2026 16:03:03 +0530 Subject: [PATCH 04/16] clang-mirror generated IDs integration. --- CxxTestRegistration/src/regs0_Animal.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/CxxTestRegistration/src/regs0_Animal.cpp b/CxxTestRegistration/src/regs0_Animal.cpp index 337de82e..30208acf 100644 --- a/CxxTestRegistration/src/regs0_Animal.cpp +++ b/CxxTestRegistration/src/regs0_Animal.cpp @@ -18,13 +18,16 @@ namespace regs0::type0 { .methodConst(cxx::type::Animal::fn::getFamilyName::id) .build(&Animal::getFamilyName)); - fns.push_back(rtl::type().member() + /* GCC here fails to automatically resolve the correct overloaded functor + when both a lvalue reference and an rvalue overload exist. + To disambiguate, explicitly cast the member function pointer. + */ fns.push_back(rtl::type().member() .method(cxx::type::Animal::fn::setAnimalName::id) - .build(&Animal::setAnimalName)); + .build(static_cast(&Animal::setAnimalName))); fns.push_back(rtl::type().member() .method(cxx::type::Animal::fn::setAnimalName::id) - .build(&Animal::setAnimalName)); + .build(static_cast(&Animal::setAnimalName))); fns.push_back(rtl::type().member() .method(cxx::type::Animal::fn::setAnimalName::id) @@ -42,13 +45,16 @@ namespace regs0::type0 { .methodStatic(cxx::type::Animal::fn::getInstanceCount::id) .build(&Animal::getInstanceCount)); - fns.push_back(rtl::type().member() + /* GCC here fails to automatically resolve the correct overloaded functor + when both a lvalue reference and an rvalue overload exist. + To disambiguate, explicitly cast the member function pointer. + */ fns.push_back(rtl::type().member() .methodStatic(cxx::type::Animal::fn::updateZooKeeper::id) - .build(&Animal::updateZooKeeper)); + .build(static_cast(&Animal::updateZooKeeper))); fns.push_back(rtl::type().member() .methodStatic(cxx::type::Animal::fn::updateZooKeeper::id) - .build(&Animal::updateZooKeeper)); + .build(static_cast(&Animal::updateZooKeeper))); fns.push_back(rtl::type().member() .methodStatic(cxx::type::Animal::fn::updateZooKeeper::id) From 68a40f5b0d2506c31b8f9f14b39b8a89ef6d8b4f Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Mon, 9 Feb 2026 16:34:39 +0530 Subject: [PATCH 05/16] gcc compile error fix. --- CxxTestRegistration/src/regs3_Person.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CxxTestRegistration/src/regs3_Person.cpp b/CxxTestRegistration/src/regs3_Person.cpp index ea32ec16..8d45e1bd 100644 --- a/CxxTestRegistration/src/regs3_Person.cpp +++ b/CxxTestRegistration/src/regs3_Person.cpp @@ -44,7 +44,7 @@ namespace regs3::type0 { .build(&Person::getProfile)); fns.push_back(rtl::type().member() - .methodStatic(cxx::type::Person::fn::getProfile::id) + .methodStatic(cxx::type::Person::fn::getProfile::id) .build(&Person::getProfile)); fns.push_back(rtl::type().member() From bc9878333a7c4f936c22d4feb8aa1f30761f4da7 Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Tue, 10 Feb 2026 09:55:26 +0530 Subject: [PATCH 06/16] gcc compile err fix. --- CxxTestRegistration/src/regs4_StringMute.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CxxTestRegistration/src/regs4_StringMute.cpp b/CxxTestRegistration/src/regs4_StringMute.cpp index 15fa3278..8d1d3240 100644 --- a/CxxTestRegistration/src/regs4_StringMute.cpp +++ b/CxxTestRegistration/src/regs4_StringMute.cpp @@ -34,15 +34,15 @@ namespace regs4::type0 { fns.push_back(rtl::type().member() .method(cxx::type::StrMute::fn::reverseString::id) - .build(&StrMute::reverseString)); + .build(static_cast(&StrMute::reverseString))); fns.push_back(rtl::type().member() .method(cxx::type::StrMute::fn::reverseString::id) - .build(&StrMute::reverseString)); + .build(static_cast(&StrMute::reverseString))); fns.push_back(rtl::type().member() .method(cxx::type::StrMute::fn::reverseString::id) - .build(&StrMute::reverseString)); + .build(static_cast(&StrMute::reverseString))); fns.push_back(rtl::type().member() .method(cxx::type::StrMute::fn::reverseString::id) From 6e2b5e92b2275a7a90895608c601d11c45bd400f Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Tue, 10 Feb 2026 10:06:45 +0530 Subject: [PATCH 07/16] gcc compile err fix. --- CxxTestRegistration/src/regs4_StringMute.cpp | 5 ++++- CxxTestRegistration/src/regs5_StringStatic.cpp | 11 +++++++---- CxxTestRegistration/src/regs7_StringOps.cpp | 11 +++++++---- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CxxTestRegistration/src/regs4_StringMute.cpp b/CxxTestRegistration/src/regs4_StringMute.cpp index 8d1d3240..07a67c18 100644 --- a/CxxTestRegistration/src/regs4_StringMute.cpp +++ b/CxxTestRegistration/src/regs4_StringMute.cpp @@ -32,7 +32,10 @@ namespace regs4::type0 { .method(cxx::type::StrMute::fn::reverseString::id) .build(&StrMute::reverseString)); - fns.push_back(rtl::type().member() + /* GCC here fails to automatically resolve the correct overloaded functor + when both a lvalue reference and an rvalue overload exist. + To disambiguate, explicitly cast the member function pointer. + */ fns.push_back(rtl::type().member() .method(cxx::type::StrMute::fn::reverseString::id) .build(static_cast(&StrMute::reverseString))); diff --git a/CxxTestRegistration/src/regs5_StringStatic.cpp b/CxxTestRegistration/src/regs5_StringStatic.cpp index 6f513e9d..9caa4e15 100644 --- a/CxxTestRegistration/src/regs5_StringStatic.cpp +++ b/CxxTestRegistration/src/regs5_StringStatic.cpp @@ -32,17 +32,20 @@ namespace regs5::type0 { .methodStatic(cxx::type::StrStatic::fn::reverseString::id) .build(&StrStatic::reverseString)); - fns.push_back(rtl::type().member() + /* GCC here fails to automatically resolve the correct overloaded functor + when both a lvalue reference and an rvalue overload exist. + To disambiguate, explicitly cast the member function pointer. + */ fns.push_back(rtl::type().member() .methodStatic(cxx::type::StrStatic::fn::reverseString::id) - .build(&StrStatic::reverseString)); + .build(static_cast(&StrStatic::reverseString))); fns.push_back(rtl::type().member() .methodStatic(cxx::type::StrStatic::fn::reverseString::id) - .build(&StrStatic::reverseString)); + .build(static_cast(&StrStatic::reverseString))); fns.push_back(rtl::type().member() .methodStatic(cxx::type::StrStatic::fn::reverseString::id) - .build(&StrStatic::reverseString)); + .build(static_cast(&StrStatic::reverseString))); fns.push_back(rtl::type().member() .methodStatic(cxx::type::StrStatic::fn::reverseString::id) diff --git a/CxxTestRegistration/src/regs7_StringOps.cpp b/CxxTestRegistration/src/regs7_StringOps.cpp index 09406c7f..8bbd1bd9 100644 --- a/CxxTestRegistration/src/regs7_StringOps.cpp +++ b/CxxTestRegistration/src/regs7_StringOps.cpp @@ -24,14 +24,17 @@ namespace regs7::fn { fns.push_back(rtl::type().function(cxx::fn::reverseString::id) .build(&reverseString)); - fns.push_back(rtl::type().function(cxx::fn::reverseString::id) - .build(&reverseString)); + /* GCC here fails to automatically resolve the correct overloaded functor + when both a lvalue reference and an rvalue overload exist. + To disambiguate, explicitly cast the member function pointer. + */ fns.push_back(rtl::type().function(cxx::fn::reverseString::id) + .build(static_cast(&reverseString))); fns.push_back(rtl::type().function(cxx::fn::reverseString::id) - .build(&reverseString)); + .build(static_cast(&reverseString))); fns.push_back(rtl::type().function(cxx::fn::reverseString::id) - .build(&reverseString)); + .build(static_cast(&reverseString))); fns.push_back(rtl::type().function(cxx::fn::reverseString::id) .build(&reverseString)); From 8a0d78254354329fd1641d7fef5870ef68519b90 Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Tue, 10 Feb 2026 10:14:30 +0530 Subject: [PATCH 08/16] adder header-text for generated files.. --- CxxTestRegistration/inc/TestMirrorProvider.h | 1 - CxxTestRegistration/inc/reg_decls.h | 21 + CxxTestRegistration/inc/reg_ids.h | 21 + CxxTestRegistration/inc/rtcl_meta_ids.h | 635 ------------------ CxxTestRegistration/src/CMakeLists.txt | 2 - CxxTestRegistration/src/regs0_Animal.cpp | 20 + CxxTestRegistration/src/regs10_Complex.cpp | 20 + .../src/regs11_StringConst.cpp | 29 +- CxxTestRegistration/src/regs1_Date.cpp | 20 + CxxTestRegistration/src/regs2_Book.cpp | 20 + CxxTestRegistration/src/regs3_Person.cpp | 20 + CxxTestRegistration/src/regs4_StringMute.cpp | 20 + .../src/regs5_StringStatic.cpp | 20 + .../src/regs6_StringConstOverload.cpp | 20 + CxxTestRegistration/src/regs7_StringOps.cpp | 20 + CxxTestRegistration/src/regs8_StringWrap.cpp | 20 + CxxTestRegistration/src/regs9_Library.cpp | 20 + .../ConstMethodOverloadTests.cpp | 4 +- 18 files changed, 288 insertions(+), 645 deletions(-) delete mode 100644 CxxTestRegistration/inc/rtcl_meta_ids.h diff --git a/CxxTestRegistration/inc/TestMirrorProvider.h b/CxxTestRegistration/inc/TestMirrorProvider.h index b20958fc..a825f3de 100644 --- a/CxxTestRegistration/inc/TestMirrorProvider.h +++ b/CxxTestRegistration/inc/TestMirrorProvider.h @@ -1,7 +1,6 @@ #pragma once #include -#include #include "reg_ids.h" diff --git a/CxxTestRegistration/inc/reg_decls.h b/CxxTestRegistration/inc/reg_decls.h index 009dbcbe..5ca210c0 100644 --- a/CxxTestRegistration/inc/reg_decls.h +++ b/CxxTestRegistration/inc/reg_decls.h @@ -1,3 +1,24 @@ +/***************************************************************************** + * * + * clang-mirror Generated Reflection Surface * + * * + * This file is automatically generated by clang-mirror and represents * + * the reflected projection of user code for consumption by the * + * Reflection Template Library (RTL). * + * * + * It contains compiler-derived identifiers and metadata describing * + * namespaces, types, and members selected for reflection, enabling * + * compiler checking and IDE integration. * + * * + * DO NOT EDIT THIS FILE MANUALLY. * + * Any changes will be overwritten by the generator. * + * * + * clang-mirror: https://github.com/ReflectCxx/clang-mirror * + * * + * SPDX-License-Identifier: MIT * + * * + *****************************************************************************/ + #pragma once #include diff --git a/CxxTestRegistration/inc/reg_ids.h b/CxxTestRegistration/inc/reg_ids.h index 18513f3b..0f6bb7be 100644 --- a/CxxTestRegistration/inc/reg_ids.h +++ b/CxxTestRegistration/inc/reg_ids.h @@ -1,3 +1,24 @@ +/***************************************************************************** + * * + * clang-mirror Generated Reflection Surface * + * * + * This file is automatically generated by clang-mirror and represents * + * the reflected projection of user code for consumption by the * + * Reflection Template Library (RTL). * + * * + * It contains compiler-derived identifiers and metadata describing * + * namespaces, types, and members selected for reflection, enabling * + * compiler checking and IDE integration. * + * * + * DO NOT EDIT THIS FILE MANUALLY. * + * Any changes will be overwritten by the generator. * + * * + * clang-mirror: https://github.com/ReflectCxx/clang-mirror * + * * + * SPDX-License-Identifier: MIT * + * * + *****************************************************************************/ + #pragma once #include diff --git a/CxxTestRegistration/inc/rtcl_meta_ids.h b/CxxTestRegistration/inc/rtcl_meta_ids.h deleted file mode 100644 index 62915fa5..00000000 --- a/CxxTestRegistration/inc/rtcl_meta_ids.h +++ /dev/null @@ -1,635 +0,0 @@ -/***************************************************************************** - * * - * clang-mirror Generated Reflection Surface * - * * - * This file is automatically generated by clang-mirror and represents * - * the reflected projection of user code for consumption by the * - * Reflection Template Library (RTL). * - * * - * It contains compiler-derived identifiers and metadata describing * - * namespaces, types, and members selected for reflection, enabling * - * compiler checking and IDE integration. * - * * - * DO NOT EDIT THIS FILE MANUALLY. * - * Any changes will be overwritten by the generator. * - * * - * clang-mirror: https://github.com/ReflectCxx/clang-mirror * - * * - * SPDX-License-Identifier: MIT * - * * - *****************************************************************************/ - - -#pragma once -#include - - -namespace rtcl { - -namespace function { -namespace complex { - inline constexpr std::string_view getMagnitude = "complex::getMagnitude"; -}} - -namespace function { -namespace complex { - inline constexpr std::string_view setReal = "complex::setReal"; -}} - -namespace function { -namespace complex { - inline constexpr std::string_view setImaginary = "complex::setImaginary"; -}} - -namespace function { - inline constexpr std::string_view getComplexNumAsString = "getComplexNumAsString"; -} - -namespace function { - inline constexpr std::string_view reverseString = "reverseString"; -} - -namespace function { - inline constexpr std::string_view revStrConstRefArg = "revStrConstRefArg"; -} - -namespace function { - inline constexpr std::string_view revStrRValueRefArg = "revStrRValueRefArg"; -} - -namespace function { - inline constexpr std::string_view revStrNonConstRefArg = "revStrNonConstRefArg"; -} - -namespace function { - inline constexpr std::string_view revStrOverloadValCRef = "revStrOverloadValCRef"; -} - -namespace function { - inline constexpr std::string_view revStrOverloadValRef = "revStrOverloadValRef"; -} - -namespace function { - inline constexpr std::string_view revStrOverloadRefAndCRef = "revStrOverloadRefAndCRef"; -} - -namespace type { -namespace nsdate { -namespace Calender { - inline constexpr std::string_view id = "nsdate::Calender"; -}}} - -namespace type { -namespace nsdate { -namespace Calender { -namespace method { - inline constexpr std::string_view Calender = "Calender"; -}}}} - -namespace type { -namespace nsdate { -namespace Calender { -namespace method { - inline constexpr std::string_view create = "create"; -}}}} - -namespace type { -namespace nsdate { -namespace Calender { -namespace method { - inline constexpr std::string_view getSavedDate = "getSavedDate"; -}}}} - -namespace type { -namespace nsdate { -namespace Calender { -namespace method { - inline constexpr std::string_view getTheDate = "getTheDate"; -}}}} - -namespace type { -namespace nsdate { -namespace Calender { -namespace method { - inline constexpr std::string_view getSavedEvent = "getSavedEvent"; -}}}} - -namespace type { -namespace nsdate { -namespace Calender { -namespace method { - inline constexpr std::string_view getTheEvent = "getTheEvent"; -}}}} - -namespace type { -namespace nsdate { -namespace Calender { -namespace method { - inline constexpr std::string_view instanceCount = "instanceCount"; -}}}} - -namespace type { -namespace nsdate { -namespace Calender { -namespace method { - inline constexpr std::string_view getMoveOpsCount = "getMoveOpsCount"; -}}}} - -namespace type { -namespace nsdate { -namespace Calender { -namespace method { - inline constexpr std::string_view resetMoveOpsCounter = "resetMoveOpsCounter"; -}}}} - - -namespace type { -namespace StrWrapB { - inline constexpr std::string_view id = "StrWrapB"; -}} - -namespace type { -namespace StrWrapB { -namespace method { - inline constexpr std::string_view StrWrapB = "StrWrapB"; -}}} - - -namespace type { -namespace nsdate { -namespace Event { - inline constexpr std::string_view id = "nsdate::Event"; -}}} - -namespace type { -namespace nsdate { -namespace Event { -namespace method { - inline constexpr std::string_view instanceCount = "instanceCount"; -}}}} - -namespace type { -namespace nsdate { -namespace Event { -namespace method { - inline constexpr std::string_view getEventDate = "getEventDate"; -}}}} - -namespace type { -namespace nsdate { -namespace Event { -namespace method { - inline constexpr std::string_view reset = "reset"; -}}}} - - -namespace type { -namespace nsdate { -namespace Date { - inline constexpr std::string_view id = "nsdate::Date"; -}}} - -namespace type { -namespace nsdate { -namespace Date { -namespace method { - inline constexpr std::string_view Date = "Date"; -}}}} - -namespace type { -namespace nsdate { -namespace Date { -namespace method { - inline constexpr std::string_view instanceCount = "instanceCount"; -}}}} - -namespace type { -namespace nsdate { -namespace Date { -namespace method { - inline constexpr std::string_view getAsString = "getAsString"; -}}}} - -namespace type { -namespace nsdate { -namespace Date { -namespace method { - inline constexpr std::string_view updateDate = "updateDate"; -}}}} - - -namespace type { -namespace StrMute { - inline constexpr std::string_view id = "StrMute"; -}} - -namespace type { -namespace StrMute { -namespace method { - inline constexpr std::string_view reverseString = "reverseString"; -}}} - -namespace type { -namespace StrMute { -namespace method { - inline constexpr std::string_view revStrConstRefArg = "revStrConstRefArg"; -}}} - -namespace type { -namespace StrMute { -namespace method { - inline constexpr std::string_view revStrRValueRefArg = "revStrRValueRefArg"; -}}} - -namespace type { -namespace StrMute { -namespace method { - inline constexpr std::string_view revStrNonConstRefArg = "revStrNonConstRefArg"; -}}} - -namespace type { -namespace StrMute { -namespace method { - inline constexpr std::string_view revStrOverloadValCRef = "revStrOverloadValCRef"; -}}} - -namespace type { -namespace StrMute { -namespace method { - inline constexpr std::string_view revStrOverloadValRef = "revStrOverloadValRef"; -}}} - -namespace type { -namespace StrMute { -namespace method { - inline constexpr std::string_view revStrOverloadRefAndCRef = "revStrOverloadRefAndCRef"; -}}} - - -namespace type { -namespace StrStatic { - inline constexpr std::string_view id = "StrStatic"; -}} - -namespace type { -namespace StrStatic { -namespace method { - inline constexpr std::string_view reverseString = "reverseString"; -}}} - -namespace type { -namespace StrStatic { -namespace method { - inline constexpr std::string_view revStrConstRefArg = "revStrConstRefArg"; -}}} - -namespace type { -namespace StrStatic { -namespace method { - inline constexpr std::string_view revStrRValueRefArg = "revStrRValueRefArg"; -}}} - -namespace type { -namespace StrStatic { -namespace method { - inline constexpr std::string_view revStrNonConstRefArg = "revStrNonConstRefArg"; -}}} - -namespace type { -namespace StrStatic { -namespace method { - inline constexpr std::string_view revStrOverloadValCRef = "revStrOverloadValCRef"; -}}} - -namespace type { -namespace StrStatic { -namespace method { - inline constexpr std::string_view revStrOverloadValRef = "revStrOverloadValRef"; -}}} - -namespace type { -namespace StrStatic { -namespace method { - inline constexpr std::string_view revStrOverloadRefAndCRef = "revStrOverloadRefAndCRef"; -}}} - - -namespace type { -namespace Book { - inline constexpr std::string_view id = "Book"; -}} - -namespace type { -namespace Book { -namespace method { - inline constexpr std::string_view Book = "Book"; -}}} - -namespace type { -namespace Book { -namespace method { - inline constexpr std::string_view setAuthor = "setAuthor"; -}}} - -namespace type { -namespace Book { -namespace method { - inline constexpr std::string_view getTitle = "getTitle"; -}}} - -namespace type { -namespace Book { -namespace method { - inline constexpr std::string_view addCopyrightTag = "addCopyrightTag"; -}}} - -namespace type { -namespace Book { -namespace method { - inline constexpr std::string_view setDescription = "setDescription"; -}}} - -namespace type { -namespace Book { -namespace method { - inline constexpr std::string_view getPublishedOn = "getPublishedOn"; -}}} - -namespace type { -namespace Book { -namespace method { - inline constexpr std::string_view getInstanceCount = "getInstanceCount"; -}}} - -namespace type { -namespace Book { -namespace method { - inline constexpr std::string_view updateBookInfo = "updateBookInfo"; -}}} - -namespace type { -namespace Book { -namespace method { - inline constexpr std::string_view addPreface = "addPreface"; -}}} - - -namespace type { -namespace StrWrapD { - inline constexpr std::string_view id = "StrWrapD"; -}} - -namespace type { -namespace StrWrapD { -namespace method { - inline constexpr std::string_view StrWrapD = "StrWrapD"; -}}} - - -namespace type { -namespace Person { - inline constexpr std::string_view id = "Person"; -}} - -namespace type { -namespace Person { -namespace method { - inline constexpr std::string_view getFirstName = "getFirstName"; -}}} - -namespace type { -namespace Person { -namespace method { - inline constexpr std::string_view Person = "Person"; -}}} - -namespace type { -namespace Person { -namespace method { - inline constexpr std::string_view getInstanceCount = "getInstanceCount"; -}}} - -namespace type { -namespace Person { -namespace method { - inline constexpr std::string_view updateAddress = "updateAddress"; -}}} - -namespace type { -namespace Person { -namespace method { - inline constexpr std::string_view getDefaults = "getDefaults"; -}}} - -namespace type { -namespace Person { -namespace method { - inline constexpr std::string_view getProfile = "getProfile"; -}}} - -namespace type { -namespace Person { -namespace method { - inline constexpr std::string_view createConst = "createConst"; -}}} - -namespace type { -namespace Person { -namespace method { - inline constexpr std::string_view createPtr = "createPtr"; -}}} - -namespace type { -namespace Person { -namespace method { - inline constexpr std::string_view deletePtr = "deletePtr"; -}}} - -namespace type { -namespace Person { -namespace method { - inline constexpr std::string_view updateLastName = "updateLastName"; -}}} - - -namespace type { -namespace StrConstOverload { - inline constexpr std::string_view id = "StrConstOverload"; -}} - -namespace type { -namespace StrConstOverload { -namespace method { - inline constexpr std::string_view reverseString = "reverseString"; -}}} - - -namespace type { -namespace Animal { - inline constexpr std::string_view id = "Animal"; -}} - -namespace type { -namespace Animal { -namespace method { - inline constexpr std::string_view Animal = "Animal"; -}}} - -namespace type { -namespace Animal { -namespace method { - inline constexpr std::string_view getFamilyName = "getFamilyName"; -}}} - -namespace type { -namespace Animal { -namespace method { - inline constexpr std::string_view setAnimalName = "setAnimalName"; -}}} - -namespace type { -namespace Animal { -namespace method { - inline constexpr std::string_view setFamilyName = "setFamilyName"; -}}} - -namespace type { -namespace Animal { -namespace method { - inline constexpr std::string_view getInstanceCount = "getInstanceCount"; -}}} - -namespace type { -namespace Animal { -namespace method { - inline constexpr std::string_view updateZooKeeper = "updateZooKeeper"; -}}} - - -namespace type { -namespace StrWrap { - inline constexpr std::string_view id = "StrWrap"; -}} - -namespace type { -namespace StrWrap { -namespace method { - inline constexpr std::string_view sstr = "sstr"; -}}} - -namespace type { -namespace StrWrap { -namespace method { - inline constexpr std::string_view StrWrap = "StrWrap"; -}}} - - -namespace type { -namespace StrWrapA { - inline constexpr std::string_view id = "StrWrapA"; -}} - -namespace type { -namespace StrWrapA { -namespace method { - inline constexpr std::string_view StrWrapA = "StrWrapA"; -}}} - - -namespace type { -namespace StrWrapC { - inline constexpr std::string_view id = "StrWrapC"; -}} - -namespace type { -namespace StrWrapC { -namespace method { - inline constexpr std::string_view StrWrapC = "StrWrapC"; -}}} - - -namespace type { -namespace StrConst { - inline constexpr std::string_view id = "StrConst"; -}} - -namespace type { -namespace StrConst { -namespace method { - inline constexpr std::string_view reverseString = "reverseString"; -}}} - -namespace type { -namespace StrConst { -namespace method { - inline constexpr std::string_view revStrConstRefArg = "revStrConstRefArg"; -}}} - -namespace type { -namespace StrConst { -namespace method { - inline constexpr std::string_view revStrRValueRefArg = "revStrRValueRefArg"; -}}} - -namespace type { -namespace StrConst { -namespace method { - inline constexpr std::string_view revStrNonConstRefArg = "revStrNonConstRefArg"; -}}} - -namespace type { -namespace StrConst { -namespace method { - inline constexpr std::string_view revStrOverloadValCRef = "revStrOverloadValCRef"; -}}} - -namespace type { -namespace StrConst { -namespace method { - inline constexpr std::string_view revStrOverloadValRef = "revStrOverloadValRef"; -}}} - -namespace type { -namespace StrConst { -namespace method { - inline constexpr std::string_view revStrOverloadRefAndCRef = "revStrOverloadRefAndCRef"; -}}} - - -namespace type { -namespace Library { - inline constexpr std::string_view id = "Library"; -}} - -namespace type { -namespace Library { -namespace method { - inline constexpr std::string_view Library = "Library"; -}}} - -namespace type { -namespace Library { -namespace method { - inline constexpr std::string_view getBookByTitle = "getBookByTitle"; -}}} - -namespace type { -namespace Library { -namespace method { - inline constexpr std::string_view getInstanceCount = "getInstanceCount"; -}}} - -namespace type { -namespace Library { -namespace method { - inline constexpr std::string_view getBooksCount = "getBooksCount"; -}}} - -namespace type { -namespace Library { -namespace method { - inline constexpr std::string_view addBook = "addBook"; -}}} - - -} \ No newline at end of file diff --git a/CxxTestRegistration/src/CMakeLists.txt b/CxxTestRegistration/src/CMakeLists.txt index fb014c66..271a36ed 100644 --- a/CxxTestRegistration/src/CMakeLists.txt +++ b/CxxTestRegistration/src/CMakeLists.txt @@ -24,8 +24,6 @@ SET(LOCAL_HEADERS "${PROJECT_SOURCE_DIR}/inc/reg_ids.h" "${PROJECT_SOURCE_DIR}/inc/reg_decls.h" "${PROJECT_SOURCE_DIR}/inc/TestMirrorProvider.h" - - "${PROJECT_SOURCE_DIR}/inc/rtcl_meta_ids.h" ) # Add any additional source files if needed diff --git a/CxxTestRegistration/src/regs0_Animal.cpp b/CxxTestRegistration/src/regs0_Animal.cpp index 30208acf..e6bd2bd5 100644 --- a/CxxTestRegistration/src/regs0_Animal.cpp +++ b/CxxTestRegistration/src/regs0_Animal.cpp @@ -1,3 +1,23 @@ +/***************************************************************************** + * * + * clang-mirror Generated Reflection Surface * + * * + * This file is automatically generated by clang-mirror and represents * + * the reflected projection of user code for consumption by the * + * Reflection Template Library (RTL). * + * * + * It contains compiler-derived identifiers and metadata describing * + * namespaces, types, and members selected for reflection, enabling * + * compiler checking and IDE integration. * + * * + * DO NOT EDIT THIS FILE MANUALLY. * + * Any changes will be overwritten by the generator. * + * * + * clang-mirror: https://github.com/ReflectCxx/clang-mirror * + * * + * SPDX-License-Identifier: MIT * + * * + *****************************************************************************/ #include "reg_ids.h" diff --git a/CxxTestRegistration/src/regs10_Complex.cpp b/CxxTestRegistration/src/regs10_Complex.cpp index ff056e31..bb5fefc9 100644 --- a/CxxTestRegistration/src/regs10_Complex.cpp +++ b/CxxTestRegistration/src/regs10_Complex.cpp @@ -1,3 +1,23 @@ +/***************************************************************************** + * * + * clang-mirror Generated Reflection Surface * + * * + * This file is automatically generated by clang-mirror and represents * + * the reflected projection of user code for consumption by the * + * Reflection Template Library (RTL). * + * * + * It contains compiler-derived identifiers and metadata describing * + * namespaces, types, and members selected for reflection, enabling * + * compiler checking and IDE integration. * + * * + * DO NOT EDIT THIS FILE MANUALLY. * + * Any changes will be overwritten by the generator. * + * * + * clang-mirror: https://github.com/ReflectCxx/clang-mirror * + * * + * SPDX-License-Identifier: MIT * + * * + *****************************************************************************/ #include "reg_ids.h" diff --git a/CxxTestRegistration/src/regs11_StringConst.cpp b/CxxTestRegistration/src/regs11_StringConst.cpp index 13d0fbaf..e45b5e13 100644 --- a/CxxTestRegistration/src/regs11_StringConst.cpp +++ b/CxxTestRegistration/src/regs11_StringConst.cpp @@ -1,3 +1,23 @@ +/***************************************************************************** + * * + * clang-mirror Generated Reflection Surface * + * * + * This file is automatically generated by clang-mirror and represents * + * the reflected projection of user code for consumption by the * + * Reflection Template Library (RTL). * + * * + * It contains compiler-derived identifiers and metadata describing * + * namespaces, types, and members selected for reflection, enabling * + * compiler checking and IDE integration. * + * * + * DO NOT EDIT THIS FILE MANUALLY. * + * Any changes will be overwritten by the generator. * + * * + * clang-mirror: https://github.com/ReflectCxx/clang-mirror * + * * + * SPDX-License-Identifier: MIT * + * * + *****************************************************************************/ #include "reg_ids.h" @@ -34,15 +54,15 @@ namespace regs11::type0 { fns.push_back(rtl::type().member() .methodConst(cxx::type::StrConst::fn::reverseString::id) - .build(&StrConst::reverseString)); + .build(static_cast(&StrConst::reverseString))); fns.push_back(rtl::type().member() .methodConst(cxx::type::StrConst::fn::reverseString::id) - .build(&StrConst::reverseString)); + .build(static_cast(&StrConst::reverseString))); fns.push_back(rtl::type().member() .methodConst(cxx::type::StrConst::fn::reverseString::id) - .build(&StrConst::reverseString)); + .build(static_cast(&StrConst::reverseString))); fns.push_back(rtl::type().member() .methodConst(cxx::type::StrConst::fn::reverseString::id) @@ -80,5 +100,4 @@ namespace regs11::type0 { .methodConst(cxx::type::StrConst::fn::revStrOverloadValRef::id) .build(&StrConst::revStrOverloadValRef)); } -} - +} \ No newline at end of file diff --git a/CxxTestRegistration/src/regs1_Date.cpp b/CxxTestRegistration/src/regs1_Date.cpp index f3450c4f..a9db0755 100644 --- a/CxxTestRegistration/src/regs1_Date.cpp +++ b/CxxTestRegistration/src/regs1_Date.cpp @@ -1,3 +1,23 @@ +/***************************************************************************** + * * + * clang-mirror Generated Reflection Surface * + * * + * This file is automatically generated by clang-mirror and represents * + * the reflected projection of user code for consumption by the * + * Reflection Template Library (RTL). * + * * + * It contains compiler-derived identifiers and metadata describing * + * namespaces, types, and members selected for reflection, enabling * + * compiler checking and IDE integration. * + * * + * DO NOT EDIT THIS FILE MANUALLY. * + * Any changes will be overwritten by the generator. * + * * + * clang-mirror: https://github.com/ReflectCxx/clang-mirror * + * * + * SPDX-License-Identifier: MIT * + * * + *****************************************************************************/ #include "reg_ids.h" diff --git a/CxxTestRegistration/src/regs2_Book.cpp b/CxxTestRegistration/src/regs2_Book.cpp index 85bf209b..63772287 100644 --- a/CxxTestRegistration/src/regs2_Book.cpp +++ b/CxxTestRegistration/src/regs2_Book.cpp @@ -1,3 +1,23 @@ +/***************************************************************************** + * * + * clang-mirror Generated Reflection Surface * + * * + * This file is automatically generated by clang-mirror and represents * + * the reflected projection of user code for consumption by the * + * Reflection Template Library (RTL). * + * * + * It contains compiler-derived identifiers and metadata describing * + * namespaces, types, and members selected for reflection, enabling * + * compiler checking and IDE integration. * + * * + * DO NOT EDIT THIS FILE MANUALLY. * + * Any changes will be overwritten by the generator. * + * * + * clang-mirror: https://github.com/ReflectCxx/clang-mirror * + * * + * SPDX-License-Identifier: MIT * + * * + *****************************************************************************/ #include "reg_ids.h" diff --git a/CxxTestRegistration/src/regs3_Person.cpp b/CxxTestRegistration/src/regs3_Person.cpp index 8d45e1bd..51795c6e 100644 --- a/CxxTestRegistration/src/regs3_Person.cpp +++ b/CxxTestRegistration/src/regs3_Person.cpp @@ -1,3 +1,23 @@ +/***************************************************************************** + * * + * clang-mirror Generated Reflection Surface * + * * + * This file is automatically generated by clang-mirror and represents * + * the reflected projection of user code for consumption by the * + * Reflection Template Library (RTL). * + * * + * It contains compiler-derived identifiers and metadata describing * + * namespaces, types, and members selected for reflection, enabling * + * compiler checking and IDE integration. * + * * + * DO NOT EDIT THIS FILE MANUALLY. * + * Any changes will be overwritten by the generator. * + * * + * clang-mirror: https://github.com/ReflectCxx/clang-mirror * + * * + * SPDX-License-Identifier: MIT * + * * + *****************************************************************************/ #include "reg_ids.h" diff --git a/CxxTestRegistration/src/regs4_StringMute.cpp b/CxxTestRegistration/src/regs4_StringMute.cpp index 07a67c18..86e430c9 100644 --- a/CxxTestRegistration/src/regs4_StringMute.cpp +++ b/CxxTestRegistration/src/regs4_StringMute.cpp @@ -1,3 +1,23 @@ +/***************************************************************************** + * * + * clang-mirror Generated Reflection Surface * + * * + * This file is automatically generated by clang-mirror and represents * + * the reflected projection of user code for consumption by the * + * Reflection Template Library (RTL). * + * * + * It contains compiler-derived identifiers and metadata describing * + * namespaces, types, and members selected for reflection, enabling * + * compiler checking and IDE integration. * + * * + * DO NOT EDIT THIS FILE MANUALLY. * + * Any changes will be overwritten by the generator. * + * * + * clang-mirror: https://github.com/ReflectCxx/clang-mirror * + * * + * SPDX-License-Identifier: MIT * + * * + *****************************************************************************/ #include "reg_ids.h" diff --git a/CxxTestRegistration/src/regs5_StringStatic.cpp b/CxxTestRegistration/src/regs5_StringStatic.cpp index 9caa4e15..81e7bd8d 100644 --- a/CxxTestRegistration/src/regs5_StringStatic.cpp +++ b/CxxTestRegistration/src/regs5_StringStatic.cpp @@ -1,3 +1,23 @@ +/***************************************************************************** + * * + * clang-mirror Generated Reflection Surface * + * * + * This file is automatically generated by clang-mirror and represents * + * the reflected projection of user code for consumption by the * + * Reflection Template Library (RTL). * + * * + * It contains compiler-derived identifiers and metadata describing * + * namespaces, types, and members selected for reflection, enabling * + * compiler checking and IDE integration. * + * * + * DO NOT EDIT THIS FILE MANUALLY. * + * Any changes will be overwritten by the generator. * + * * + * clang-mirror: https://github.com/ReflectCxx/clang-mirror * + * * + * SPDX-License-Identifier: MIT * + * * + *****************************************************************************/ #include "reg_ids.h" diff --git a/CxxTestRegistration/src/regs6_StringConstOverload.cpp b/CxxTestRegistration/src/regs6_StringConstOverload.cpp index 9f140c25..733170fa 100644 --- a/CxxTestRegistration/src/regs6_StringConstOverload.cpp +++ b/CxxTestRegistration/src/regs6_StringConstOverload.cpp @@ -1,3 +1,23 @@ +/***************************************************************************** + * * + * clang-mirror Generated Reflection Surface * + * * + * This file is automatically generated by clang-mirror and represents * + * the reflected projection of user code for consumption by the * + * Reflection Template Library (RTL). * + * * + * It contains compiler-derived identifiers and metadata describing * + * namespaces, types, and members selected for reflection, enabling * + * compiler checking and IDE integration. * + * * + * DO NOT EDIT THIS FILE MANUALLY. * + * Any changes will be overwritten by the generator. * + * * + * clang-mirror: https://github.com/ReflectCxx/clang-mirror * + * * + * SPDX-License-Identifier: MIT * + * * + *****************************************************************************/ #include "reg_ids.h" diff --git a/CxxTestRegistration/src/regs7_StringOps.cpp b/CxxTestRegistration/src/regs7_StringOps.cpp index 8bbd1bd9..a9034131 100644 --- a/CxxTestRegistration/src/regs7_StringOps.cpp +++ b/CxxTestRegistration/src/regs7_StringOps.cpp @@ -1,3 +1,23 @@ +/***************************************************************************** + * * + * clang-mirror Generated Reflection Surface * + * * + * This file is automatically generated by clang-mirror and represents * + * the reflected projection of user code for consumption by the * + * Reflection Template Library (RTL). * + * * + * It contains compiler-derived identifiers and metadata describing * + * namespaces, types, and members selected for reflection, enabling * + * compiler checking and IDE integration. * + * * + * DO NOT EDIT THIS FILE MANUALLY. * + * Any changes will be overwritten by the generator. * + * * + * clang-mirror: https://github.com/ReflectCxx/clang-mirror * + * * + * SPDX-License-Identifier: MIT * + * * + *****************************************************************************/ #include "reg_ids.h" diff --git a/CxxTestRegistration/src/regs8_StringWrap.cpp b/CxxTestRegistration/src/regs8_StringWrap.cpp index 7878f1bb..06d7c319 100644 --- a/CxxTestRegistration/src/regs8_StringWrap.cpp +++ b/CxxTestRegistration/src/regs8_StringWrap.cpp @@ -1,3 +1,23 @@ +/***************************************************************************** + * * + * clang-mirror Generated Reflection Surface * + * * + * This file is automatically generated by clang-mirror and represents * + * the reflected projection of user code for consumption by the * + * Reflection Template Library (RTL). * + * * + * It contains compiler-derived identifiers and metadata describing * + * namespaces, types, and members selected for reflection, enabling * + * compiler checking and IDE integration. * + * * + * DO NOT EDIT THIS FILE MANUALLY. * + * Any changes will be overwritten by the generator. * + * * + * clang-mirror: https://github.com/ReflectCxx/clang-mirror * + * * + * SPDX-License-Identifier: MIT * + * * + *****************************************************************************/ #include "reg_ids.h" diff --git a/CxxTestRegistration/src/regs9_Library.cpp b/CxxTestRegistration/src/regs9_Library.cpp index 7abaadc3..9ff81d5a 100644 --- a/CxxTestRegistration/src/regs9_Library.cpp +++ b/CxxTestRegistration/src/regs9_Library.cpp @@ -1,3 +1,23 @@ +/***************************************************************************** + * * + * clang-mirror Generated Reflection Surface * + * * + * This file is automatically generated by clang-mirror and represents * + * the reflected projection of user code for consumption by the * + * Reflection Template Library (RTL). * + * * + * It contains compiler-derived identifiers and metadata describing * + * namespaces, types, and members selected for reflection, enabling * + * compiler checking and IDE integration. * + * * + * DO NOT EDIT THIS FILE MANUALLY. * + * Any changes will be overwritten by the generator. * + * * + * clang-mirror: https://github.com/ReflectCxx/clang-mirror * + * * + * SPDX-License-Identifier: MIT * + * * + *****************************************************************************/ #include "reg_ids.h" diff --git a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp index c58e63bf..6d090cf8 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp @@ -52,10 +52,10 @@ namespace rtl_tests TEST(ConstMethodOverload, explicitly_making_const_call__on_empty_target) { { - optional classPerson = cxx::mirror().getRecord(std::string(rtcl::type::Person::id)); + optional classPerson = cxx::mirror().getRecord(std::string(cxx::type::Person::id)); ASSERT_TRUE(classPerson); - optional oUpdateLastName = classPerson->getMethod(std::string(rtcl::type::Person::method::updateLastName)); + optional oUpdateLastName = classPerson->getMethod(std::string(cxx::type::Person::fn::updateLastName::id)); ASSERT_TRUE(oUpdateLastName); EXPECT_TRUE(oUpdateLastName->hasSignature()); From 1d528720716d5095c1255f194cccf1a980727364 Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Tue, 10 Feb 2026 12:02:57 +0530 Subject: [PATCH 09/16] removed const char* constants. --- .../src/regs11_StringConst.cpp | 5 +- CxxTestUtils/inc/GlobalTestUtils.h | 29 ++++---- CxxTestUtils/inc/TestUtilsAnimal.h | 18 ++--- CxxTestUtils/inc/TestUtilsBook.h | 18 ++--- CxxTestUtils/inc/TestUtilsDate.h | 10 +-- CxxTestUtils/inc/TestUtilsPerson.h | 26 +++---- CxxTestUtils/src/TestUtilsAnimal.cpp | 6 +- CxxTestUtils/src/TestUtilsBook.cpp | 18 ++--- CxxTestUtils/src/TestUtilsDate.cpp | 2 +- CxxTestUtils/src/TestUtilsPerson.cpp | 32 ++++++--- .../FunctionalityTests/ClassMethodsTests.cpp | 24 +++---- .../ConstMethodOverloadTests.cpp | 22 +++--- .../FunctionalityTests/ConstructorTests.cpp | 8 +-- .../CopyConstructorTests.cpp | 32 ++++----- .../NameSpaceGlobalsTests.cpp | 4 +- .../PerfectForwardingTests.cpp | 21 +++--- .../FunctionalityTests/StaticMethodTests.cpp | 6 +- .../TypeAware_ConstMethod.cpp | 62 ++++++++--------- .../TypeAware_Function.cpp | 50 +++++++------- .../TypeAware_Method.cpp | 58 ++++++++-------- .../TypeAware_StaticMethod.cpp | 58 ++++++++-------- .../ReturnErased_Function.cpp | 25 +++---- .../ReturnErased_Method.cpp | 69 ++++++++++--------- .../ReturnErased_StaticMethod.cpp | 47 ++++++++----- .../RObjectReflecting_strings.cpp | 6 +- 25 files changed, 342 insertions(+), 314 deletions(-) diff --git a/CxxTestRegistration/src/regs11_StringConst.cpp b/CxxTestRegistration/src/regs11_StringConst.cpp index e45b5e13..889553c9 100644 --- a/CxxTestRegistration/src/regs11_StringConst.cpp +++ b/CxxTestRegistration/src/regs11_StringConst.cpp @@ -52,7 +52,10 @@ namespace regs11::type0 { .methodConst(cxx::type::StrConst::fn::reverseString::id) .build(&StrConst::reverseString)); - fns.push_back(rtl::type().member() + /* GCC here fails to automatically resolve the correct overloaded functor + when both a lvalue reference and an rvalue overload exist. + To disambiguate, explicitly cast the member function pointer. + */ fns.push_back(rtl::type().member() .methodConst(cxx::type::StrConst::fn::reverseString::id) .build(static_cast(&StrConst::reverseString))); diff --git a/CxxTestUtils/inc/GlobalTestUtils.h b/CxxTestUtils/inc/GlobalTestUtils.h index 135ba098..d8660412 100755 --- a/CxxTestUtils/inc/GlobalTestUtils.h +++ b/CxxTestUtils/inc/GlobalTestUtils.h @@ -13,25 +13,24 @@ namespace test_utils { static constexpr double g_real = 3.92; static constexpr double g_imaginary = 9.27; - static constexpr const char* STRA = "ReflectC++"; - static constexpr const char* STRA_REVERSE = "++CtcelfeR"; + inline constexpr std::string_view STRA = "ReflectC++"; + inline constexpr std::string_view STRA_REVERSE = "++CtcelfeR"; - static constexpr const char* STRB = "cxxReflection"; - static constexpr const char* STRB_REVERSE = "noitcelfeRxxc"; + inline constexpr std::string_view STRB = "cxxReflection"; + inline constexpr std::string_view STRB_REVERSE = "noitcelfeRxxc"; - static constexpr const char* str_reverseString = "reverseString"; - static constexpr const char* str_revStrConstRefArg = "revStrConstRefArg"; - static constexpr const char* str_revStrRValueRefArg = "revStrRValueRefArg"; - static constexpr const char* str_revStrNonConstRefArg = "revStrNonConstRefArg"; - static constexpr const char* str_revStrOverloadValRef = "revStrOverloadValRef"; - static constexpr const char* str_revStrOverloadValCRef = "revStrOverloadValCRef"; - static constexpr const char* str_revStrOverloadValRefAndCRef = "revStrOverloadRefAndCRef"; + inline constexpr std::string_view str_reverseString = "reverseString"; + inline constexpr std::string_view str_revStrConstRefArg = "revStrConstRefArg"; + inline constexpr std::string_view str_revStrRValueRefArg = "revStrRValueRefArg"; + inline constexpr std::string_view str_revStrNonConstRefArg = "revStrNonConstRefArg"; + inline constexpr std::string_view str_revStrOverloadValRef = "revStrOverloadValRef"; + inline constexpr std::string_view str_revStrOverloadValCRef = "revStrOverloadValCRef"; - static constexpr const char* str_getComplexNumAsString = "getComplexNumAsString"; + inline constexpr std::string_view str_getComplexNumAsString = "getComplexNumAsString"; - static constexpr const char* str_setReal = "complex::setReal"; - static constexpr const char* str_setImaginary = "complex::setImaginary"; - static constexpr const char* str_getMagnitude = "complex::getMagnitude"; + inline constexpr std::string_view str_setReal = "complex::setReal"; + inline constexpr std::string_view str_setImaginary = "complex::setImaginary"; + inline constexpr std::string_view str_getMagnitude = "complex::getMagnitude"; static const char* SUFFIX_void = "_void"; static const char* SUFFIX_ctor = "_ctor"; diff --git a/CxxTestUtils/inc/TestUtilsAnimal.h b/CxxTestUtils/inc/TestUtilsAnimal.h index cab364e2..34182170 100644 --- a/CxxTestUtils/inc/TestUtilsAnimal.h +++ b/CxxTestUtils/inc/TestUtilsAnimal.h @@ -20,15 +20,15 @@ namespace test_utils static constexpr const int AGE = 0.0; static constexpr const float WEIGHT = 0.0; static constexpr const bool IS_MAMMAL = false; - static constexpr const char* NAME = "Orangutan"; - static constexpr const char* FAMILY_NAME = "Great Ape"; - static constexpr const char* ZOO_KEEPER = "Donald McAdams"; - - static constexpr const char* class_ = "Animal"; - static constexpr const char* str_updateZooKeeper = "updateZooKeeper"; - static constexpr const char* str_setAnimalName = "setAnimalName"; - static constexpr const char* str_setFamilyName = "setFamilyName"; - static constexpr const char* str_getFamilyName = "getFamilyName"; + static constexpr std::string_view NAME = "Orangutan"; + static constexpr std::string_view FAMILY_NAME = "Great Ape"; + static constexpr std::string_view ZOO_KEEPER = "Donald McAdams"; + + static constexpr std::string_view class_ = "Animal"; + static constexpr std::string_view str_updateZooKeeper = "updateZooKeeper"; + static constexpr std::string_view str_setAnimalName = "setAnimalName"; + static constexpr std::string_view str_setFamilyName = "setFamilyName"; + static constexpr std::string_view str_getFamilyName = "getFamilyName"; static const bool assert_zero_instance_count(); diff --git a/CxxTestUtils/inc/TestUtilsBook.h b/CxxTestUtils/inc/TestUtilsBook.h index 2d400b00..95417343 100644 --- a/CxxTestUtils/inc/TestUtilsBook.h +++ b/CxxTestUtils/inc/TestUtilsBook.h @@ -16,9 +16,9 @@ namespace test_utils { struct library { - static constexpr const char* class_ = "Library"; - static constexpr const char* str_addBook = "addBook"; - static constexpr const char* str_getBookByTitle = "getBookByTitle"; + static constexpr std::string_view class_ = "Library"; + static constexpr std::string_view str_addBook = "addBook"; + static constexpr std::string_view str_getBookByTitle = "getBookByTitle"; static const bool assert_zero_instance_count(); }; @@ -26,12 +26,12 @@ namespace test_utils struct book { static constexpr const double PRICE = 99.923; - static constexpr const char* TITLE = "Somehow, I manage."; - static constexpr const char* AUTHOR = "Micheal G. Scott"; - static constexpr const char* DESCRIPTION = "World's greatest boss Michael G. Scott, Regional Manager, shares his wisdom with you."; - static constexpr const char* COPYRIGHT_TAG = "Copyright (c) Micheal Scott Paper Company Pvt. Ltd."; - static constexpr const char* PREFACE = "This is a preface."; - static constexpr const char* ACKNOWLEDGEMENTS = "This is an acknowledgement."; + static constexpr std::string_view TITLE = "Somehow, I manage."; + static constexpr std::string_view AUTHOR = "Micheal G. Scott"; + static constexpr std::string_view DESCRIPTION = "World's greatest boss Michael G. Scott, Regional Manager, shares his wisdom with you."; + static constexpr std::string_view COPYRIGHT_TAG = "Copyright (c) Micheal Scott Paper Company Pvt. Ltd."; + static constexpr std::string_view PREFACE = "This is a preface."; + static constexpr std::string_view ACKNOWLEDGEMENTS = "This is an acknowledgement."; static const int get_book_instance_count(); diff --git a/CxxTestUtils/inc/TestUtilsDate.h b/CxxTestUtils/inc/TestUtilsDate.h index c1319344..540b1a9e 100644 --- a/CxxTestUtils/inc/TestUtilsDate.h +++ b/CxxTestUtils/inc/TestUtilsDate.h @@ -15,9 +15,9 @@ namespace test_utils { struct event { - static constexpr const char* struct_ = "nsdate::Event"; - static constexpr const char* str_getDate = "getDate"; - static constexpr const char* str_reset = "reset"; + static constexpr std::string_view struct_ = "nsdate::Event"; + static constexpr std::string_view str_getDate = "getDate"; + static constexpr std::string_view str_reset = "reset"; static const bool assert_zero_instance_count(); static const std::size_t get_instance_count(); @@ -36,8 +36,8 @@ namespace test_utils static constexpr const unsigned DAY = 1; static constexpr const unsigned MONTH = 1; static constexpr const unsigned YEAR = 2000; - static constexpr const char* DATE_STR0 = "23/12/2024"; - static constexpr const char* DATE_STR1 = "04/05/2025"; + static constexpr std::string_view DATE_STR0 = "23/12/2024"; + static constexpr std::string_view DATE_STR1 = "04/05/2025"; static const std::size_t get_instance_count(); diff --git a/CxxTestUtils/inc/TestUtilsPerson.h b/CxxTestUtils/inc/TestUtilsPerson.h index dceac2ee..b0225d9b 100644 --- a/CxxTestUtils/inc/TestUtilsPerson.h +++ b/CxxTestUtils/inc/TestUtilsPerson.h @@ -17,19 +17,19 @@ namespace test_utils struct person { static constexpr const std::size_t AGE = 34; - static constexpr const char* FIRST_NAME = "Sherlock"; - static constexpr const char* LAST_NAME = "Holmes"; - static constexpr const char* ADDRESS = "221B Baker Street."; - static constexpr const char* OCCUPATION = "Private Detective."; - - static constexpr const char* class_ = "Person"; - static constexpr const char* str_createPtr = "createPtr"; - static constexpr const char* str_getProfile = "getProfile"; - static constexpr const char* str_createConst = "createConst"; - static constexpr const char* str_getDefaults = "getDefaults"; - static constexpr const char* str_getFirstName = "getFirstName"; - static constexpr const char* str_updateAddress = "updateAddress"; - static constexpr const char* str_updateLastName = "updateLastName"; + static constexpr std::string_view FIRST_NAME = "Sherlock"; + static constexpr std::string_view LAST_NAME = "Holmes"; + static constexpr std::string_view ADDRESS = "221B Baker Street."; + static constexpr std::string_view OCCUPATION = "Private Detective."; + + static constexpr std::string_view class_ = "Person"; + static constexpr std::string_view str_createPtr = "createPtr"; + static constexpr std::string_view str_getProfile = "getProfile"; + static constexpr std::string_view str_createConst = "createConst"; + static constexpr std::string_view str_getDefaults = "getDefaults"; + static constexpr std::string_view str_getFirstName = "getFirstName"; + static constexpr std::string_view str_updateAddress = "updateAddress"; + static constexpr std::string_view str_updateLastName = "updateLastName"; static const bool assert_zero_instance_count(); diff --git a/CxxTestUtils/src/TestUtilsAnimal.cpp b/CxxTestUtils/src/TestUtilsAnimal.cpp index 36c8e0c9..9daf5ee1 100644 --- a/CxxTestUtils/src/TestUtilsAnimal.cpp +++ b/CxxTestUtils/src/TestUtilsAnimal.cpp @@ -16,7 +16,7 @@ const bool test_utils::animal::assert_zero_instance_count() template<> const bool test_utils::animal::test_method_updateZooKeeper(const std::string& pZooKeeper) { - std::string zooKeeper = ZOO_KEEPER; + std::string zooKeeper(ZOO_KEEPER); return (pZooKeeper == Animal::updateZooKeeper(zooKeeper)); } @@ -24,14 +24,14 @@ const bool test_utils::animal::test_method_updateZooKeeper(const s template<> const bool test_utils::animal::test_method_updateZooKeeper(const std::string& pZooKeeper) { - return (pZooKeeper == Animal::updateZooKeeper(ZOO_KEEPER)); + return (pZooKeeper == Animal::updateZooKeeper(std::string(ZOO_KEEPER))); } template<> const bool test_utils::animal::test_method_updateZooKeeper(const std::string& pZooKeeper) { - const std::string zooKeeper = ZOO_KEEPER; + const std::string zooKeeper(ZOO_KEEPER); return (pZooKeeper == Animal::updateZooKeeper(zooKeeper)); } diff --git a/CxxTestUtils/src/TestUtilsBook.cpp b/CxxTestUtils/src/TestUtilsBook.cpp index 771ebf28..ca8926b0 100644 --- a/CxxTestUtils/src/TestUtilsBook.cpp +++ b/CxxTestUtils/src/TestUtilsBook.cpp @@ -53,7 +53,7 @@ namespace test_utils if (pInstance.canViewAs()) { const auto& rbook = pInstance.view()->get(); - return (Book(PRICE, TITLE) == rbook); + return (Book(PRICE, std::string(TITLE)) == rbook); } return false; } @@ -64,7 +64,7 @@ namespace test_utils if (pInstance.canViewAs()) { Book book; - book.setAuthor(AUTHOR); + book.setAuthor(AUTHOR.data()); const auto& rbook = pInstance.view()->get(); return (book == rbook); } @@ -76,7 +76,7 @@ namespace test_utils if (pInstance.canViewAs()) { Book book; - book.addCopyrightTag(COPYRIGHT_TAG); + book.addCopyrightTag(std::string(COPYRIGHT_TAG)); const auto& rbook = pInstance.view()->get(); return (book == rbook); } @@ -89,7 +89,7 @@ namespace test_utils if (pInstance.canViewAs()) { Book book; - book.addPreface(ACKNOWLEDGEMENTS, PREFACE); + book.addPreface(std::string(ACKNOWLEDGEMENTS), std::string(PREFACE)); const auto& rbook = pInstance.view()->get(); return (book == rbook); } @@ -117,7 +117,7 @@ namespace test_utils if (pInstance.canViewAs()) { Book book; - book.updateBookInfo(TITLE, PRICE, string(AUTHOR)); + book.updateBookInfo(TITLE.data(), PRICE, string(AUTHOR)); const auto& rbook = pInstance.view()->get(); return (book == rbook); } @@ -131,7 +131,7 @@ namespace test_utils if (pInstance.canViewAs()) { Book book; - book.updateBookInfo(string(AUTHOR), PRICE, TITLE); + book.updateBookInfo(string(AUTHOR), PRICE, TITLE.data()); const auto& rbook = pInstance.view()->get(); return (book == rbook); } @@ -143,9 +143,9 @@ namespace test_utils { if (pInstance.canViewAs()) { - Book obj(PRICE, TITLE); - obj.setAuthor(AUTHOR); - obj.setDescription(DESCRIPTION); + Book obj(PRICE, std::string(TITLE)); + obj.setAuthor(std::string(AUTHOR)); + obj.setDescription(std::string(DESCRIPTION)); Book copyObj(obj); const auto& rbook = pInstance.view()->get(); return (copyObj == rbook); diff --git a/CxxTestUtils/src/TestUtilsDate.cpp b/CxxTestUtils/src/TestUtilsDate.cpp index 1864d55f..f3d213ff 100644 --- a/CxxTestUtils/src/TestUtilsDate.cpp +++ b/CxxTestUtils/src/TestUtilsDate.cpp @@ -71,7 +71,7 @@ namespace test_utils { if (pInstance.canViewAs()) { const Date& rdate = pInstance.view()->get(); - return (Date(DATE_STR0) == rdate); + return (Date(std::string(DATE_STR0)) == rdate); } return false; } diff --git a/CxxTestUtils/src/TestUtilsPerson.cpp b/CxxTestUtils/src/TestUtilsPerson.cpp index eb4ab982..4b73576a 100644 --- a/CxxTestUtils/src/TestUtilsPerson.cpp +++ b/CxxTestUtils/src/TestUtilsPerson.cpp @@ -38,7 +38,7 @@ namespace test_utils template<> const std::string person::get_str_returned_on_call_getProfile(const bool pNoAddress) { - return Person::getProfile(OCCUPATION, AGE); + return Person::getProfile(std::string(OCCUPATION), AGE); } @@ -46,8 +46,12 @@ namespace test_utils { if (pInstance.canViewAs()) { - const Person person(FIRST_NAME); - person.updateLastName(LAST_NAME); + auto lastName = std::string(LAST_NAME); + auto firstName = std::string(FIRST_NAME); + + const Person person(firstName); + person.updateLastName(lastName); + const Person& rPerson = pInstance.view()->get(); return (person == rPerson); } @@ -61,8 +65,11 @@ namespace test_utils { if (pInstance.canViewAs()) { - Person person(FIRST_NAME); - person.updateAddress(ADDRESS); + auto address = std::string(ADDRESS); + auto firstName = std::string(FIRST_NAME); + + Person person(firstName); + person.updateAddress(address); const Person& rPerson = pInstance.view()->get(); return (person == rPerson); } @@ -87,8 +94,11 @@ namespace test_utils { if (pInstance.canViewAs()) { - const Person person(FIRST_NAME); - person.updateAddress(ADDRESS); + auto address = std::string(ADDRESS); + auto firstName = std::string(FIRST_NAME); + + const Person person(firstName); + person.updateAddress(address); const Person& rPerson = pInstance.view()->get(); return (person == rPerson); } @@ -101,7 +111,9 @@ namespace test_utils { if (pInstance.canViewAs()) { - Person person(FIRST_NAME); + auto firstName = std::string(FIRST_NAME); + + Person person(firstName); person.updateAddress(); const Person& rPerson = pInstance.view()->get(); return (person == rPerson); @@ -115,7 +127,9 @@ namespace test_utils { if (pInstance.canViewAs()) { - const Person person(FIRST_NAME); + auto firstName = std::string(FIRST_NAME); + + const Person person(firstName); person.updateAddress(); const Person& rPerson = pInstance.view()->get(); return (person == rPerson); diff --git a/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp index 07423656..97017bec 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp @@ -91,7 +91,7 @@ namespace rtl_tests auto setAuthor = oSetAuthor->targetT<>().argsT().returnT<>(); EXPECT_FALSE(setAuthor); - auto [err1, ret] = setAuthor(book)(book::AUTHOR); + auto [err1, ret] = setAuthor(book)(book::AUTHOR.data()); EXPECT_TRUE(err1 == error::SignatureMismatch); ASSERT_TRUE(ret.isEmpty()); @@ -120,7 +120,7 @@ namespace rtl_tests auto setAuthor = oSetAuthor->targetT().argsT().returnT(); EXPECT_FALSE(setAuthor); - auto [err1, ret] = setAuthor(book)(book::AUTHOR); + auto [err1, ret] = setAuthor(book)(book::AUTHOR.data()); EXPECT_TRUE(err1 == error::SignatureMismatch); ASSERT_TRUE(ret.isEmpty()); @@ -213,7 +213,7 @@ namespace rtl_tests auto setAuthor = oSetAuthor->targetT().argsT().returnT(); EXPECT_TRUE(setAuthor); - auto [err1, ret] = setAuthor(book)(book::AUTHOR); + auto [err1, ret] = setAuthor(book)(book::AUTHOR.data()); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -242,7 +242,7 @@ namespace rtl_tests auto setAuthor = oSetAuthor->targetT().argsT().returnT(); EXPECT_TRUE(setAuthor); - auto [err1, ret] = setAuthor(book)(book::AUTHOR); + auto [err1, ret] = setAuthor(book)(book::AUTHOR.data()); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -329,7 +329,7 @@ namespace rtl_tests auto updateBookInfo = oUpdateBookInfo->targetT().argsT().returnT(); EXPECT_TRUE(updateBookInfo); - auto [err1, ret] = updateBookInfo(book)(book::AUTHOR, book::PRICE, book::TITLE); + auto [err1, ret] = updateBookInfo(book)(book::AUTHOR.data(), book::PRICE, book::TITLE.data()); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -360,7 +360,7 @@ namespace rtl_tests auto updateBookInfo = oUpdateBookInfo->targetT().argsT().returnT(); EXPECT_TRUE(updateBookInfo); - auto [err1, ret] = updateBookInfo(book)(book::AUTHOR, book::PRICE, book::TITLE); + auto [err1, ret] = updateBookInfo(book)(book::AUTHOR.data(), book::PRICE, book::TITLE.data()); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -391,7 +391,7 @@ namespace rtl_tests auto updateBookInfo = oUpdateBookInfo->targetT().argsT().returnT(); EXPECT_TRUE(updateBookInfo); - auto [err1, ret] = updateBookInfo(book)(book::TITLE, book::PRICE, book::AUTHOR); + auto [err1, ret] = updateBookInfo(book)(book::TITLE.data(), book::PRICE, book::AUTHOR.data()); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -422,7 +422,7 @@ namespace rtl_tests auto updateBookInfo = oUpdateBookInfo->targetT().argsT().returnT(); EXPECT_TRUE(updateBookInfo); - auto [err1, ret] = updateBookInfo(book)(book::TITLE, book::PRICE, book::AUTHOR); + auto [err1, ret] = updateBookInfo(book)(book::TITLE.data(), book::PRICE, book::AUTHOR.data()); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -455,7 +455,7 @@ namespace rtl_tests //actual signature is 'const string', but we are passing 'string' as argument. which resolves to right call. //as long as any param_type in signature is not reference, const-qualifier do not matter. - auto [err1, ret] = addCopyrightTag(book)(book::COPYRIGHT_TAG); + auto [err1, ret] = addCopyrightTag(book)(book::COPYRIGHT_TAG.data()); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -488,7 +488,7 @@ namespace rtl_tests //actual signature is 'const string', but we are passing 'string' as argument. which resolves to right call. //as long as any param_type in signature is not reference, const-qualifier do not matter. - auto [err1, ret] = addCopyrightTag(book)(book::COPYRIGHT_TAG); + auto [err1, ret] = addCopyrightTag(book)(book::COPYRIGHT_TAG.data()); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -525,7 +525,7 @@ namespace rtl_tests //if the signature has any one type as reference, then types must be explicitly specified using bind<...>() //And reference type must be specified with exact qualifiers, other 'by value' types do no need to explicitly specify the cv-qualifiers. - auto [err1, ret] = addPreface.bind(book)(book::ACKNOWLEDGEMENTS, book::PREFACE); + auto [err1, ret] = addPreface.bind(book)(book::ACKNOWLEDGEMENTS.data(), book::PREFACE.data()); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -562,7 +562,7 @@ namespace rtl_tests //if the signature has any one type as reference, then types must be explicitly specified using bind<...>() //And reference type must be specified with exact qualifiers, other 'by value' types do no need to explicitly specify the cv-qualifiers. - auto [err1, ret] = addPreface.bind(book)(book::ACKNOWLEDGEMENTS, book::PREFACE); + auto [err1, ret] = addPreface.bind(book)(book::ACKNOWLEDGEMENTS.data(), book::PREFACE.data()); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); diff --git a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp index 6d090cf8..244ef93b 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp @@ -35,12 +35,12 @@ namespace rtl_tests method updateLastName = oUpdateLastName->targetT().argsT().returnT(); EXPECT_TRUE(updateLastName); { - auto [err, ret] = updateLastName(book)(person::LAST_NAME); + auto [err, ret] = updateLastName(book)(person::LAST_NAME.data()); // Only const method exits for this function, no non-const overload. EXPECT_TRUE(err == error::NonConstOverloadMissing); ASSERT_TRUE(ret.isEmpty()); } { - auto [err, ret] = updateLastName(std::cref(book))(person::LAST_NAME); + auto [err, ret] = updateLastName(std::cref(book))(person::LAST_NAME.data()); EXPECT_TRUE(err == error::TargetTypeMismatch); ASSERT_TRUE(ret.isEmpty()); @@ -65,7 +65,7 @@ namespace rtl_tests // only const-overload exists, this tries to call the non-const version since // the 'robj' is non-const. RObject robj; - auto [err, ret] = updateLastName(robj)(person::LAST_NAME); + auto [err, ret] = updateLastName(robj)(person::LAST_NAME.data()); EXPECT_TRUE(err == error::NonConstOverloadMissing); ASSERT_TRUE(ret.isEmpty()); } { @@ -73,7 +73,7 @@ namespace rtl_tests // it automatically binds to const-overload, however the 'robj' is empty // hence the expecetd return error is error::EmptyRObject. const RObject robj; - auto [err, ret] = updateLastName(robj)(person::LAST_NAME); + auto [err, ret] = updateLastName(robj)(person::LAST_NAME.data()); EXPECT_TRUE(err == error::EmptyRObject); ASSERT_TRUE(ret.isEmpty()); } @@ -91,7 +91,7 @@ namespace rtl_tests optional oUpdateLastName = classPerson->getMethod(person::str_updateLastName); ASSERT_TRUE(oUpdateLastName); - auto [err0, person] = classPerson->ctorT()(alloc, person::FIRST_NAME); + auto [err0, person] = classPerson->ctorT()(alloc, person::FIRST_NAME.data()); EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(person.isEmpty()); @@ -100,13 +100,13 @@ namespace rtl_tests method updateLastName = oUpdateLastName->targetT().argsT().returnT(); EXPECT_TRUE(updateLastName); { - auto [err, ret] = updateLastName(person)(person::LAST_NAME); + auto [err, ret] = updateLastName(person)(person::LAST_NAME.data()); // only const method exists, no non-const overload found. EXPECT_TRUE(err == error::NonConstOverloadMissing); ASSERT_TRUE(ret.isEmpty()); } { // explicit call to const method. - auto [err, ret] = updateLastName(std::cref(person))(person::LAST_NAME); + auto [err, ret] = updateLastName(std::cref(person))(person::LAST_NAME.data()); EXPECT_TRUE(err == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -131,7 +131,7 @@ namespace rtl_tests optional classPerson = cxx::mirror().getRecord(person::class_); ASSERT_TRUE(classPerson); - auto [err0, person] = classPerson->ctorT()(alloc, person::FIRST_NAME); + auto [err0, person] = classPerson->ctorT()(alloc, person::FIRST_NAME.data()); EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(person.isEmpty()); @@ -143,12 +143,12 @@ namespace rtl_tests EXPECT_TRUE(updateAddress); { // sending 'person' as const (using std::cref) calls the const-method overload. - auto [err, ret] = updateAddress(cref(person))(person::ADDRESS); + auto [err, ret] = updateAddress(cref(person))(person::ADDRESS.data()); EXPECT_TRUE(err == error::None); ASSERT_TRUE(ret.isEmpty()); } { // sending 'person' as non-const calls the non-const-method overload. - auto [err, ret] = updateAddress(person)(person::ADDRESS); + auto [err, ret] = updateAddress(person)(person::ADDRESS.data()); EXPECT_TRUE(err == error::None); ASSERT_TRUE(ret.isEmpty()); } @@ -271,7 +271,7 @@ namespace rtl_tests EXPECT_TRUE(setAnimalName); // Invoke the method with a const L-value reference. - auto [err1, ret1] = setAnimalName(std::cref(animal))(animal::NAME); + auto [err1, ret1] = setAnimalName(std::cref(animal))(animal::NAME.data()); EXPECT_EQ(err1, error::None); EXPECT_EQ(ret1, std::nullopt); diff --git a/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp index 02d633af..d98a7f0f 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp @@ -99,7 +99,7 @@ namespace rtl_tests ASSERT_TRUE(classDate); rtl::constructor ctorT = classDate->ctorT(); - auto [err, date] = ctorT(alloc::Heap, date::DATE_STR0); + auto [err, date] = ctorT(alloc::Heap, date::DATE_STR0.data()); EXPECT_TRUE(err == error::None); ASSERT_FALSE(date.isEmpty()); @@ -117,7 +117,7 @@ namespace rtl_tests ASSERT_TRUE(classDate); rtl::constructor ctorT = classDate->ctorT(); - auto [err, date] = ctorT(alloc::Stack, date::DATE_STR0); + auto [err, date] = ctorT(alloc::Stack, date::DATE_STR0.data()); EXPECT_TRUE(err == error::None); ASSERT_FALSE(date.isEmpty()); @@ -279,7 +279,7 @@ namespace rtl_tests ASSERT_TRUE(classBook); rtl::constructor ctorT = classBook->ctorT(); - auto [err, book] = ctorT(alloc::Heap, book::PRICE, book::TITLE); + auto [err, book] = ctorT(alloc::Heap, book::PRICE, book::TITLE.data()); EXPECT_TRUE(err == error::None); ASSERT_FALSE(book.isEmpty()); @@ -299,7 +299,7 @@ namespace rtl_tests ASSERT_TRUE(classBook); rtl::constructor ctorT = classBook->ctorT(); - auto [err, book] = ctorT(alloc::Stack, book::PRICE, book::TITLE); + auto [err, book] = ctorT(alloc::Stack, book::PRICE, book::TITLE.data()); EXPECT_TRUE(err == error::None); ASSERT_FALSE(book.isEmpty()); diff --git a/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp index 27291fa3..aec4602c 100644 --- a/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp @@ -116,7 +116,7 @@ namespace rtl_tests rtl::constructor ctorT = classBook->ctorT(); - auto [err0, book] = ctorT(alloc::Heap, book::PRICE, book::TITLE); + auto [err0, book] = ctorT(alloc::Heap, book::PRICE, book::TITLE.data()); EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); { @@ -125,7 +125,7 @@ namespace rtl_tests auto setAuthor = oSetAuthor->targetT().argsT().returnT(); - auto [err, ret] = setAuthor(book)(book::AUTHOR); + auto [err, ret] = setAuthor(book)(book::AUTHOR.data()); EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } { @@ -134,7 +134,7 @@ namespace rtl_tests auto setDescription = oSetDescription->targetT().argsT().returnT(); - auto [err, ret] = setDescription(book)(book::DESCRIPTION); + auto [err, ret] = setDescription(book)(book::DESCRIPTION.data()); EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } @@ -161,7 +161,7 @@ namespace rtl_tests rtl::constructor ctorT = classBook->ctorT(); - auto [err0, book] = ctorT(alloc::Stack, book::PRICE, book::TITLE); + auto [err0, book] = ctorT(alloc::Stack, book::PRICE, book::TITLE.data()); EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); { @@ -170,7 +170,7 @@ namespace rtl_tests auto setAuthor = oSetAuthor->targetT().argsT().returnT(); - auto [err, ret] = setAuthor(book)(book::AUTHOR); + auto [err, ret] = setAuthor(book)(book::AUTHOR.data()); EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } { @@ -179,7 +179,7 @@ namespace rtl_tests auto setDescription = oSetDescription->targetT().argsT().returnT(); - auto [err, ret] = setDescription(book)(book::DESCRIPTION); + auto [err, ret] = setDescription(book)(book::DESCRIPTION.data()); EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } @@ -206,7 +206,7 @@ namespace rtl_tests rtl::constructor ctorT = classBook->ctorT(); - auto [err0, book] = ctorT(alloc::Stack, book::PRICE, book::TITLE); + auto [err0, book] = ctorT(alloc::Stack, book::PRICE, book::TITLE.data()); EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); { @@ -215,7 +215,7 @@ namespace rtl_tests auto setAuthor = oSetAuthor->targetT().argsT().returnT(); - auto [err, ret] = setAuthor(book)(book::AUTHOR); + auto [err, ret] = setAuthor(book)(book::AUTHOR.data()); EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } { @@ -224,7 +224,7 @@ namespace rtl_tests auto setDescription = oSetDescription->targetT().argsT().returnT(); - auto [err, ret] = setDescription(book)(book::DESCRIPTION); + auto [err, ret] = setDescription(book)(book::DESCRIPTION.data()); EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } @@ -251,7 +251,7 @@ namespace rtl_tests rtl::constructor ctorT = classBook->ctorT(); - auto [err0, book] = ctorT(alloc::Heap, book::PRICE, book::TITLE); + auto [err0, book] = ctorT(alloc::Heap, book::PRICE, book::TITLE.data()); EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); { @@ -260,7 +260,7 @@ namespace rtl_tests auto setAuthor = oSetAuthor->targetT().argsT().returnT(); - auto [err, ret] = setAuthor(book)(book::AUTHOR); + auto [err, ret] = setAuthor(book)(book::AUTHOR.data()); EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } { @@ -269,7 +269,7 @@ namespace rtl_tests auto setDescription = oSetDescription->targetT().argsT().returnT(); - auto [err, ret] = setDescription(book)(book::DESCRIPTION); + auto [err, ret] = setDescription(book)(book::DESCRIPTION.data()); EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } @@ -354,7 +354,7 @@ namespace rtl_tests method updateDate = oUpdateDate->targetT().argsT().returnT(); EXPECT_TRUE(updateDate); { - auto [err, ret] = updateDate(date0)(date::DATE_STR1); + auto [err, ret] = updateDate(date0)(date::DATE_STR1.data()); ASSERT_TRUE(err == error::None && ret.isEmpty()); // After mutation, they should be still equal. EXPECT_TRUE(date::test_if_obejcts_are_equal(date0, date1)); @@ -435,7 +435,7 @@ namespace rtl_tests method updateDate = oUpdateDate->targetT().argsT().returnT(); EXPECT_TRUE(updateDate); { - auto [err, ret] = updateDate(date0)(date::DATE_STR1); + auto [err, ret] = updateDate(date0)(date::DATE_STR1.data()); ASSERT_TRUE(err == error::None && ret.isEmpty()); // After mutation, they should be still equal. EXPECT_TRUE(date::test_if_obejcts_are_equal(date0, date1)); @@ -516,7 +516,7 @@ namespace rtl_tests method updateDate = oUpdateDate->targetT().argsT().returnT(); EXPECT_TRUE(updateDate); { - auto [err, ret] = updateDate(date0)(date::DATE_STR1); + auto [err, ret] = updateDate(date0)(date::DATE_STR1.data()); ASSERT_TRUE(err == error::None && ret.isEmpty()); // After mutation, they should be still equal. EXPECT_TRUE(date::test_if_obejcts_are_equal(date0, date1)); @@ -597,7 +597,7 @@ namespace rtl_tests method updateDate = oUpdateDate->targetT().argsT().returnT(); EXPECT_TRUE(updateDate); { - auto [err, ret] = updateDate(date0)(date::DATE_STR1); + auto [err, ret] = updateDate(date0)(date::DATE_STR1.data()); ASSERT_TRUE(err == error::None && ret.isEmpty()); // After mutation, they should be not be equal, since both are unique instances. EXPECT_FALSE(date::test_if_obejcts_are_equal(date0, date1)); diff --git a/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp b/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp index 9cf3ab1f..143fb8d5 100644 --- a/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp @@ -212,7 +212,7 @@ namespace rtl_tests { //STRA's type is 'const char*', function accepts 'string', //so type-casting in place as 'string' - auto [err, ret] = reverseString(STRA); + auto [err, ret] = reverseString(STRA.data()); EXPECT_TRUE(err == rtl::error::None); ASSERT_FALSE(ret.isEmpty()); EXPECT_TRUE(ret.canViewAs()); @@ -223,7 +223,7 @@ namespace rtl_tests } { //STRB's type is 'const char*', function accepts 'string', //so explicitly binding type in template (using bind<...>()) to enforce the type as 'string'. - auto [err, ret] = reverseString(STRB); + auto [err, ret] = reverseString(STRB.data()); EXPECT_TRUE(err == rtl::error::None); ASSERT_FALSE(ret.isEmpty()); diff --git a/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp b/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp index d2860be0..990f961a 100644 --- a/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp @@ -59,7 +59,7 @@ namespace rtl_tests EXPECT_TRUE(setAnimalName); // Invoke the method with an R-value reference. - auto [err1, ret1] = setAnimalName.bind(animal)(animal::NAME); + auto [err1, ret1] = setAnimalName.bind(animal)(animal::NAME.data()); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret1.isEmpty()); @@ -100,8 +100,9 @@ namespace rtl_tests auto setAnimalName = oSetAnimalName->targetT().argsT().returnT(); EXPECT_TRUE(setAnimalName); + auto lvstr = std::string(animal::NAME); // Invoke the method with a non-const L-value reference. - auto [err1, ret1] = setAnimalName.bind(animal)(animal::NAME); + auto [err1, ret1] = setAnimalName.bind(animal)(lvstr); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret1.isEmpty()); @@ -143,7 +144,7 @@ namespace rtl_tests EXPECT_TRUE(setAnimalName); // Invoke the method with a const L-value reference. - auto [err1, ret1] = setAnimalName.bind(animal)(animal::NAME); + auto [err1, ret1] = setAnimalName.bind(animal)(animal::NAME.data()); EXPECT_TRUE(err1 == error::None); EXPECT_TRUE(ret1.isEmpty()); @@ -187,7 +188,7 @@ namespace rtl_tests EXPECT_TRUE(setAnimalName); // Invoke the method with an R-value reference. - auto [err1, ret1] = setAnimalName.bind(animal)(animal::NAME); + auto [err1, ret1] = setAnimalName.bind(animal)(animal::NAME.data()); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret1.isEmpty()); @@ -229,7 +230,7 @@ namespace rtl_tests EXPECT_TRUE(setAnimalName); // Invoke the method with a non-const L-value reference. - auto [err1, ret1] = setAnimalName.bind(animal)(animal::NAME); + auto [err1, ret1] = setAnimalName.bind(animal)(animal::NAME.data()); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret1.isEmpty()); @@ -271,7 +272,7 @@ namespace rtl_tests EXPECT_TRUE(setAnimalName); // Invoke the method with a const L-value reference. - auto [err1, ret1] = setAnimalName.bind(animal)(animal::NAME); + auto [err1, ret1] = setAnimalName.bind(animal)(animal::NAME.data()); EXPECT_TRUE(err1 == error::None); EXPECT_TRUE(ret1.isEmpty()); @@ -300,11 +301,11 @@ namespace rtl_tests auto updateZooKeeper = oUpdateZooKeeper->argsT().returnT<>(); { - auto [err, ret] = updateZooKeeper(animal::ZOO_KEEPER); + auto [err, ret] = updateZooKeeper(animal::ZOO_KEEPER.data()); EXPECT_TRUE(err == error::ExplicitRefBindingRequired); EXPECT_TRUE(ret.isEmpty()); } { - auto [err, ret] = updateZooKeeper.bind()(animal::ZOO_KEEPER); + auto [err, ret] = updateZooKeeper.bind()(animal::ZOO_KEEPER.data()); EXPECT_TRUE(err == error::None); ASSERT_FALSE(ret.isEmpty()); @@ -335,7 +336,7 @@ namespace rtl_tests rtl::static_method updateZooKeeper = oUpdateZooKeeper->argsT() .returnT<>(); - auto [err, ret] = updateZooKeeper.bind()(animal::ZOO_KEEPER); + auto [err, ret] = updateZooKeeper.bind()(animal::ZOO_KEEPER.data()); EXPECT_TRUE(err == error::None); ASSERT_FALSE(ret.isEmpty()); @@ -364,7 +365,7 @@ namespace rtl_tests rtl::static_method updateZooKeeper = oUpdateZooKeeper->argsT() .returnT<>(); - auto [err, ret] = updateZooKeeper.bind()(animal::ZOO_KEEPER); + auto [err, ret] = updateZooKeeper.bind()(animal::ZOO_KEEPER.data()); EXPECT_TRUE(err == error::None); ASSERT_FALSE(ret.isEmpty()); diff --git a/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp b/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp index 723dd918..43c47ca0 100644 --- a/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp @@ -109,7 +109,7 @@ namespace rtl_tests ASSERT_TRUE(getProfileFn); EXPECT_EQ(getProfileFn.get_init_error(), rtl::error::None); - auto [err, ret] = getProfileFn(person::OCCUPATION, person::AGE); + auto [err, ret] = getProfileFn(person::OCCUPATION.data(), person::AGE); EXPECT_TRUE(err == error::None); ASSERT_FALSE(ret.isEmpty()); @@ -182,7 +182,7 @@ namespace rtl_tests EXPECT_EQ(err0, error::None); ASSERT_FALSE(person.isEmpty()); - auto [err, ret] = optGetProfile(person)(person::OCCUPATION, person::AGE); + auto [err, ret] = optGetProfile(person)(person::OCCUPATION.data(), person::AGE); EXPECT_EQ(err, error::SignatureMismatch); ASSERT_TRUE(ret.isEmpty()); @@ -190,7 +190,7 @@ namespace rtl_tests rtl::static_method optGetProfile = getProfileOpt.value() .argsT() .returnT(); - auto [err, ret] = optGetProfile(person::OCCUPATION, person::AGE); + auto [err, ret] = optGetProfile(person::OCCUPATION.data(), person::AGE); EXPECT_EQ(err, error::None); ASSERT_FALSE(ret.isEmpty()); diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_ConstMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_ConstMethod.cpp index e173e78b..acc8f92b 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_ConstMethod.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_ConstMethod.cpp @@ -110,8 +110,8 @@ namespace rtl_tests .returnT(); ASSERT_TRUE(reverse_string); - std::string ret_str = reverse_string(StrConst())(STRA); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_const_char_ptr + SUFFIX_const; + std::string ret_str = reverse_string(StrConst())(STRA.data()); + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_const_char_ptr).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } { rtl::const_method reverse_string = reverseString->targetT() @@ -119,8 +119,8 @@ namespace rtl_tests .returnT(); ASSERT_TRUE(reverse_string); - std::string ret_str = reverse_string(StrConst())(STRB); - auto exp_str = std::string(StrConst::struct_) + STRB_REVERSE + SUFFIX_std_string + SUFFIX_const; + std::string ret_str = reverse_string(StrConst())(STRB.data()); + auto exp_str = std::string(StrConst::struct_).append(STRB_REVERSE).append(SUFFIX_std_string).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } { rtl::const_method reverse_string = reverseString->targetT() @@ -129,7 +129,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(StrConst())(); - auto exp_str = std::string(StrConst::struct_) + REV_STR_VOID_RET + SUFFIX_void + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(REV_STR_VOID_RET).append(SUFFIX_void).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } } @@ -150,10 +150,10 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); //non-const target StrConst target; - std::string lv_str = STRA; + std::string lv_str(STRA); std::string ret_str = reverse_string(target)(lv_str); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_lvref + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_lvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } { //argument const-lvalue-ref. @@ -163,10 +163,10 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); //non-const target StrConst target; - const std::string lv_str = STRA; + const std::string lv_str(STRA); std::string ret_str = reverse_string(target)(lv_str); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_clvref + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_clvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } { //argument lvalue-ref. @@ -176,10 +176,10 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); //const target. const StrConst target; - std::string lv_str = STRA; + std::string lv_str(STRA); std::string ret_str = reverse_string(target)(lv_str); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_lvref + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_lvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } { //argument const-lvalue-ref. @@ -189,10 +189,10 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); //const target. const StrConst target; - const std::string lv_str = STRA; + const std::string lv_str(STRA); std::string ret_str = reverse_string(target)(lv_str); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_clvref + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_clvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } } @@ -214,16 +214,16 @@ namespace rtl_tests { //non-const target. StrConst target; - std::string ret_str = reverse_string(target)(STRA); + std::string ret_str = reverse_string(target)(std::string(STRA)); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_rvref + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_rvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } { //const-target const StrConst target; - std::string ret_str = reverse_string(target)(STRA); + std::string ret_str = reverse_string(target)(std::string(STRA)); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_rvref + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_rvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } } { @@ -241,7 +241,7 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrConst target; - std::string str = STRA; + std::string str(STRA); std::optional reverseString = optStringUtil->getMethod(str_reverseString); ASSERT_TRUE(reverseString); { @@ -251,7 +251,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(target)(&str); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_ptr + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_ptr).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } { rtl::const_method reverse_string = reverseString->targetT() @@ -260,7 +260,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(target)(&str); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_cptr + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_cptr).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } } @@ -301,7 +301,7 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrConst target; - std::string str = STRA; + std::string str(STRA); { std::optional reverseString = optStringUtil->getMethod(str_revStrConstRefArg); ASSERT_TRUE(reverseString); @@ -314,7 +314,7 @@ namespace rtl_tests StrConst target; std::string ret_str = reverse_string(target)(str); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_view_clvref + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } { std::optional reverseString = optStringUtil->getMethod(str_revStrNonConstRefArg); @@ -328,7 +328,7 @@ namespace rtl_tests auto lvstr = std::string_view(str); std::string ret_str = reverse_string(target)(lvstr); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_view_lvref + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } { std::optional reverseString = optStringUtil->getMethod(str_revStrRValueRefArg); @@ -341,7 +341,7 @@ namespace rtl_tests std::string ret_str = reverse_string(target)(std::string_view(str)); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_view_rvref + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_rvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } } @@ -362,7 +362,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(target)(std::string_view(STRA)); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_view + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } { rtl::const_method reverse_string = reverseString->targetT() @@ -373,7 +373,7 @@ namespace rtl_tests std::string_view str = STRA; std::string ret_str = reverse_string(target)(str); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_view_lvref + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } } @@ -394,7 +394,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(target)(std::string_view(STRA)); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_view + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } { rtl::const_method reverse_string = reverseString->targetT() @@ -403,7 +403,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(target)(std::string_view(STRA)); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_view_clvref + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } } @@ -415,7 +415,7 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrConst target; - std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValRefAndCRef); + std::optional reverseString = optStringUtil->getMethod(cxx::type::StrConst::fn::revStrOverloadRefAndCRef::id); ASSERT_TRUE(reverseString); { rtl::const_method reverse_string = reverseString->targetT() @@ -425,7 +425,7 @@ namespace rtl_tests std::string_view str = STRA; std::string ret_str = reverse_string(target)(str); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_view_lvref + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } { rtl::const_method reverse_string = reverseString->targetT() @@ -434,7 +434,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(target)(std::string_view(STRA)); - auto exp_str = std::string(StrConst::struct_) + STRA_REVERSE + SUFFIX_std_string_view_clvref + SUFFIX_const; + auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } } diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp index 0624bb19..278873fc 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp @@ -114,22 +114,22 @@ namespace rtl_tests rtl::function reverse_string = reverseString->argsT().returnT(); ASSERT_TRUE(reverse_string); - std::string ret_str = reverse_string(STRA); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_const_char_ptr; + std::string ret_str = reverse_string(STRA.data()); + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_const_char_ptr); EXPECT_EQ(ret_str, exp_str); } { rtl::function reverse_string = reverseString->argsT().returnT(); ASSERT_TRUE(reverse_string); - std::string ret_str = reverse_string(STRB); - auto exp_str = std::string(STRB_REVERSE) + SUFFIX_std_string; + std::string ret_str = reverse_string(STRB.data()); + auto exp_str = std::string(STRB_REVERSE).append(SUFFIX_std_string); EXPECT_EQ(ret_str, exp_str); } { rtl::function reverse_string = reverseString->argsT<>().returnT(); ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(); - auto exp_str = std::string(REV_STR_VOID_RET) + SUFFIX_void; + auto exp_str = std::string(REV_STR_VOID_RET).append(SUFFIX_void); EXPECT_EQ(ret_str, exp_str); } } @@ -143,17 +143,17 @@ namespace rtl_tests rtl::function reverse_string = reverseString->argsT().returnT(); ASSERT_TRUE(reverse_string); - std::string lv_str = STRA; + std::string lv_str(STRA); std::string ret_str = reverse_string(lv_str); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_lvref; + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_lvref); EXPECT_EQ(ret_str, exp_str); } { rtl::function reverse_string = reverseString->argsT().returnT(); ASSERT_TRUE(reverse_string); - const std::string lv_str = STRA; + const std::string lv_str(STRA); std::string ret_str = reverse_string(lv_str); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_clvref; + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_clvref); EXPECT_EQ(ret_str, exp_str); } } @@ -167,8 +167,8 @@ namespace rtl_tests rtl::function reverse_string = reverseString->argsT().returnT(); ASSERT_TRUE(reverse_string); - std::string ret_str = reverse_string(STRA); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_rvref; + std::string ret_str = reverse_string(STRA.data()); + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_rvref); EXPECT_EQ(ret_str, exp_str); } { rtl::function reverse_string = reverseString->argsT().returnT(); @@ -179,7 +179,7 @@ namespace rtl_tests TEST(TypeAware_Function, ptr_and_const_ptr_overload_resolution_with_known_signatures) { - std::string str = STRA; + std::string str(STRA); std::optional reverseString = cxx::mirror().getFunction(str_reverseString); ASSERT_TRUE(reverseString); { @@ -187,14 +187,14 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(&str); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_ptr; + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_ptr); EXPECT_EQ(ret_str, exp_str); } { rtl::function reverse_string = reverseString->argsT().returnT(); ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(&str); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_cptr; + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_cptr); EXPECT_EQ(ret_str, exp_str); } } @@ -202,7 +202,7 @@ namespace rtl_tests TEST(TypeAware_Function, distinct_functions_with_ref_args_call_with_known_signature) { - std::string str = STRA; + std::string str(STRA); { std::optional reverseString = cxx::mirror().getFunction(str_revStrConstRefArg); ASSERT_TRUE(reverseString); @@ -211,7 +211,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(str); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(ret_str, exp_str); } { std::optional reverseString = cxx::mirror().getFunction(str_revStrNonConstRefArg); @@ -222,7 +222,7 @@ namespace rtl_tests auto lvstr = std::string_view(str); std::string ret_str = reverse_string(lvstr); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_lvref); EXPECT_EQ(ret_str, exp_str); } { std::optional reverseString = cxx::mirror().getFunction(str_revStrRValueRefArg); @@ -232,7 +232,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(std::string_view(str)); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_rvref; + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_rvref); EXPECT_EQ(ret_str, exp_str); } } @@ -247,7 +247,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(std::string_view(STRA)); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_view); EXPECT_EQ(ret_str, exp_str); } { rtl::function reverse_string = reverseString->argsT().returnT(); @@ -255,7 +255,7 @@ namespace rtl_tests std::string_view str = STRA; std::string ret_str = reverse_string(str); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_lvref); EXPECT_EQ(ret_str, exp_str); } } @@ -270,14 +270,14 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(std::string_view(STRA)); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_view); EXPECT_EQ(ret_str, exp_str); } { rtl::function reverse_string = reverseString->argsT().returnT(); ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(std::string_view(STRA)); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(ret_str, exp_str); } } @@ -285,7 +285,7 @@ namespace rtl_tests TEST(TypeAware_Function, overloads_with_ref_and_const_ref_args_call_with_known_signature) { - std::optional reverseString = cxx::mirror().getFunction(str_revStrOverloadValRefAndCRef); + std::optional reverseString = cxx::mirror().getFunction(cxx::type::StrConst::fn::revStrOverloadRefAndCRef::id); ASSERT_TRUE(reverseString); { rtl::function reverse_string = reverseString->argsT().returnT(); @@ -293,14 +293,14 @@ namespace rtl_tests std::string_view str = STRA; std::string ret_str = reverse_string(str); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_lvref); EXPECT_EQ(ret_str, exp_str); } { rtl::function reverse_string = reverseString->argsT().returnT(); ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(std::string_view(STRA)); - auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(ret_str, exp_str); } } diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Method.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Method.cpp index fd5662e8..84529707 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Method.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Method.cpp @@ -75,8 +75,8 @@ namespace rtl_tests .returnT(); ASSERT_TRUE(reverse_string); - std::string ret_str = reverse_string(StrMute())(STRA); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_const_char_ptr; + std::string ret_str = reverse_string(StrMute())(STRA.data()); + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_const_char_ptr); EXPECT_EQ(ret_str, exp_str); } { rtl::method reverse_string = reverseString->targetT() @@ -84,8 +84,8 @@ namespace rtl_tests .returnT(); ASSERT_TRUE(reverse_string); - std::string ret_str = reverse_string(StrMute())(STRB); - auto exp_str = std::string(StrMute::struct_) + STRB_REVERSE + SUFFIX_std_string; + std::string ret_str = reverse_string(StrMute())(STRB.data()); + auto exp_str = std::string(StrMute::struct_).append(STRB_REVERSE).append(SUFFIX_std_string); EXPECT_EQ(ret_str, exp_str); } { rtl::method reverse_string = reverseString->targetT() @@ -94,7 +94,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(StrMute())(); - auto exp_str = std::string(StrMute::struct_) + REV_STR_VOID_RET + SUFFIX_void; + auto exp_str = std::string(StrMute::struct_).append(REV_STR_VOID_RET).append(SUFFIX_void); EXPECT_EQ(ret_str, exp_str); } } @@ -115,10 +115,10 @@ namespace rtl_tests .argsT() .returnT(); ASSERT_TRUE(reverse_string); - std::string lv_str = STRA; + std::string lv_str(STRA); std::string ret_str = reverse_string(target)(lv_str); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_lvref; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_lvref); EXPECT_EQ(ret_str, exp_str); } { //argument const-lvalue-ref @@ -127,9 +127,9 @@ namespace rtl_tests .returnT(); ASSERT_TRUE(reverse_string); - const std::string lv_str = STRA; + const std::string lv_str(STRA); std::string ret_str = reverse_string(target)(lv_str); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_clvref; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_clvref); EXPECT_EQ(ret_str, exp_str); } { //argument lvalue-ref @@ -139,13 +139,13 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); //const-target. const StrMute& c_target = target; - std::string lv_str = STRA; + std::string lv_str(STRA); // compile error - // std::string ret_str = reverse_string(const_target)(lv_str); std::string ret_str = reverse_string(const_cast(c_target))(lv_str); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_lvref; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_lvref); EXPECT_EQ(ret_str, exp_str); } { //argument const-lvalue-ref @@ -155,13 +155,13 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); //const-target. const StrMute& c_target = target; - std::string lv_str = STRA; + std::string lv_str(STRA); // compile error - // std::string ret_str = reverse_string(c_target)(lv_str); std::string ret_str = reverse_string(const_cast(c_target))(lv_str); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_clvref; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_clvref); EXPECT_EQ(ret_str, exp_str); } } @@ -181,8 +181,8 @@ namespace rtl_tests .returnT(); ASSERT_TRUE(reverse_string); - std::string ret_str = reverse_string(target)(STRA); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_rvref; + std::string ret_str = reverse_string(target)(std::string(STRA)); + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_rvref); EXPECT_EQ(ret_str, exp_str); } { rtl::method reverse_string = reverseString->targetT() @@ -199,7 +199,7 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrMute target; - std::string str = STRA; + std::string str(STRA); std::optional reverseString = optStringUtil->getMethod(str_reverseString); ASSERT_TRUE(reverseString); { @@ -209,7 +209,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(target)(&str); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_ptr; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_ptr); EXPECT_EQ(ret_str, exp_str); } { rtl::method reverse_string = reverseString->targetT() @@ -218,7 +218,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(target)(&str); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_cptr; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_cptr); EXPECT_EQ(ret_str, exp_str); } } @@ -230,7 +230,7 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrMute target; - std::string str = STRA; + std::string str(STRA); { std::optional reverseString = optStringUtil->getMethod(str_revStrConstRefArg); ASSERT_TRUE(reverseString); @@ -241,7 +241,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(target)(str); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_clvref; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(ret_str, exp_str); } { std::optional reverseString = optStringUtil->getMethod(str_revStrNonConstRefArg); @@ -254,7 +254,7 @@ namespace rtl_tests auto lvstr = std::string_view(str); std::string ret_str = reverse_string(target)(lvstr); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_lvref; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref); EXPECT_EQ(ret_str, exp_str); } { std::optional reverseString = optStringUtil->getMethod(str_revStrRValueRefArg); @@ -266,7 +266,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(target)(std::string_view(str)); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_rvref; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_rvref); EXPECT_EQ(ret_str, exp_str); } } @@ -287,7 +287,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(target)(std::string_view(STRA)); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view); EXPECT_EQ(ret_str, exp_str); } { rtl::method reverse_string = reverseString->targetT() @@ -297,7 +297,7 @@ namespace rtl_tests std::string_view str = STRA; std::string ret_str = reverse_string(target)(str); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_lvref; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref); EXPECT_EQ(ret_str, exp_str); } } @@ -318,7 +318,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(target)(std::string_view(STRA)); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view); EXPECT_EQ(ret_str, exp_str); } { rtl::method reverse_string = reverseString->targetT() @@ -327,7 +327,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(target)(std::string_view(STRA)); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_clvref; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(ret_str, exp_str); } } @@ -339,7 +339,7 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrMute target; - std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValRefAndCRef); + std::optional reverseString = optStringUtil->getMethod(cxx::type::StrConst::fn::revStrOverloadRefAndCRef::id); ASSERT_TRUE(reverseString); { rtl::method reverse_string = reverseString->targetT() @@ -349,7 +349,7 @@ namespace rtl_tests std::string_view str = STRA; std::string ret_str = reverse_string(target)(str); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_lvref; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref); EXPECT_EQ(ret_str, exp_str); } { rtl::method reverse_string = reverseString->targetT() @@ -358,7 +358,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(target)(std::string_view(STRA)); - auto exp_str = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_clvref; + auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(ret_str, exp_str); } } diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_StaticMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_StaticMethod.cpp index 2e2247b0..ecd46c37 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_StaticMethod.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_StaticMethod.cpp @@ -127,8 +127,8 @@ namespace rtl_tests .returnT(); ASSERT_TRUE(reverse_string); - std::string ret_str = reverse_string(STRA); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_const_char_ptr + SUFFIX_static; + std::string ret_str = reverse_string(STRA.data()); + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_const_char_ptr).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } { rtl::static_method reverse_string = reverseString.value() @@ -136,8 +136,8 @@ namespace rtl_tests .returnT(); ASSERT_TRUE(reverse_string); - std::string ret_str = reverse_string(STRB); - auto exp_str = std::string(StrStatic::struct_) + STRB_REVERSE + SUFFIX_std_string + SUFFIX_static; + std::string ret_str = reverse_string(STRB.data()); + auto exp_str = std::string(StrStatic::struct_).append(STRB_REVERSE).append(SUFFIX_std_string).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } { rtl::static_method reverse_string = reverseString.value() @@ -146,7 +146,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(); - auto exp_str = std::string(StrStatic::struct_) + REV_STR_VOID_RET + SUFFIX_void + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(REV_STR_VOID_RET).append(SUFFIX_void).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } } @@ -167,10 +167,10 @@ namespace rtl_tests .argsT() .returnT(); ASSERT_TRUE(reverse_string); - std::string lv_str = STRA; + std::string lv_str(STRA); std::string ret_str = reverse_string(lv_str); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_lvref + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_lvref).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } { //argument const-lvalue-ref @@ -179,9 +179,9 @@ namespace rtl_tests .returnT(); ASSERT_TRUE(reverse_string); - const std::string lv_str = STRA; + const std::string lv_str(STRA); std::string ret_str = reverse_string(lv_str); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_clvref + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_clvref).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } { //argument lvalue-ref @@ -189,10 +189,10 @@ namespace rtl_tests .argsT() .returnT(); ASSERT_TRUE(reverse_string); - std::string lv_str = STRA; + std::string lv_str(STRA); std::string ret_str = reverse_string(lv_str); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_lvref + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_lvref).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } { //argument const-lvalue-ref @@ -202,11 +202,11 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); //const-target. const StrMute& c_target = target; - std::string lv_str = STRA; + std::string lv_str(STRA); std::string ret_str = reverse_string(lv_str); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_clvref + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_clvref).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } } @@ -225,8 +225,8 @@ namespace rtl_tests .returnT(); ASSERT_TRUE(reverse_string); - std::string ret_str = reverse_string(STRA); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_rvref + SUFFIX_static; + std::string ret_str = reverse_string(STRA.data()); + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_rvref).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } } @@ -237,7 +237,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); ASSERT_TRUE(optStringUtil); - std::string str = STRA; + std::string str(STRA); std::optional reverseString = optStringUtil->getMethod(str_reverseString); ASSERT_TRUE(reverseString); { @@ -247,7 +247,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(&str); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_ptr + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_ptr).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } { rtl::static_method reverse_string = reverseString.value() @@ -256,7 +256,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(&str); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_cptr + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_cptr).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } } @@ -267,7 +267,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); ASSERT_TRUE(optStringUtil); - std::string str = STRA; + std::string str(STRA); { std::optional reverseString = optStringUtil->getMethod(str_revStrConstRefArg); ASSERT_TRUE(reverseString); @@ -278,7 +278,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(str); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_view_clvref + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } { std::optional reverseString = optStringUtil->getMethod(str_revStrNonConstRefArg); @@ -291,7 +291,7 @@ namespace rtl_tests auto lvstr = std::string_view(str); std::string ret_str = reverse_string(lvstr); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_view_lvref + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } { std::optional reverseString = optStringUtil->getMethod(str_revStrRValueRefArg); @@ -303,7 +303,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(std::string_view(str)); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_view_rvref + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_rvref).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } } @@ -323,7 +323,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(std::string_view(STRA)); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_view + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } { rtl::static_method reverse_string = reverseString.value() @@ -333,7 +333,7 @@ namespace rtl_tests std::string_view str = STRA; std::string ret_str = reverse_string(str); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_view_lvref + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } } @@ -353,7 +353,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(std::string_view(STRA)); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_view + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } { rtl::static_method reverse_string = reverseString.value() @@ -362,7 +362,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(std::string_view(STRA)); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_view_clvref + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } } @@ -373,7 +373,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValRefAndCRef); + std::optional reverseString = optStringUtil->getMethod(cxx::type::StrConst::fn::revStrOverloadRefAndCRef::id); ASSERT_TRUE(reverseString); { rtl::static_method reverse_string = reverseString.value() @@ -383,7 +383,7 @@ namespace rtl_tests std::string_view str = STRA; std::string ret_str = reverse_string(str); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_view_lvref + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } { rtl::static_method reverse_string = reverseString.value() @@ -392,7 +392,7 @@ namespace rtl_tests ASSERT_TRUE(reverse_string); std::string ret_str = reverse_string(std::string_view(STRA)); - auto exp_str = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_view_clvref + SUFFIX_static; + auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } } diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp index 70aaeca4..c2ec83f3 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp @@ -49,15 +49,16 @@ namespace rtl_tests ASSERT_TRUE(reverseStrOpt); EXPECT_FALSE(reverseStrOpt->hasSignature()); { + std::string str(STRA); rtl::function reverseString = reverseStrOpt->argsT().returnT<>(); EXPECT_FALSE(reverseString); EXPECT_EQ(reverseString.get_init_error(), rtl::error::SignatureMismatch); { - auto [err, robj] = reverseString(const_cast(STRA)); + auto [err, robj] = reverseString(const_cast(str.c_str())); EXPECT_EQ(err, rtl::error::SignatureMismatch); EXPECT_TRUE(robj.isEmpty()); } { - auto [err, robj] = reverseString.bind()(const_cast(STRA)); + auto [err, robj] = reverseString.bind()(const_cast(str.c_str())); EXPECT_EQ(err, rtl::error::SignatureMismatch); EXPECT_TRUE(robj.isEmpty()); @@ -68,7 +69,7 @@ namespace rtl_tests rtl::function reverseString = reverseStrOpt->argsT().returnT<>(); EXPECT_TRUE(reverseString); { - auto [err, robj] = reverseString(STRA); + auto [err, robj] = reverseString(STRA.data()); EXPECT_EQ(err, rtl::error::None); ASSERT_FALSE(robj.isEmpty()); @@ -78,7 +79,7 @@ namespace rtl_tests std::string expStr = std::string(STRA_REVERSE) + SUFFIX_const_char_ptr; EXPECT_EQ(retStr, expStr); } { - auto [err, robj] = reverseString.bind()(STRA); + auto [err, robj] = reverseString.bind()(STRA.data()); EXPECT_EQ(err, rtl::error::None); ASSERT_FALSE(robj.isEmpty()); @@ -94,7 +95,7 @@ namespace rtl_tests rtl::function reverseString = reverseStrOpt->argsT().returnT<>(); EXPECT_TRUE(reverseString); { - auto [err, robj] = reverseString(STRA); + auto [err, robj] = reverseString(STRA.data()); EXPECT_EQ(err, rtl::error::None); ASSERT_FALSE(robj.isEmpty()); @@ -104,7 +105,7 @@ namespace rtl_tests std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string; EXPECT_EQ(retStr, expStr); } { - auto [err, robj] = reverseString.bind()(STRA); + auto [err, robj] = reverseString.bind()(STRA.data()); EXPECT_EQ(err, rtl::error::None); ASSERT_FALSE(robj.isEmpty()); @@ -120,7 +121,7 @@ namespace rtl_tests rtl::function reverseString = reverseStrOpt->argsT().returnT<>(); EXPECT_TRUE(reverseString); { - std::string str = STRA; + std::string str(STRA); auto [err, robj] = reverseString(&str); EXPECT_EQ(err, rtl::error::None); @@ -131,7 +132,7 @@ namespace rtl_tests std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_ptr; EXPECT_EQ(retStr, expStr); } { - std::string str = STRA; + std::string str(STRA); auto [err, robj] = reverseString.bind()(&str); EXPECT_EQ(err, rtl::error::None); @@ -148,7 +149,7 @@ namespace rtl_tests rtl::function reverseString = reverseStrOpt->argsT().returnT<>(); EXPECT_TRUE(reverseString); { - const std::string str = STRA; + const std::string str(STRA); auto [err, robj] = reverseString(&str); EXPECT_EQ(err, rtl::error::None); @@ -159,7 +160,7 @@ namespace rtl_tests std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_cptr; EXPECT_EQ(retStr, expStr); } { - const std::string str = STRA; + const std::string str(STRA); auto [err, robj] = reverseString.bind()(&str); EXPECT_EQ(err, rtl::error::None); @@ -481,7 +482,7 @@ namespace rtl_tests TEST(ReturnErased_Function, implicit_resolution_to_ambiguous_ref_and_cref_overload) { - auto revStrOverloadValRefNCrefOpt = cxx::mirror().getFunction(str_revStrOverloadValRefAndCRef); + auto revStrOverloadValRefNCrefOpt = cxx::mirror().getFunction(cxx::type::StrConst::fn::revStrOverloadRefAndCRef::id); ASSERT_TRUE(revStrOverloadValRefNCrefOpt); EXPECT_FALSE(revStrOverloadValRefNCrefOpt->hasSignature()); @@ -512,7 +513,7 @@ namespace rtl_tests TEST(ReturnErased_Function, explicit_resolution_to_ambiguous_ref_and_cref_overload) { - auto revStrOverloadValRefNCrefOpt = cxx::mirror().getFunction(str_revStrOverloadValRefAndCRef); + auto revStrOverloadValRefNCrefOpt = cxx::mirror().getFunction(cxx::type::StrConst::fn::revStrOverloadRefAndCRef::id); ASSERT_TRUE(revStrOverloadValRefNCrefOpt); EXPECT_FALSE(revStrOverloadValRefNCrefOpt->hasSignature()); diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Method.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Method.cpp index be7930f6..20cf969f 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Method.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Method.cpp @@ -55,13 +55,14 @@ namespace rtl_tests .argsT() .returnT<>(); EXPECT_FALSE(reverseString); + std::string str(STRA); { - auto [err, robj] = reverseString(StrMute())(const_cast(STRA)); + auto [err, robj] = reverseString(StrMute())(const_cast(str.c_str())); EXPECT_EQ(err, rtl::error::SignatureMismatch); EXPECT_TRUE(robj.isEmpty()); } { - auto [err, robj] = reverseString.bind(StrMute())(const_cast(STRA)); + auto [err, robj] = reverseString.bind(StrMute())(const_cast(str.c_str())); EXPECT_EQ(err, rtl::error::SignatureMismatch); EXPECT_TRUE(robj.isEmpty()); @@ -74,24 +75,24 @@ namespace rtl_tests .returnT<>(); EXPECT_TRUE(reverseString); { - auto [err, robj] = reverseString(StrMute())(STRA); + auto [err, robj] = reverseString(StrMute())(STRA.data()); EXPECT_EQ(err, rtl::error::None); ASSERT_FALSE(robj.isEmpty()); ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_const_char_ptr; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_const_char_ptr); EXPECT_EQ(retStr, expStr); } { - auto [err, robj] = reverseString.bind(StrMute())(STRA); + auto [err, robj] = reverseString.bind(StrMute())(STRA.data()); EXPECT_EQ(err, rtl::error::None); ASSERT_FALSE(robj.isEmpty()); ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_const_char_ptr; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_const_char_ptr); EXPECT_EQ(retStr, expStr); } } @@ -102,24 +103,24 @@ namespace rtl_tests .returnT<>(); EXPECT_TRUE(reverseString); { - auto [err, robj] = reverseString(StrMute())(STRA); + auto [err, robj] = reverseString(StrMute())(std::string(STRA)); EXPECT_EQ(err, rtl::error::None); ASSERT_FALSE(robj.isEmpty()); ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string); EXPECT_EQ(retStr, expStr); } { - auto [err, robj] = reverseString.bind(StrMute())(STRA); + auto [err, robj] = reverseString.bind(StrMute())(std::string(STRA)); EXPECT_EQ(err, rtl::error::None); ASSERT_FALSE(robj.isEmpty()); ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string); EXPECT_EQ(retStr, expStr); } } @@ -130,7 +131,7 @@ namespace rtl_tests .returnT<>(); EXPECT_TRUE(reverseString); { - std::string str = STRA; + std::string str(STRA); auto [err, robj] = reverseString(StrMute())(&str); EXPECT_EQ(err, rtl::error::None); @@ -138,10 +139,10 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_ptr; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_ptr); EXPECT_EQ(retStr, expStr); } { - std::string str = STRA; + std::string str(STRA); auto [err, robj] = reverseString.bind(StrMute())(&str); EXPECT_EQ(err, rtl::error::None); @@ -149,7 +150,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_ptr; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_ptr); EXPECT_EQ(retStr, expStr); } } @@ -160,7 +161,7 @@ namespace rtl_tests .returnT<>(); EXPECT_TRUE(reverseString); { - const std::string str = STRA; + const std::string str(STRA); auto [err, robj] = reverseString(StrMute())(&str); EXPECT_EQ(err, rtl::error::None); @@ -168,10 +169,10 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_cptr; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_cptr); EXPECT_EQ(retStr, expStr); } { - const std::string str = STRA; + const std::string str(STRA); auto [err, robj] = reverseString.bind(StrMute())(&str); EXPECT_EQ(err, rtl::error::None); @@ -179,7 +180,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_cptr; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_cptr); EXPECT_EQ(retStr, expStr); } } @@ -197,7 +198,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + REV_STR_VOID_RET + SUFFIX_void; + std::string expStr = std::string(StrMute::struct_).append(REV_STR_VOID_RET).append(SUFFIX_void); EXPECT_EQ(retStr, expStr); } { auto [err, robj] = reverseString.bind(StrMute())(); @@ -207,7 +208,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + REV_STR_VOID_RET + SUFFIX_void; + std::string expStr = std::string(StrMute::struct_).append(REV_STR_VOID_RET).append(SUFFIX_void); EXPECT_EQ(retStr, expStr); } } @@ -247,7 +248,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view); EXPECT_EQ(retStr, expStr); } { // explicit call by value resolution. @@ -258,7 +259,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view); EXPECT_EQ(retStr, expStr); } } @@ -296,7 +297,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_clvref; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(retStr, expStr); } { auto [err, robj] = reverseString.bind(target)(str); @@ -338,7 +339,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view); EXPECT_EQ(retStr, expStr); } { // explicit call by value resolution. @@ -348,7 +349,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view); EXPECT_EQ(retStr, expStr); } } @@ -386,7 +387,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_lvref; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref); EXPECT_EQ(retStr, expStr); } { auto [err, robj] = reverseString.bind(target)(str); @@ -438,7 +439,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_lvref; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref); EXPECT_EQ(retStr, expStr); } } @@ -475,7 +476,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_clvref; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(retStr, expStr); } { // explicit binding must also behave the same way. @@ -486,7 +487,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_clvref; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(retStr, expStr); } { // explicit binding to non-const ref returns error. @@ -530,7 +531,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_rvref; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_rvref); EXPECT_EQ(retStr, expStr); } } @@ -541,7 +542,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrOverloadValRefAndCRef); + std::optional reverseStrOpt = optStringUtil->getMethod(cxx::type::StrConst::fn::revStrOverloadRefAndCRef::id); ASSERT_TRUE(reverseStrOpt); EXPECT_FALSE(reverseStrOpt->hasSignature()); @@ -578,7 +579,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrOverloadValRefAndCRef); + std::optional reverseStrOpt = optStringUtil->getMethod(cxx::type::StrConst::fn::revStrOverloadRefAndCRef::id); ASSERT_TRUE(reverseStrOpt); EXPECT_FALSE(reverseStrOpt->hasSignature()); @@ -603,7 +604,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_lvref; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref); EXPECT_EQ(retStr, expStr); } { // Explicitly selecting the const ref overload. @@ -617,7 +618,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrMute::struct_) + STRA_REVERSE + SUFFIX_std_string_view_clvref; + std::string expStr = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(retStr, expStr); } } diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_StaticMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_StaticMethod.cpp index 94253959..afbc3106 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_StaticMethod.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_StaticMethod.cpp @@ -89,6 +89,7 @@ namespace rtl_tests std::optional reverseStrOpt = optStringUtil->getMethod(str_reverseString); ASSERT_TRUE(reverseStrOpt); EXPECT_FALSE(reverseStrOpt->hasSignature()); + auto str = std::string(STRA); { rtl::method reverseString = reverseStrOpt.value() .targetT() @@ -96,12 +97,13 @@ namespace rtl_tests .returnT<>(); EXPECT_FALSE(reverseString); { - auto [err, robj] = reverseString(StrStatic())(const_cast(STRA)); + + auto [err, robj] = reverseString(StrStatic())(const_cast(str.c_str())); EXPECT_EQ(err, rtl::error::SignatureMismatch); EXPECT_TRUE(robj.isEmpty()); } { - auto [err, robj] = reverseString.bind(StrStatic())(const_cast(STRA)); + auto [err, robj] = reverseString.bind(StrStatic())(const_cast(str.c_str())); EXPECT_EQ(err, rtl::error::SignatureMismatch); EXPECT_TRUE(robj.isEmpty()); @@ -115,7 +117,7 @@ namespace rtl_tests .returnT<>(); EXPECT_FALSE(reverseString); { - auto [err, robj] = reverseString(StrStatic())(STRA); + auto [err, robj] = reverseString(StrStatic())(STRA.data()); EXPECT_EQ(err, rtl::error::SignatureMismatch); } } { @@ -124,13 +126,16 @@ namespace rtl_tests .returnT<>(); EXPECT_TRUE(reverseString); { - auto [err, robj] = reverseString(STRA); + auto [err, robj] = reverseString(STRA.data()); EXPECT_EQ(err, rtl::error::None); ASSERT_FALSE(robj.isEmpty()); ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_const_char_ptr + SUFFIX_static; + + std::string expStr = std::string(StrStatic::struct_).append(STRA_REVERSE) + .append(SUFFIX_const_char_ptr) + .append(SUFFIX_static); EXPECT_EQ(retStr, expStr); } } @@ -141,24 +146,28 @@ namespace rtl_tests .returnT<>(); EXPECT_TRUE(reverseString); { - auto [err, robj] = reverseString(STRA); + auto [err, robj] = reverseString(STRA.data()); EXPECT_EQ(err, rtl::error::None); ASSERT_FALSE(robj.isEmpty()); ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string + SUFFIX_static; + std::string expStr = std::string(StrStatic::struct_).append(STRA_REVERSE) + .append(SUFFIX_std_string) + .append(SUFFIX_static); EXPECT_EQ(retStr, expStr); } { - auto [err, robj] = reverseString.bind()(STRA); + auto [err, robj] = reverseString.bind()(STRA.data()); EXPECT_EQ(err, rtl::error::None); ASSERT_FALSE(robj.isEmpty()); ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string + SUFFIX_static; + std::string expStr = std::string(StrStatic::struct_).append(STRA_REVERSE) + .append(SUFFIX_std_string) + .append(SUFFIX_static); EXPECT_EQ(retStr, expStr); } } @@ -169,7 +178,7 @@ namespace rtl_tests .returnT<>(); EXPECT_TRUE(reverseString); { - std::string str = STRA; + std::string str(STRA); auto [err, robj] = reverseString(&str); EXPECT_EQ(err, rtl::error::None); @@ -177,10 +186,10 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_ptr + SUFFIX_static; + std::string expStr = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_ptr).append(SUFFIX_static); EXPECT_EQ(retStr, expStr); } { - std::string str = STRA; + std::string str(STRA); auto [err, robj] = reverseString.bind()(&str); EXPECT_EQ(err, rtl::error::None); @@ -188,7 +197,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_ptr + SUFFIX_static; + std::string expStr = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_ptr).append(SUFFIX_static); EXPECT_EQ(retStr, expStr); } } @@ -199,7 +208,7 @@ namespace rtl_tests .returnT<>(); EXPECT_TRUE(reverseString); { - const std::string str = STRA; + const std::string str(STRA); auto [err, robj] = reverseString(&str); EXPECT_EQ(err, rtl::error::None); @@ -207,10 +216,10 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_cptr + SUFFIX_static; + std::string expStr = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_cptr).append(SUFFIX_static); EXPECT_EQ(retStr, expStr); } { - const std::string str = STRA; + const std::string str(STRA); auto [err, robj] = reverseString.bind()(&str); EXPECT_EQ(err, rtl::error::None); @@ -218,7 +227,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrStatic::struct_) + STRA_REVERSE + SUFFIX_std_string_cptr + SUFFIX_static; + std::string expStr = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_cptr).append(SUFFIX_static); EXPECT_EQ(retStr, expStr); } } @@ -236,7 +245,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrStatic::struct_) + REV_STR_VOID_RET + SUFFIX_void + SUFFIX_static; + std::string expStr = std::string(StrStatic::struct_).append(REV_STR_VOID_RET).append(SUFFIX_void).append(SUFFIX_static); EXPECT_EQ(retStr, expStr); } { auto [err, robj] = reverseString.bind()(); @@ -246,7 +255,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(StrStatic::struct_) + REV_STR_VOID_RET + SUFFIX_void + SUFFIX_static; + std::string expStr = std::string(StrStatic::struct_).append(REV_STR_VOID_RET).append(SUFFIX_void).append(SUFFIX_static); EXPECT_EQ(retStr, expStr); } } diff --git a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_strings.cpp b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_strings.cpp index 24387071..75f6cb77 100644 --- a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_strings.cpp +++ b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_strings.cpp @@ -7,7 +7,7 @@ using namespace rtl; namespace { static const std::string STR_STD_STRING = "string_type: std::string"; - static constexpr const char* STR_CONST_CHAR_POINTER = "string_type: const_char_*."; + inline constexpr std::string_view STR_CONST_CHAR_POINTER = "string_type: const_char_*."; static char STR_CHAR_ARRAY[] = "string_type: const_char_array."; static constexpr const char STR_CONST_CHAR_ARRAY[] = "string_type: const_char_array."; @@ -283,7 +283,7 @@ namespace unit_test TEST(RObject_view_as_std_string_and_string_view, init_with_constCharPtr) { // Create an RObject that reflects a string value (init with 'const char*'). - RObject robj = rtl::reflect(STR_CONST_CHAR_POINTER); + RObject robj = rtl::reflect(STR_CONST_CHAR_POINTER.data()); // Check if the value can be accessed as 'std::string'. ASSERT_FALSE(robj.canViewAs()); @@ -300,7 +300,7 @@ namespace unit_test // Validate the string content matches the original input. const char& str_addr = view->get(); - ASSERT_EQ(&str_addr, STR_CONST_CHAR_POINTER); + ASSERT_EQ(&str_addr, STR_CONST_CHAR_POINTER.data()); } From 68c8826cc6dc75b9edb49509c60ae6c07115bf77 Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Tue, 10 Feb 2026 12:12:07 +0530 Subject: [PATCH 10/16] integrating clang-mirror generated ids. --- CxxTestUtils/inc/TestUtilsAnimal.h | 6 -- .../CxxMirrorTests/CxxMirrorThreadingTest.cpp | 55 +++++++------------ .../ConstMethodOverloadTests.cpp | 4 +- .../PerfectForwardingTests.cpp | 36 ++++++------ 4 files changed, 39 insertions(+), 62 deletions(-) diff --git a/CxxTestUtils/inc/TestUtilsAnimal.h b/CxxTestUtils/inc/TestUtilsAnimal.h index 34182170..aefbd1f0 100644 --- a/CxxTestUtils/inc/TestUtilsAnimal.h +++ b/CxxTestUtils/inc/TestUtilsAnimal.h @@ -24,12 +24,6 @@ namespace test_utils static constexpr std::string_view FAMILY_NAME = "Great Ape"; static constexpr std::string_view ZOO_KEEPER = "Donald McAdams"; - static constexpr std::string_view class_ = "Animal"; - static constexpr std::string_view str_updateZooKeeper = "updateZooKeeper"; - static constexpr std::string_view str_setAnimalName = "setAnimalName"; - static constexpr std::string_view str_setFamilyName = "setFamilyName"; - static constexpr std::string_view str_getFamilyName = "getFamilyName"; - static const bool assert_zero_instance_count(); static const bool test_method_setAnimalName_rvalue_args(const rtl::RObject& pInstance); diff --git a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp index 2306e382..f3a2ad00 100644 --- a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp +++ b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp @@ -257,53 +257,36 @@ namespace rtl_tests { auto _ = rtl::CxxMirror({ - rtl::type().record(animal::class_).build(), + rtl::type().record(cxx::type::Animal::id).build(), rtl::type().member().constructor().build(), - rtl::type().member().method(animal::str_setFamilyName).build(&Animal::setFamilyName), + rtl::type().member().method(cxx::type::Animal::fn::setFamilyName::id).build(&Animal::setFamilyName), - rtl::type().member().methodConst(animal::str_getFamilyName).build(&Animal::getFamilyName), + rtl::type().member().methodConst(cxx::type::Animal::fn::getFamilyName::id).build(&Animal::getFamilyName), - rtl::type().member().method(animal::str_setAnimalName).build(&Animal::setAnimalName), + rtl::type().member().method(cxx::type::Animal::fn::setFamilyName::id).build(&Animal::setAnimalName), - rtl::type().member().methodStatic(animal::str_updateZooKeeper).build(&Animal::updateZooKeeper), + rtl::type().member().methodStatic(cxx::type::Animal::fn::updateZooKeeper::id).build(&Animal::updateZooKeeper), - #if defined(__GNUC__) && !defined(__clang__) - /* GCC fails to automatically identify the correct overloaded functor to pick. (non-const-lvalue-ref & rvalue as argument) - we need to explicitly cast the functor like, static_cast(&Animal::setAnimalName). - */ rtl::type().member() - .method(animal::str_setAnimalName) - .build(static_cast(&Animal::setAnimalName)), //overloaded method, taking non-const lvalue reference as argument. + /* GCC fails to automatically identify the correct overloaded functor to pick. (non-const-lvalue-ref & rvalue as argument) + we need to explicitly cast the functor like, static_cast(&Animal::setAnimalName). + */ rtl::type().member() + .method(cxx::type::Animal::fn::setFamilyName::id) + .build(static_cast(&Animal::setAnimalName)), //overloaded method, taking non-const lvalue reference as argument. - rtl::type().member() - .method(animal::str_setAnimalName) - .build(static_cast(&Animal::setAnimalName)), //overloaded method, taking rvalue reference as argument. + rtl::type().member() + .method(cxx::type::Animal::fn::setFamilyName::id) + .build(static_cast(&Animal::setAnimalName)), //overloaded method, taking rvalue reference as argument. - rtl::type().member() - .methodStatic(animal::str_updateZooKeeper) - .build(static_cast(&Animal::updateZooKeeper)), //static method, taking non-const lvalue reference as argument. + rtl::type().member() + .methodStatic(cxx::type::Animal::fn::updateZooKeeper::id) + .build(static_cast(&Animal::updateZooKeeper)), //static method, taking non-const lvalue reference as argument. - rtl::type().member() - .methodStatic(animal::str_updateZooKeeper) - .build(static_cast(&Animal::updateZooKeeper)), //static method, taking rvalue reference as argument. - #else - rtl::type().member() - .method(animal::str_setAnimalName) - .build(&Animal::setAnimalName), + rtl::type().member() + .methodStatic(cxx::type::Animal::fn::updateZooKeeper::id) + .build(static_cast(&Animal::updateZooKeeper)), //static method, taking rvalue reference as argument. - rtl::type().member() - .method(animal::str_setAnimalName) - .build(&Animal::setAnimalName), - - rtl::type().member() - .methodStatic(animal::str_updateZooKeeper) - .build(&Animal::updateZooKeeper), - - rtl::type().member() - .methodStatic(animal::str_updateZooKeeper) - .build(&Animal::updateZooKeeper) - #endif }); std::cout << "\n [t3]\trtl_tests::InitMirror::reflectingAnimal() ==> Done.\n"; diff --git a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp index 244ef93b..2e78b472 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp @@ -253,7 +253,7 @@ namespace rtl_tests { { // Retrieve the metadata for the "Animal" class. - optional classAnimal = cxx::mirror().getRecord(animal::class_); + optional classAnimal = cxx::mirror().getRecord(cxx::type::Animal::id); ASSERT_TRUE(classAnimal); // Create an instance of the "Animal" class. @@ -262,7 +262,7 @@ namespace rtl_tests ASSERT_FALSE(animal.isEmpty()); // Retrieve the "setAnimalName" method. - optional oSetAnimalName = classAnimal->getMethod(animal::str_setAnimalName); + optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setFamilyName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); diff --git a/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp b/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp index 990f961a..1dfaafe1 100644 --- a/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp @@ -41,7 +41,7 @@ namespace rtl_tests { { // Retrieve the metadata for the "Animal" class. - optional classAnimal = cxx::mirror().getRecord(animal::class_); + optional classAnimal = cxx::mirror().getRecord(cxx::type::Animal::id); ASSERT_TRUE(classAnimal); // Create an instance of the "Animal" class. @@ -50,7 +50,7 @@ namespace rtl_tests ASSERT_FALSE(animal.isEmpty()); // Retrieve the "setAnimalName" method. - optional oSetAnimalName = classAnimal->getMethod(animal::str_setAnimalName); + optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setFamilyName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for an R-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -83,7 +83,7 @@ namespace rtl_tests { { // Retrieve the metadata for the "Animal" class. - optional classAnimal = cxx::mirror().getRecord(animal::class_); + optional classAnimal = cxx::mirror().getRecord(cxx::type::Animal::id); ASSERT_TRUE(classAnimal); // Create an instance of the "Animal" class. @@ -92,7 +92,7 @@ namespace rtl_tests ASSERT_FALSE(animal.isEmpty()); // Retrieve the "setAnimalName" method. - optional oSetAnimalName = classAnimal->getMethod(animal::str_setAnimalName); + optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setFamilyName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a non-const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -126,7 +126,7 @@ namespace rtl_tests { { // Retrieve the metadata for the "Animal" class. - optional classAnimal = cxx::mirror().getRecord(animal::class_); + optional classAnimal = cxx::mirror().getRecord(cxx::type::Animal::id); ASSERT_TRUE(classAnimal); // Create an instance of the "Animal" class. @@ -135,7 +135,7 @@ namespace rtl_tests ASSERT_FALSE(animal.isEmpty()); // Retrieve the "setAnimalName" method. - optional oSetAnimalName = classAnimal->getMethod(animal::str_setAnimalName); + optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setFamilyName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -170,7 +170,7 @@ namespace rtl_tests { { // Retrieve the metadata for the "Animal" class. - optional classAnimal = cxx::mirror().getRecord(animal::class_); + optional classAnimal = cxx::mirror().getRecord(cxx::type::Animal::id); ASSERT_TRUE(classAnimal); // Create an instance of the "Animal" class. @@ -179,7 +179,7 @@ namespace rtl_tests ASSERT_FALSE(animal.isEmpty()); // Retrieve the "setAnimalName" method. - optional oSetAnimalName = classAnimal->getMethod(animal::str_setAnimalName); + optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setFamilyName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for an R-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -212,7 +212,7 @@ namespace rtl_tests { { // Retrieve the metadata for the "Animal" class. - optional classAnimal = cxx::mirror().getRecord(animal::class_); + optional classAnimal = cxx::mirror().getRecord(cxx::type::Animal::id); ASSERT_TRUE(classAnimal); // Create an instance of the "Animal" class. @@ -221,7 +221,7 @@ namespace rtl_tests ASSERT_FALSE(animal.isEmpty()); // Retrieve the "setAnimalName" method. - optional oSetAnimalName = classAnimal->getMethod(animal::str_setAnimalName); + optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setFamilyName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a non-const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -254,7 +254,7 @@ namespace rtl_tests { { // Retrieve the metadata for the "Animal" class. - optional classAnimal = cxx::mirror().getRecord(animal::class_); + optional classAnimal = cxx::mirror().getRecord(cxx::type::Animal::id); ASSERT_TRUE(classAnimal); // Create an instance of the "Animal" class. @@ -263,7 +263,7 @@ namespace rtl_tests ASSERT_FALSE(animal.isEmpty()); // Retrieve the "setAnimalName" method. - optional oSetAnimalName = classAnimal->getMethod(animal::str_setAnimalName); + optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setFamilyName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -290,10 +290,10 @@ namespace rtl_tests TEST(PerfectForwardingTest, static_fn_overload_resolution_with_rvalue_ref) { { - optional classAnimal = cxx::mirror().getRecord(animal::class_); + optional classAnimal = cxx::mirror().getRecord(cxx::type::Animal::id); ASSERT_TRUE(classAnimal); - optional oUpdateZooKeeper = classAnimal->getMethod(animal::str_updateZooKeeper); + optional oUpdateZooKeeper = classAnimal->getMethod(cxx::type::Animal::fn::updateZooKeeper::id); ASSERT_TRUE(oUpdateZooKeeper); const auto& isValid = oUpdateZooKeeper->hasSignature(); @@ -324,10 +324,10 @@ namespace rtl_tests TEST(PerfectForwardingTest, static_fn_overload_resolution_with_const_lvalue_ref) { { - optional classAnimal = cxx::mirror().getRecord(animal::class_); + optional classAnimal = cxx::mirror().getRecord(cxx::type::Animal::id); ASSERT_TRUE(classAnimal); - optional oUpdateZooKeeper = classAnimal->getMethod(animal::str_updateZooKeeper); + optional oUpdateZooKeeper = classAnimal->getMethod(cxx::type::Animal::fn::updateZooKeeper::id); ASSERT_TRUE(oUpdateZooKeeper); const auto& isValid = oUpdateZooKeeper->hasSignature(); @@ -354,10 +354,10 @@ namespace rtl_tests TEST(PerfectForwardingTest, static_fn_overload_resolution_with_non_const_lvalue_ref) { { - optional classAnimal = cxx::mirror().getRecord(animal::class_); + optional classAnimal = cxx::mirror().getRecord(cxx::type::Animal::id); ASSERT_TRUE(classAnimal); - optional oUpdateZooKeeper = classAnimal->getMethod(animal::str_updateZooKeeper); + optional oUpdateZooKeeper = classAnimal->getMethod(cxx::type::Animal::fn::updateZooKeeper::id); ASSERT_TRUE(oUpdateZooKeeper); const auto& isValid = oUpdateZooKeeper->hasSignature(); From 849ad1b5cf3bf4d5d42dd8b59afc7bdcc6c5d9d4 Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Tue, 10 Feb 2026 12:20:49 +0530 Subject: [PATCH 11/16] integrating clang-mirror generated ids. --- CxxTestUtils/inc/TestUtilsBook.h | 4 ---- .../src/CxxMirrorTests/CxxMirrorThreadingTest.cpp | 12 ++++++------ .../FunctionalityTests/ConstMethodOverloadTests.cpp | 2 +- .../FunctionalityTests/PerfectForwardingTests.cpp | 12 ++++++------ .../ReflectionOpErrorCodeTests.cpp | 2 +- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/CxxTestUtils/inc/TestUtilsBook.h b/CxxTestUtils/inc/TestUtilsBook.h index 95417343..e7aebc69 100644 --- a/CxxTestUtils/inc/TestUtilsBook.h +++ b/CxxTestUtils/inc/TestUtilsBook.h @@ -16,10 +16,6 @@ namespace test_utils { struct library { - static constexpr std::string_view class_ = "Library"; - static constexpr std::string_view str_addBook = "addBook"; - static constexpr std::string_view str_getBookByTitle = "getBookByTitle"; - static const bool assert_zero_instance_count(); }; diff --git a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp index f3a2ad00..e9f800d9 100644 --- a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp +++ b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp @@ -45,11 +45,11 @@ namespace rtl_tests { auto _ = rtl::CxxMirror({ - rtl::type().record(library::class_).build(), + rtl::type().record(cxx::type::Library::id).build(), - rtl::type().member().methodStatic(library::str_addBook).build(&Library::addBook), + rtl::type().member().methodStatic(cxx::type::Library::fn::addBook::id).build(&Library::addBook), - rtl::type().member().methodStatic(library::str_getBookByTitle).build(&Library::getBookByTitle) + rtl::type().member().methodStatic(cxx::type::Library::fn::getBookByTitle::id).build(&Library::getBookByTitle) }); std::cout << "\n [t5]\trtl_tests::InitMirror::reflectingLibrary() ==> Done.\n"; @@ -265,18 +265,18 @@ namespace rtl_tests rtl::type().member().methodConst(cxx::type::Animal::fn::getFamilyName::id).build(&Animal::getFamilyName), - rtl::type().member().method(cxx::type::Animal::fn::setFamilyName::id).build(&Animal::setAnimalName), + rtl::type().member().method(cxx::type::Animal::fn::setAnimalName::id).build(&Animal::setAnimalName), rtl::type().member().methodStatic(cxx::type::Animal::fn::updateZooKeeper::id).build(&Animal::updateZooKeeper), /* GCC fails to automatically identify the correct overloaded functor to pick. (non-const-lvalue-ref & rvalue as argument) we need to explicitly cast the functor like, static_cast(&Animal::setAnimalName). */ rtl::type().member() - .method(cxx::type::Animal::fn::setFamilyName::id) + .method(cxx::type::Animal::fn::setAnimalName::id) .build(static_cast(&Animal::setAnimalName)), //overloaded method, taking non-const lvalue reference as argument. rtl::type().member() - .method(cxx::type::Animal::fn::setFamilyName::id) + .method(cxx::type::Animal::fn::setAnimalName::id) .build(static_cast(&Animal::setAnimalName)), //overloaded method, taking rvalue reference as argument. rtl::type().member() diff --git a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp index 2e78b472..e3e9152d 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp @@ -262,7 +262,7 @@ namespace rtl_tests ASSERT_FALSE(animal.isEmpty()); // Retrieve the "setAnimalName" method. - optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setFamilyName::id); + optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setAnimalName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); diff --git a/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp b/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp index 1dfaafe1..a502b27a 100644 --- a/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp @@ -50,7 +50,7 @@ namespace rtl_tests ASSERT_FALSE(animal.isEmpty()); // Retrieve the "setAnimalName" method. - optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setFamilyName::id); + optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setAnimalName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for an R-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -92,7 +92,7 @@ namespace rtl_tests ASSERT_FALSE(animal.isEmpty()); // Retrieve the "setAnimalName" method. - optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setFamilyName::id); + optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setAnimalName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a non-const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -135,7 +135,7 @@ namespace rtl_tests ASSERT_FALSE(animal.isEmpty()); // Retrieve the "setAnimalName" method. - optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setFamilyName::id); + optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setAnimalName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -179,7 +179,7 @@ namespace rtl_tests ASSERT_FALSE(animal.isEmpty()); // Retrieve the "setAnimalName" method. - optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setFamilyName::id); + optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setAnimalName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for an R-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -221,7 +221,7 @@ namespace rtl_tests ASSERT_FALSE(animal.isEmpty()); // Retrieve the "setAnimalName" method. - optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setFamilyName::id); + optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setAnimalName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a non-const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -263,7 +263,7 @@ namespace rtl_tests ASSERT_FALSE(animal.isEmpty()); // Retrieve the "setAnimalName" method. - optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setFamilyName::id); + optional oSetAnimalName = classAnimal->getMethod(cxx::type::Animal::fn::setAnimalName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); diff --git a/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp index afa5adf3..303ee262 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp @@ -234,7 +234,7 @@ namespace rtl_tests { { // Fetch the reflected Record for class 'Library'. - optional classLibrary = cxx::mirror().getRecord(library::class_); + optional classLibrary = cxx::mirror().getRecord(cxx::type::Library::id); ASSERT_TRUE(classLibrary); { // Attempt to create a reflected instance allocated on the heap. From c6ffa14ac7f462553fe38cc0334f57f189868a3a Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Tue, 10 Feb 2026 12:26:24 +0530 Subject: [PATCH 12/16] integrating clang-mirror generated ids. --- CxxTestUtils/inc/TestUtilsDate.h | 4 ---- RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp | 4 ++-- RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp | 4 ++-- .../src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp | 2 +- .../src/FunctionalityTests/ReturnValueReflectionTest.cpp | 4 ++-- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/CxxTestUtils/inc/TestUtilsDate.h b/CxxTestUtils/inc/TestUtilsDate.h index 540b1a9e..504f0753 100644 --- a/CxxTestUtils/inc/TestUtilsDate.h +++ b/CxxTestUtils/inc/TestUtilsDate.h @@ -15,10 +15,6 @@ namespace test_utils { struct event { - static constexpr std::string_view struct_ = "nsdate::Event"; - static constexpr std::string_view str_getDate = "getDate"; - static constexpr std::string_view str_reset = "reset"; - static const bool assert_zero_instance_count(); static const std::size_t get_instance_count(); }; diff --git a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp index e9f800d9..1e7d164a 100644 --- a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp +++ b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp @@ -32,9 +32,9 @@ namespace rtl_tests { auto _ = rtl::CxxMirror({ - rtl::type().record(event::struct_).build(), + rtl::type().record(cxx::type::nsdate::Event::id).build(), - rtl::type().member().method(event::str_reset).build(&nsdate::Event::reset), + rtl::type().member().method(cxx::type::nsdate::Event::fn::reset::id).build(&nsdate::Event::reset), }); std::cout << "\n [t2]\trtl_tests::InitMirror::reflectingEvent() ==> Done.\n"; diff --git a/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp index fe297e40..673a6f1a 100644 --- a/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp @@ -157,10 +157,10 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(event0.isEmpty()); - optional classEvent = cxx::mirror().getRecord(event::struct_); + optional classEvent = cxx::mirror().getRecord(cxx::type::nsdate::Event::id); ASSERT_TRUE(classEvent); - optional oEventReset = classEvent->getMethod(event::str_reset); + optional oEventReset = classEvent->getMethod(cxx::type::nsdate::Event::fn::reset::id); ASSERT_TRUE(oEventReset); method eventReset = oEventReset->targetT().argsT().returnT(); diff --git a/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp index 303ee262..c4cc64a5 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp @@ -76,7 +76,7 @@ namespace rtl_tests TEST(ReflectionOpErrorCodeTests, error_TypeNotDefaultConstructible) { - optional classEvent = cxx::mirror().getRecord(event::struct_); + optional classEvent = cxx::mirror().getRecord(cxx::type::nsdate::Event::id); ASSERT_TRUE(classEvent); auto [err0, robj0] = classEvent->ctorT()(alloc::Stack); diff --git a/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp b/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp index 4b37043a..dbc7f1dc 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp @@ -13,7 +13,7 @@ namespace rtl_tests TEST(ReflecetdReturnValues, on_registered_return_type__test_cloning) { //I don't know if the 'Event' is class or struct..Reflection YaY!. :P - auto classEvent = cxx::mirror().getRecord(cxx::reflected_id(event::struct_)); + auto classEvent = cxx::mirror().getRecord(cxx::reflected_id(cxx::type::nsdate::Event::id)); ASSERT_TRUE(classEvent); auto [err0, robj0] = classEvent->ctorT()(rtl::alloc::Stack); @@ -46,7 +46,7 @@ namespace rtl_tests EXPECT_TRUE(err2 == rtl::error::None); ASSERT_FALSE(event.isEmpty()); - EXPECT_TRUE(event.getTypeId() == cxx::reflected_id(event::struct_)); + EXPECT_TRUE(event.getTypeId() == cxx::reflected_id(cxx::type::nsdate::Event::id)); { auto [err, robj] = event.clone(); //Event's copy-constructor private or deleted. From e0576533151d9df49cb73b3aea29739fe419790e Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Tue, 10 Feb 2026 12:36:50 +0530 Subject: [PATCH 13/16] integrating clang-mirror generated ids. --- CxxTestUtils/inc/TestUtilsPerson.h | 9 ---- .../CxxMirrorTests/CxxMirrorThreadingTest.cpp | 42 +++++++++---------- .../ConstMethodOverloadTests.cpp | 24 +++++------ .../ReflectionOpErrorCodeTests.cpp | 8 ++-- .../FunctionalityTests/StaticMethodTests.cpp | 24 +++++------ 5 files changed, 49 insertions(+), 58 deletions(-) diff --git a/CxxTestUtils/inc/TestUtilsPerson.h b/CxxTestUtils/inc/TestUtilsPerson.h index b0225d9b..5c029bde 100644 --- a/CxxTestUtils/inc/TestUtilsPerson.h +++ b/CxxTestUtils/inc/TestUtilsPerson.h @@ -22,15 +22,6 @@ namespace test_utils static constexpr std::string_view ADDRESS = "221B Baker Street."; static constexpr std::string_view OCCUPATION = "Private Detective."; - static constexpr std::string_view class_ = "Person"; - static constexpr std::string_view str_createPtr = "createPtr"; - static constexpr std::string_view str_getProfile = "getProfile"; - static constexpr std::string_view str_createConst = "createConst"; - static constexpr std::string_view str_getDefaults = "getDefaults"; - static constexpr std::string_view str_getFirstName = "getFirstName"; - static constexpr std::string_view str_updateAddress = "updateAddress"; - static constexpr std::string_view str_updateLastName = "updateLastName"; - static const bool assert_zero_instance_count(); static const std::string get_str_returned_on_call_getDefaults(); diff --git a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp index 1e7d164a..e51a9b09 100644 --- a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp +++ b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp @@ -220,33 +220,33 @@ namespace rtl_tests { auto _ = rtl::CxxMirror({ - rtl::type().record(person::class_).build(), + rtl::type().record(cxx::type::Person::id).build(), rtl::type().member().constructor().build(), - rtl::type().member().methodStatic(person::str_createPtr).build(&Person::createPtr), + rtl::type().member().methodStatic(cxx::type::Person::fn::createPtr::id).build(&Person::createPtr), - rtl::type().member().method(person::str_updateAddress).build(&Person::updateAddress), + rtl::type().member().method(cxx::type::Person::fn::updateAddress::id).build(&Person::updateAddress), - rtl::type().member().method(person::str_updateAddress).build(&Person::updateAddress), + rtl::type().member().method(cxx::type::Person::fn::updateAddress::id).build(&Person::updateAddress), - rtl::type().member().method(person::str_getFirstName).build(&Person::getFirstName), + rtl::type().member().method(cxx::type::Person::fn::getFirstName::id).build(&Person::getFirstName), - rtl::type().member().methodConst(person::str_updateLastName).build(&Person::updateLastName), + rtl::type().member().methodConst(cxx::type::Person::fn::updateLastName::id).build(&Person::updateLastName), - rtl::type().member().methodConst(person::str_updateAddress).build(&Person::updateAddress), + rtl::type().member().methodConst(cxx::type::Person::fn::updateAddress::id).build(&Person::updateAddress), - rtl::type().member().methodConst(person::str_updateAddress).build(&Person::updateAddress), + rtl::type().member().methodConst(cxx::type::Person::fn::updateAddress::id).build(&Person::updateAddress), - rtl::type().member().methodStatic(person::str_getDefaults).build(&Person::getDefaults), + rtl::type().member().methodStatic(cxx::type::Person::fn::getDefaults::id).build(&Person::getDefaults), - rtl::type().member().methodStatic(person::str_createConst).build(&Person::createConst), + rtl::type().member().methodStatic(cxx::type::Person::fn::createConst::id).build(&Person::createConst), - rtl::type().member().methodStatic(person::str_getProfile).build(&Person::getProfile), + rtl::type().member().methodStatic(cxx::type::Person::fn::getProfile::id).build(&Person::getProfile), - rtl::type().member().methodStatic(person::str_getProfile).build(&Person::getProfile), + rtl::type().member().methodStatic(cxx::type::Person::fn::getProfile::id).build(&Person::getProfile), - rtl::type().member().methodStatic(person::str_getProfile).build(&Person::getProfile) + rtl::type().member().methodStatic(cxx::type::Person::fn::getProfile::id).build(&Person::getProfile) }); std::cout << "\n [t4]\trtl_tests::InitMirror::reflectingPerson() ==> Done.\n"; @@ -272,20 +272,20 @@ namespace rtl_tests /* GCC fails to automatically identify the correct overloaded functor to pick. (non-const-lvalue-ref & rvalue as argument) we need to explicitly cast the functor like, static_cast(&Animal::setAnimalName). */ rtl::type().member() - .method(cxx::type::Animal::fn::setAnimalName::id) - .build(static_cast(&Animal::setAnimalName)), //overloaded method, taking non-const lvalue reference as argument. + .method(cxx::type::Animal::fn::setAnimalName::id) + .build(static_cast(&Animal::setAnimalName)), //overloaded method, taking non-const lvalue reference as argument. rtl::type().member() - .method(cxx::type::Animal::fn::setAnimalName::id) - .build(static_cast(&Animal::setAnimalName)), //overloaded method, taking rvalue reference as argument. + .method(cxx::type::Animal::fn::setAnimalName::id) + .build(static_cast(&Animal::setAnimalName)), //overloaded method, taking rvalue reference as argument. rtl::type().member() - .methodStatic(cxx::type::Animal::fn::updateZooKeeper::id) - .build(static_cast(&Animal::updateZooKeeper)), //static method, taking non-const lvalue reference as argument. + .methodStatic(cxx::type::Animal::fn::updateZooKeeper::id) + .build(static_cast(&Animal::updateZooKeeper)), //static method, taking non-const lvalue reference as argument. rtl::type().member() - .methodStatic(cxx::type::Animal::fn::updateZooKeeper::id) - .build(static_cast(&Animal::updateZooKeeper)), //static method, taking rvalue reference as argument. + .methodStatic(cxx::type::Animal::fn::updateZooKeeper::id) + .build(static_cast(&Animal::updateZooKeeper)), //static method, taking rvalue reference as argument. }); diff --git a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp index e3e9152d..656979b4 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp @@ -25,10 +25,10 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional classPerson = cxx::mirror().getRecord(person::class_); + optional classPerson = cxx::mirror().getRecord(cxx::type::Person::id); ASSERT_TRUE(classPerson); - optional oUpdateLastName = classPerson->getMethod(person::str_updateLastName); + optional oUpdateLastName = classPerson->getMethod(cxx::type::Person::fn::updateLastName::id); ASSERT_TRUE(oUpdateLastName); EXPECT_TRUE(oUpdateLastName->hasSignature()); @@ -85,10 +85,10 @@ namespace rtl_tests { auto testWithAllocOn = [](alloc alloc)->void { - optional classPerson = cxx::mirror().getRecord(person::class_); + optional classPerson = cxx::mirror().getRecord(cxx::type::Person::id); ASSERT_TRUE(classPerson); - optional oUpdateLastName = classPerson->getMethod(person::str_updateLastName); + optional oUpdateLastName = classPerson->getMethod(cxx::type::Person::fn::updateLastName::id); ASSERT_TRUE(oUpdateLastName); auto [err0, person] = classPerson->ctorT()(alloc, person::FIRST_NAME.data()); @@ -128,14 +128,14 @@ namespace rtl_tests { auto testWithAllocOn = [](alloc alloc)->void { - optional classPerson = cxx::mirror().getRecord(person::class_); + optional classPerson = cxx::mirror().getRecord(cxx::type::Person::id); ASSERT_TRUE(classPerson); auto [err0, person] = classPerson->ctorT()(alloc, person::FIRST_NAME.data()); EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(person.isEmpty()); - optional oUpdateAddress = classPerson->getMethod(person::str_updateAddress); + optional oUpdateAddress = classPerson->getMethod(cxx::type::Person::fn::updateAddress::id); ASSERT_TRUE(oUpdateAddress); EXPECT_TRUE(oUpdateAddress->hasSignature()); @@ -167,10 +167,10 @@ namespace rtl_tests TEST(ConstMethodOverload, explicit_method_resolution__only_non_const_method_exists__call_on_returned_const_target) { { - optional classPerson = cxx::mirror().getRecord(person::class_); + optional classPerson = cxx::mirror().getRecord(cxx::type::Person::id); ASSERT_TRUE(classPerson); - optional createConstPerson = classPerson->getMethod(person::str_createConst); + optional createConstPerson = classPerson->getMethod(cxx::type::Person::fn::createConst::id); ASSERT_TRUE(createConstPerson); static_method createPerson = createConstPerson->argsT().returnT(); @@ -181,7 +181,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(constPerson.isEmpty()); - optional oGetFirstName = classPerson->getMethod(person::str_getFirstName); + optional oGetFirstName = classPerson->getMethod(cxx::type::Person::fn::getFirstName::id); ASSERT_TRUE(oGetFirstName); EXPECT_TRUE(oGetFirstName->hasSignature<>()); @@ -209,10 +209,10 @@ namespace rtl_tests TEST(ConstMethodOverload, explicit_method_resolution__only_non_const_method_exists__call_on_returned_const_pointer_target) { { - optional classPerson = cxx::mirror().getRecord(person::class_); + optional classPerson = cxx::mirror().getRecord(cxx::type::Person::id); ASSERT_TRUE(classPerson); - optional createConstPtrPerson = classPerson->getMethod(person::str_createPtr); + optional createConstPtrPerson = classPerson->getMethod(cxx::type::Person::fn::createPtr::id); ASSERT_TRUE(createConstPtrPerson); static_method createPerson = createConstPtrPerson->argsT().returnT(); @@ -224,7 +224,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(constPersonPtr.isEmpty()); - optional oGetFirstName = classPerson->getMethod(person::str_getFirstName); + optional oGetFirstName = classPerson->getMethod(cxx::type::Person::fn::getFirstName::id); ASSERT_TRUE(oGetFirstName); EXPECT_TRUE(oGetFirstName->hasSignature<>()); diff --git a/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp index c4cc64a5..99ea8e42 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp @@ -264,10 +264,10 @@ namespace rtl_tests TEST(ReflectionOpErrorCodeTests, static_method_call__error_SignatureMismatch) { - optional classPerson = cxx::mirror().getRecord(person::class_); + optional classPerson = cxx::mirror().getRecord(cxx::type::Person::id); ASSERT_TRUE(classPerson); - optional optGetProfile = classPerson->getMethod(person::str_getProfile); + optional optGetProfile = classPerson->getMethod(cxx::type::Person::fn::getProfile::id); ASSERT_TRUE(optGetProfile); EXPECT_TRUE(optGetProfile->hasSignature<>()); //empty template params checks for zero arguments. @@ -303,7 +303,7 @@ namespace rtl_tests TEST(ReflectionOpErrorCodeTests, method_call_using_heap_object__error_TargetMismatch) { { - optional classPerson = cxx::mirror().getRecord(person::class_); + optional classPerson = cxx::mirror().getRecord(cxx::type::Person::id); ASSERT_TRUE(classPerson); optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); @@ -331,7 +331,7 @@ namespace rtl_tests TEST(ReflectionOpErrorCodeTests, method_call_using_stack_object__error_TargetMismatch) { { - optional classPerson = cxx::mirror().getRecord(person::class_); + optional classPerson = cxx::mirror().getRecord(cxx::type::Person::id); ASSERT_TRUE(classPerson); optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); diff --git a/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp b/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp index 43c47ca0..7cc62c76 100644 --- a/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp @@ -15,10 +15,10 @@ namespace rtl_tests { TEST(StaticMethods, unique_method_call) { - optional classPerson = cxx::mirror().getRecord(person::class_); + optional classPerson = cxx::mirror().getRecord(cxx::type::Person::id); ASSERT_TRUE(classPerson); - optional optGetDefaults = classPerson->getMethod(person::str_getDefaults); + optional optGetDefaults = classPerson->getMethod(cxx::type::Person::fn::getDefaults::id); ASSERT_TRUE(optGetDefaults); EXPECT_TRUE(optGetDefaults->hasSignature<>()); //empty template params checks for zero arguments. @@ -38,10 +38,10 @@ namespace rtl_tests TEST(StaticMethods, overload_method_void_call) { - optional classPerson = cxx::mirror().getRecord(person::class_); + optional classPerson = cxx::mirror().getRecord(cxx::type::Person::id); ASSERT_TRUE(classPerson); - optional optGetProfile = classPerson->getMethod(person::str_getProfile); + optional optGetProfile = classPerson->getMethod(cxx::type::Person::fn::getProfile::id); ASSERT_TRUE(optGetProfile); EXPECT_TRUE(optGetProfile->hasSignature<>()); //empty template params checks for zero arguments. @@ -61,10 +61,10 @@ namespace rtl_tests TEST(StaticMethods, overload_method_args_bool_call) { - optional classPerson = cxx::mirror().getRecord(person::class_); + optional classPerson = cxx::mirror().getRecord(cxx::type::Person::id); ASSERT_TRUE(classPerson); - optional optGetProfile = classPerson->getMethod(person::str_getProfile); + optional optGetProfile = classPerson->getMethod(cxx::type::Person::fn::getProfile::id); ASSERT_TRUE(optGetProfile); EXPECT_TRUE(optGetProfile->hasSignature()); @@ -95,11 +95,11 @@ namespace rtl_tests TEST(StaticMethods, overload_method_args_string_size_t_call) { - optional recOpt = cxx::mirror().getRecord(person::class_); + optional recOpt = cxx::mirror().getRecord(cxx::type::Person::id); ASSERT_TRUE(recOpt.has_value()); const Record& classPerson = recOpt.value(); - optional methOpt = classPerson.getMethod(person::str_getProfile); + optional methOpt = classPerson.getMethod(cxx::type::Person::fn::getProfile::id); ASSERT_TRUE(methOpt.has_value()); const Method& optGetProfile = methOpt.value(); @@ -124,10 +124,10 @@ namespace rtl_tests TEST(StaticMethods, static_method_call_on_target_instance) { - optional classPerson = cxx::mirror().getRecord(person::class_); + optional classPerson = cxx::mirror().getRecord(cxx::type::Person::id); ASSERT_TRUE(classPerson); - optional getDefaultsOpt = classPerson->getMethod(person::str_getDefaults); + optional getDefaultsOpt = classPerson->getMethod(cxx::type::Person::fn::getDefaults::id); ASSERT_TRUE(getDefaultsOpt); EXPECT_TRUE(getDefaultsOpt->hasSignature<>()); //empty template params checks for zero arguments. { @@ -162,10 +162,10 @@ namespace rtl_tests TEST(StaticMethods, static_method_call_on_target_instance_with_args) { - optional classPerson = cxx::mirror().getRecord(person::class_); + optional classPerson = cxx::mirror().getRecord(cxx::type::Person::id); ASSERT_TRUE(classPerson); - optional getProfileOpt = classPerson->getMethod(person::str_getProfile); + optional getProfileOpt = classPerson->getMethod(cxx::type::Person::fn::getProfile::id); ASSERT_TRUE(getProfileOpt); EXPECT_TRUE((getProfileOpt->hasSignature())); From b7b60a28df26040760a146a1daecefa15e127730 Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Tue, 10 Feb 2026 13:05:21 +0530 Subject: [PATCH 14/16] refactoring --- CxxTestProps/inc/StringConst.h | 2 +- CxxTestProps/inc/StringConstOverload.h | 2 +- CxxTestProps/inc/StringMute.h | 2 +- CxxTestProps/inc/StringStatic.h | 2 +- CxxTestProps/inc/StringWrap.h | 8 ++-- CxxTestProps/src/StringConst.cpp | 34 +++++++------- CxxTestProps/src/StringConstOverload.cpp | 4 +- CxxTestProps/src/StringMute.cpp | 34 +++++++------- CxxTestProps/src/StringOps.cpp | 34 +++++++------- CxxTestProps/src/StringStatic.cpp | 34 +++++++------- CxxTestProps/src/StringWrap.cpp | 20 ++++----- CxxTestUtils/inc/GlobalTestUtils.h | 32 +++++++------- .../NameSpaceGlobalsTests.cpp | 6 +-- .../ReturnAndTargetErased_ConstMethod.cpp | 6 +-- .../ReturnErased_Constructor.cpp | 24 ++++------ .../ReturnErased_Function.cpp | 44 +++++++++---------- 16 files changed, 140 insertions(+), 148 deletions(-) diff --git a/CxxTestProps/inc/StringConst.h b/CxxTestProps/inc/StringConst.h index ab038ede..181244cd 100644 --- a/CxxTestProps/inc/StringConst.h +++ b/CxxTestProps/inc/StringConst.h @@ -5,7 +5,7 @@ // 'StrConst' - String-Const, all methods are const. struct StrConst { - constexpr static const char* struct_ = "StrConst"; + constexpr static std::string_view struct_ = "StrConst"; std::string reverseString() const; diff --git a/CxxTestProps/inc/StringConstOverload.h b/CxxTestProps/inc/StringConstOverload.h index fdb844f8..13f70f4f 100644 --- a/CxxTestProps/inc/StringConstOverload.h +++ b/CxxTestProps/inc/StringConstOverload.h @@ -4,7 +4,7 @@ struct StrConstOverload { - constexpr static const char* struct_ = "StrConstOverload"; + constexpr static std::string_view struct_ = "StrConstOverload"; std::string reverseString(); diff --git a/CxxTestProps/inc/StringMute.h b/CxxTestProps/inc/StringMute.h index 4b71c00d..7fd9f54f 100644 --- a/CxxTestProps/inc/StringMute.h +++ b/CxxTestProps/inc/StringMute.h @@ -5,7 +5,7 @@ // 'StrMute' - String-Mutable, all methods are non-const. struct StrMute { - constexpr static const char* struct_ = "StrMute"; + constexpr static std::string_view struct_ = "StrMute"; std::string reverseString(); diff --git a/CxxTestProps/inc/StringStatic.h b/CxxTestProps/inc/StringStatic.h index 88bfece5..c487e192 100644 --- a/CxxTestProps/inc/StringStatic.h +++ b/CxxTestProps/inc/StringStatic.h @@ -5,7 +5,7 @@ // 'StrStatic' - String-Static, all methods are static. struct StrStatic { - constexpr static const char* struct_ = "StrStatic"; + constexpr static std::string_view struct_ = "StrStatic"; static std::string reverseString(); diff --git a/CxxTestProps/inc/StringWrap.h b/CxxTestProps/inc/StringWrap.h index 443295c6..1a2a6d45 100644 --- a/CxxTestProps/inc/StringWrap.h +++ b/CxxTestProps/inc/StringWrap.h @@ -13,7 +13,7 @@ struct StrWrap // 'StrWrapA' - String-Wrapper, only constructors for testing. struct StrWrapA : public StrWrap { - constexpr static const char* struct_ = "StrWrapA"; + constexpr static std::string_view struct_ = "StrWrapA"; StrWrapA(); @@ -32,7 +32,7 @@ struct StrWrapA : public StrWrap // 'StrWrapB' - String-Wrapper, only constructors for testing. struct StrWrapB : public StrWrap { - constexpr static const char* struct_ = "StrWrapB"; + constexpr static std::string_view struct_ = "StrWrapB"; StrWrapB(std::string& pStr); StrWrapB(const std::string& pStr); }; @@ -41,7 +41,7 @@ struct StrWrapB : public StrWrap // 'StrWrapC' - String-Wrapper, only constructors for testing. struct StrWrapC : public StrWrap { - constexpr static const char* struct_ = "StrWrapC"; + constexpr static std::string_view struct_ = "StrWrapC"; StrWrapC(std::string& pStr); }; @@ -49,6 +49,6 @@ struct StrWrapC : public StrWrap // 'StrWrapD' - String-Wrapper, only constructors for testing. struct StrWrapD : public StrWrap { - constexpr static const char* struct_ = "StrWrapD"; + constexpr static std::string_view struct_ = "StrWrapD"; StrWrapD(const std::string& pStr); }; \ No newline at end of file diff --git a/CxxTestProps/src/StringConst.cpp b/CxxTestProps/src/StringConst.cpp index 666a1475..099bb92b 100644 --- a/CxxTestProps/src/StringConst.cpp +++ b/CxxTestProps/src/StringConst.cpp @@ -10,7 +10,7 @@ using namespace test_utils; std::string StrConst::reverseString() const { - return std::string(struct_) + REV_STR_VOID_RET + SUFFIX_void + SUFFIX_const; + return std::string(struct_).append(REV_STR_VOID_RET).append(SUFFIX_void).append(SUFFIX_const); } @@ -18,7 +18,7 @@ std::string StrConst::reverseString(const char* pStr) const { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_const_char_ptr + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_const_char_ptr).append(SUFFIX_const); } @@ -26,7 +26,7 @@ std::string StrConst::reverseString(std::string pStr) const { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string).append(SUFFIX_const); } @@ -34,7 +34,7 @@ std::string StrConst::reverseString(std::string& pStr) const { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_lvref + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_lvref).append(SUFFIX_const); } @@ -42,7 +42,7 @@ std::string StrConst::reverseString(std::string&& pStr) const { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_rvref + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_rvref).append(SUFFIX_const); } @@ -50,7 +50,7 @@ std::string StrConst::reverseString(const std::string& pStr) const { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_clvref + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_clvref).append(SUFFIX_const); } @@ -58,7 +58,7 @@ std::string StrConst::reverseString(std::string* pStr) const { std::string retStr = *pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_ptr + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_ptr).append(SUFFIX_const); } @@ -66,7 +66,7 @@ std::string StrConst::reverseString(const std::string* pStr) const { std::string retStr = *pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_cptr + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_cptr).append(SUFFIX_const); } @@ -74,7 +74,7 @@ std::string StrConst::revStrConstRefArg(const std::string_view& pStr) const { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_clvref + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_clvref).append(SUFFIX_const); } @@ -82,7 +82,7 @@ std::string StrConst::revStrRValueRefArg(std::string_view&& pStr) const { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_rvref + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_rvref).append(SUFFIX_const); } @@ -90,7 +90,7 @@ std::string StrConst::revStrNonConstRefArg(std::string_view& pStr) const { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_lvref + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_lvref).append(SUFFIX_const); } @@ -98,7 +98,7 @@ std::string StrConst::revStrOverloadValCRef(std::string_view pStr) const { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view).append(SUFFIX_const); } @@ -106,7 +106,7 @@ std::string StrConst::revStrOverloadValCRef(const std::string_view& pStr) const { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_clvref + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_clvref).append(SUFFIX_const); } @@ -114,7 +114,7 @@ std::string StrConst::revStrOverloadValRef(std::string_view pStr) const { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view).append(SUFFIX_const); } @@ -122,7 +122,7 @@ std::string StrConst::revStrOverloadValRef(std::string_view& pStr) const { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_lvref + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_lvref).append(SUFFIX_const); } @@ -130,7 +130,7 @@ std::string StrConst::revStrOverloadRefAndCRef(std::string_view& pStr) const { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_lvref + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_lvref).append(SUFFIX_const); } @@ -138,5 +138,5 @@ std::string StrConst::revStrOverloadRefAndCRef(const std::string_view& pStr) con { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_clvref + SUFFIX_const; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_clvref).append(SUFFIX_const); } \ No newline at end of file diff --git a/CxxTestProps/src/StringConstOverload.cpp b/CxxTestProps/src/StringConstOverload.cpp index 75c75b63..621fddeb 100644 --- a/CxxTestProps/src/StringConstOverload.cpp +++ b/CxxTestProps/src/StringConstOverload.cpp @@ -10,11 +10,11 @@ using namespace test_utils; std::string StrConstOverload::reverseString() { - return std::string(struct_) + REV_STR_VOID_RET + SUFFIX_void; + return std::string(struct_).append(REV_STR_VOID_RET).append(SUFFIX_void); } std::string StrConstOverload::reverseString() const { - return std::string(struct_) + REV_STR_VOID_RET + SUFFIX_void + SUFFIX_const; + return std::string(struct_).append(REV_STR_VOID_RET).append(SUFFIX_void).append(SUFFIX_const); } \ No newline at end of file diff --git a/CxxTestProps/src/StringMute.cpp b/CxxTestProps/src/StringMute.cpp index 21d54fbd..35fd83a6 100644 --- a/CxxTestProps/src/StringMute.cpp +++ b/CxxTestProps/src/StringMute.cpp @@ -10,7 +10,7 @@ using namespace test_utils; std::string StrMute::reverseString() { - return std::string(struct_) + REV_STR_VOID_RET + SUFFIX_void; + return std::string(struct_).append(REV_STR_VOID_RET).append(SUFFIX_void); } @@ -18,7 +18,7 @@ std::string StrMute::reverseString(const char* pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_const_char_ptr; + return std::string(struct_).append(retStr).append(SUFFIX_const_char_ptr); } @@ -26,7 +26,7 @@ std::string StrMute::reverseString(std::string pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string; + return std::string(struct_).append(retStr).append(SUFFIX_std_string); } @@ -34,7 +34,7 @@ std::string StrMute::reverseString(std::string& pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_lvref; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_lvref); } @@ -42,7 +42,7 @@ std::string StrMute::reverseString(std::string&& pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_rvref; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_rvref); } @@ -50,7 +50,7 @@ std::string StrMute::reverseString(const std::string& pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_clvref; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_clvref); } @@ -58,7 +58,7 @@ std::string StrMute::reverseString(std::string* pStr) { std::string retStr = *pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_ptr; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_ptr); } @@ -66,7 +66,7 @@ std::string StrMute::reverseString(const std::string* pStr) { std::string retStr = *pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_cptr; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_cptr); } @@ -74,7 +74,7 @@ std::string StrMute::revStrConstRefArg(const std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_clvref; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_clvref); } @@ -82,7 +82,7 @@ std::string StrMute::revStrRValueRefArg(std::string_view&& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_rvref; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_rvref); } @@ -90,7 +90,7 @@ std::string StrMute::revStrNonConstRefArg(std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_lvref; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_lvref); } @@ -98,7 +98,7 @@ std::string StrMute::revStrOverloadValCRef(std::string_view pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view); } @@ -106,7 +106,7 @@ std::string StrMute::revStrOverloadValCRef(const std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_clvref; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_clvref); } @@ -114,7 +114,7 @@ std::string StrMute::revStrOverloadValRef(std::string_view pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view); } @@ -122,7 +122,7 @@ std::string StrMute::revStrOverloadValRef(std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_lvref; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_lvref); } @@ -130,7 +130,7 @@ std::string StrMute::revStrOverloadRefAndCRef(std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_lvref; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_lvref); } @@ -138,5 +138,5 @@ std::string StrMute::revStrOverloadRefAndCRef(const std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_clvref; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_clvref); } \ No newline at end of file diff --git a/CxxTestProps/src/StringOps.cpp b/CxxTestProps/src/StringOps.cpp index 3bafb6f4..1ba209a8 100644 --- a/CxxTestProps/src/StringOps.cpp +++ b/CxxTestProps/src/StringOps.cpp @@ -8,7 +8,7 @@ using namespace test_utils; std::string reverseString() { - return std::string(REV_STR_VOID_RET) + SUFFIX_void; + return std::string(REV_STR_VOID_RET).append(SUFFIX_void); } @@ -16,7 +16,7 @@ std::string reverseString(const char* pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_const_char_ptr; + return retStr.append(SUFFIX_const_char_ptr); } @@ -24,7 +24,7 @@ std::string reverseString(std::string pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string; + return retStr.append(SUFFIX_std_string); } @@ -32,7 +32,7 @@ std::string reverseString(std::string& pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string_lvref; + return retStr.append(SUFFIX_std_string_lvref); } @@ -40,7 +40,7 @@ std::string reverseString(std::string&& pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string_rvref; + return retStr.append(SUFFIX_std_string_rvref); } @@ -48,7 +48,7 @@ std::string reverseString(const std::string& pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string_clvref; + return retStr.append(SUFFIX_std_string_clvref); } @@ -56,7 +56,7 @@ std::string reverseString(std::string* pStr) { std::string retStr = *pStr; std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string_ptr; + return retStr.append(SUFFIX_std_string_ptr); } @@ -64,7 +64,7 @@ std::string reverseString(const std::string* pStr) { std::string retStr = *pStr; std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string_cptr; + return retStr.append(SUFFIX_std_string_cptr); } @@ -72,7 +72,7 @@ std::string revStrConstRefArg(const std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string_view_clvref; + return retStr.append(SUFFIX_std_string_view_clvref); } @@ -80,7 +80,7 @@ std::string revStrRValueRefArg(std::string_view&& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string_view_rvref; + return retStr.append(SUFFIX_std_string_view_rvref); } @@ -88,7 +88,7 @@ std::string revStrNonConstRefArg(std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string_view_lvref; + return retStr.append(SUFFIX_std_string_view_lvref); } @@ -96,7 +96,7 @@ std::string revStrOverloadValCRef(std::string_view pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string_view; + return retStr.append(SUFFIX_std_string_view); } @@ -104,7 +104,7 @@ std::string revStrOverloadValCRef(const std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string_view_clvref; + return retStr.append(SUFFIX_std_string_view_clvref); } @@ -112,7 +112,7 @@ std::string revStrOverloadValRef(std::string_view pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string_view; + return retStr.append(SUFFIX_std_string_view); } @@ -120,7 +120,7 @@ std::string revStrOverloadValRef(std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string_view_lvref; + return retStr.append(SUFFIX_std_string_view_lvref); } @@ -128,7 +128,7 @@ std::string revStrOverloadRefAndCRef(std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string_view_lvref; + return retStr.append(SUFFIX_std_string_view_lvref); } @@ -136,5 +136,5 @@ std::string revStrOverloadRefAndCRef(const std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return retStr + SUFFIX_std_string_view_clvref; + return retStr.append(SUFFIX_std_string_view_clvref); } \ No newline at end of file diff --git a/CxxTestProps/src/StringStatic.cpp b/CxxTestProps/src/StringStatic.cpp index 8aa092af..fb2be9a5 100644 --- a/CxxTestProps/src/StringStatic.cpp +++ b/CxxTestProps/src/StringStatic.cpp @@ -10,7 +10,7 @@ using namespace test_utils; std::string StrStatic::reverseString() { - return std::string(struct_) + (REV_STR_VOID_RET) + SUFFIX_void + SUFFIX_static; + return std::string(struct_).append((REV_STR_VOID_RET)).append(SUFFIX_void).append(SUFFIX_static); } @@ -18,7 +18,7 @@ std::string StrStatic::reverseString(const char* pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_const_char_ptr + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_const_char_ptr).append(SUFFIX_static); } @@ -26,7 +26,7 @@ std::string StrStatic::reverseString(std::string pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string).append(SUFFIX_static); } @@ -34,7 +34,7 @@ std::string StrStatic::reverseString(std::string& pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_lvref + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_lvref).append(SUFFIX_static); } @@ -42,7 +42,7 @@ std::string StrStatic::reverseString(std::string&& pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_rvref + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_rvref).append(SUFFIX_static); } @@ -50,7 +50,7 @@ std::string StrStatic::reverseString(const std::string& pStr) { std::string retStr = pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_clvref + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_clvref).append(SUFFIX_static); } @@ -58,7 +58,7 @@ std::string StrStatic::reverseString(std::string* pStr) { std::string retStr = *pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_ptr + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_ptr).append(SUFFIX_static); } @@ -66,7 +66,7 @@ std::string StrStatic::reverseString(const std::string* pStr) { std::string retStr = *pStr; std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_cptr + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_cptr).append(SUFFIX_static); } @@ -74,7 +74,7 @@ std::string StrStatic::revStrConstRefArg(const std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_clvref + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_clvref).append(SUFFIX_static); } @@ -82,7 +82,7 @@ std::string StrStatic::revStrRValueRefArg(std::string_view&& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_rvref + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_rvref).append(SUFFIX_static); } @@ -90,7 +90,7 @@ std::string StrStatic::revStrNonConstRefArg(std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_lvref + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_lvref).append(SUFFIX_static); } @@ -98,7 +98,7 @@ std::string StrStatic::revStrOverloadValCRef(std::string_view pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view).append(SUFFIX_static); } @@ -106,7 +106,7 @@ std::string StrStatic::revStrOverloadValCRef(const std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_clvref + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_clvref).append(SUFFIX_static); } @@ -114,7 +114,7 @@ std::string StrStatic::revStrOverloadValRef(std::string_view pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view).append(SUFFIX_static); } @@ -122,7 +122,7 @@ std::string StrStatic::revStrOverloadValRef(std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_lvref + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_lvref).append(SUFFIX_static); } @@ -130,7 +130,7 @@ std::string StrStatic::revStrOverloadRefAndCRef(std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_lvref + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_lvref).append(SUFFIX_static); } @@ -138,5 +138,5 @@ std::string StrStatic::revStrOverloadRefAndCRef(const std::string_view& pStr) { std::string retStr(pStr); std::reverse(retStr.begin(), retStr.end()); - return std::string(struct_) + retStr + SUFFIX_std_string_view_clvref + SUFFIX_static; + return std::string(struct_).append(retStr).append(SUFFIX_std_string_view_clvref).append(SUFFIX_static); } \ No newline at end of file diff --git a/CxxTestProps/src/StringWrap.cpp b/CxxTestProps/src/StringWrap.cpp index a295235a..d30017df 100644 --- a/CxxTestProps/src/StringWrap.cpp +++ b/CxxTestProps/src/StringWrap.cpp @@ -13,41 +13,41 @@ StrWrap::StrWrap(const std::string& pStr) { } StrWrapA::StrWrapA() - :StrWrap(std::string(struct_) + SUFFIX_ctor) + :StrWrap(std::string(struct_).append(SUFFIX_ctor)) { } StrWrapA::StrWrapA(std::string_view pStr) - :StrWrap(std::string(struct_) + std::string(pStr) + SUFFIX_std_string_view + SUFFIX_ctor) + :StrWrap(std::string(struct_).append(pStr).append(SUFFIX_std_string_view).append(SUFFIX_ctor)) { } StrWrapA::StrWrapA(std::string& pStr) - :StrWrap(std::string(struct_) + pStr + SUFFIX_std_string_lvref + SUFFIX_ctor) + :StrWrap(std::string(struct_).append(pStr).append(SUFFIX_std_string_lvref).append(SUFFIX_ctor)) { } StrWrapA::StrWrapA(const std::string& pStr) - :StrWrap(std::string(struct_) + pStr + SUFFIX_std_string_clvref + SUFFIX_ctor) + :StrWrap(std::string(struct_).append(pStr).append(SUFFIX_std_string_clvref).append(SUFFIX_ctor)) { } StrWrapA::StrWrapA(std::string&& pStr) - :StrWrap(std::string(struct_) + pStr + SUFFIX_std_string_rvref + SUFFIX_ctor) + :StrWrap(std::string(struct_).append(pStr).append(SUFFIX_std_string_rvref).append(SUFFIX_ctor)) { } StrWrapA::StrWrapA(const char* pStr) - :StrWrap(std::string(struct_) + std::string(pStr) + SUFFIX_const_char_ptr + SUFFIX_ctor) + :StrWrap(std::string(struct_).append(pStr).append(SUFFIX_const_char_ptr).append(SUFFIX_ctor)) { } StrWrapB::StrWrapB(const std::string& pStr) - :StrWrap(std::string(struct_) + pStr + SUFFIX_std_string_clvref + SUFFIX_ctor) + :StrWrap(std::string(struct_).append(pStr).append(SUFFIX_std_string_clvref).append(SUFFIX_ctor)) { } StrWrapB::StrWrapB(std::string& pStr) - :StrWrap(std::string(struct_) + pStr + SUFFIX_std_string_lvref + SUFFIX_ctor) + :StrWrap(std::string(struct_).append(pStr).append(SUFFIX_std_string_lvref).append(SUFFIX_ctor)) { } StrWrapC::StrWrapC(std::string& pStr) - :StrWrap(std::string(struct_) + pStr + SUFFIX_std_string_lvref + SUFFIX_ctor) + :StrWrap(std::string(struct_).append(pStr).append(SUFFIX_std_string_lvref).append(SUFFIX_ctor)) { } StrWrapD::StrWrapD(const std::string& pStr) - :StrWrap(std::string(struct_) + pStr + SUFFIX_std_string_clvref + SUFFIX_ctor) + :StrWrap(std::string(struct_).append(pStr).append(SUFFIX_std_string_clvref).append(SUFFIX_ctor)) { } \ No newline at end of file diff --git a/CxxTestUtils/inc/GlobalTestUtils.h b/CxxTestUtils/inc/GlobalTestUtils.h index d8660412..2deec1db 100755 --- a/CxxTestUtils/inc/GlobalTestUtils.h +++ b/CxxTestUtils/inc/GlobalTestUtils.h @@ -32,26 +32,26 @@ namespace test_utils { inline constexpr std::string_view str_setImaginary = "complex::setImaginary"; inline constexpr std::string_view str_getMagnitude = "complex::getMagnitude"; - static const char* SUFFIX_void = "_void"; - static const char* SUFFIX_ctor = "_ctor"; - static const char* SUFFIX_const = "_const"; - static const char* SUFFIX_static = "_static"; - static const char* SUFFIX_const_char_ptr = "_const_char_*"; + inline constexpr std::string_view SUFFIX_void = "_void"; + inline constexpr std::string_view SUFFIX_ctor = "_ctor"; + inline constexpr std::string_view SUFFIX_const = "_const"; + inline constexpr std::string_view SUFFIX_static = "_static"; + inline constexpr std::string_view SUFFIX_const_char_ptr = "_const_char_*"; - static const char* SUFFIX_std_string = "_std::string"; + inline constexpr std::string_view SUFFIX_std_string = "_std::string"; - static const char* SUFFIX_std_string_ptr = "_std::string*"; - static const char* SUFFIX_std_string_cptr = "_const_std::string*"; + inline constexpr std::string_view SUFFIX_std_string_ptr = "_std::string*"; + inline constexpr std::string_view SUFFIX_std_string_cptr = "_const_std::string*"; - static const char* SUFFIX_std_string_lvref = "_std::string&"; - static const char* SUFFIX_std_string_clvref = "_const_std::string&"; + inline constexpr std::string_view SUFFIX_std_string_lvref = "_std::string&"; + inline constexpr std::string_view SUFFIX_std_string_clvref = "_const_std::string&"; - static const char* SUFFIX_std_string_rvref = "_std::string&&"; + inline constexpr std::string_view SUFFIX_std_string_rvref = "_std::string&&"; - static const char* REV_STR_VOID_RET = "func_reverseString(void)->[return_str]"; + inline constexpr std::string_view REV_STR_VOID_RET = "func_reverseString(void)->[return_str]"; - static const char* SUFFIX_std_string_view = "_std::string_view"; - static const char* SUFFIX_std_string_view_lvref = "_std::string_view&"; - static const char* SUFFIX_std_string_view_rvref = "_std::string_view&&"; - static const char* SUFFIX_std_string_view_clvref = "_const_std::string_view&"; + inline constexpr std::string_view SUFFIX_std_string_view = "_std::string_view"; + inline constexpr std::string_view SUFFIX_std_string_view_lvref = "_std::string_view&"; + inline constexpr std::string_view SUFFIX_std_string_view_rvref = "_std::string_view&&"; + inline constexpr std::string_view SUFFIX_std_string_view_clvref = "_const_std::string_view&"; } \ No newline at end of file diff --git a/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp b/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp index 143fb8d5..0d3ae7e5 100644 --- a/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp @@ -218,7 +218,7 @@ namespace rtl_tests EXPECT_TRUE(ret.canViewAs()); string retStr = ret.view()->get(); - auto expStr = std::string(STRA_REVERSE) + SUFFIX_std_string; + auto expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string); EXPECT_EQ(retStr, expStr); } { //STRB's type is 'const char*', function accepts 'string', @@ -230,7 +230,7 @@ namespace rtl_tests EXPECT_TRUE(ret.canViewAs()); string retStr = ret.view()->get(); - auto expStr = std::string(STRB_REVERSE) + SUFFIX_std_string; + auto expStr = std::string(STRB_REVERSE).append(SUFFIX_std_string); EXPECT_EQ(retStr, expStr); } { rtl::function reverseString = fnReverseString->argsT<>().returnT<>(); @@ -241,7 +241,7 @@ namespace rtl_tests EXPECT_TRUE(ret.canViewAs()); string retStr = ret.view()->get(); - auto expStr = std::string(REV_STR_VOID_RET) + SUFFIX_void; + auto expStr = std::string(REV_STR_VOID_RET).append(SUFFIX_void); EXPECT_EQ(retStr, expStr); } } diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnAndTargetErased_ConstMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnAndTargetErased_ConstMethod.cpp index f5a8d8d0..3a125e5c 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnAndTargetErased_ConstMethod.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnAndTargetErased_ConstMethod.cpp @@ -35,8 +35,7 @@ namespace rtl_tests ASSERT_TRUE(ret.canViewAs()); const std::string& retStr = ret.view()->get(); - const std::string& expectedStr = std::string(StrConstOverload::struct_) + REV_STR_VOID_RET + - SUFFIX_void; + std::string expectedStr = std::string(StrConstOverload::struct_).append(REV_STR_VOID_RET).append(SUFFIX_void); EXPECT_EQ(retStr, expectedStr); } { auto [err, ret] = reverseString(std::cref(robj))(); @@ -45,8 +44,7 @@ namespace rtl_tests ASSERT_TRUE(ret.canViewAs()); const std::string& retStr = ret.view()->get(); - const std::string& expectedStr = std::string(StrConstOverload::struct_) + REV_STR_VOID_RET + - SUFFIX_void + SUFFIX_const; + std::string expectedStr = std::string(StrConstOverload::struct_).append(REV_STR_VOID_RET).append(SUFFIX_void).append(SUFFIX_const); EXPECT_EQ(retStr, expectedStr); } }; diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Constructor.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Constructor.cpp index c2ee4c23..bf3dfd04 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Constructor.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Constructor.cpp @@ -84,7 +84,7 @@ namespace rtl_tests const auto& stdStr = viewStr->get(); EXPECT_EQ(stdStr.sstr(), - (std::string(StrWrapA::struct_) + SUFFIX_ctor)); + (std::string(StrWrapA::struct_).append(SUFFIX_ctor))); }; testCreateOn(rtl::alloc::Heap); testCreateOn(rtl::alloc::Stack); @@ -104,9 +104,8 @@ namespace rtl_tests ASSERT_TRUE(viewStr); const auto& stdStr = viewStr->get(); - EXPECT_EQ(stdStr.sstr(), - (std::string(StrWrapA::struct_) + std::string(SPARTA) + - SUFFIX_std_string_view + SUFFIX_ctor)); + EXPECT_EQ(stdStr.sstr(), + (std::string(StrWrapA::struct_).append(SPARTA).append(SUFFIX_std_string_view).append(SUFFIX_ctor))); }; testCreateOn(rtl::alloc::Heap); testCreateOn(rtl::alloc::Stack); @@ -125,8 +124,7 @@ namespace rtl_tests const auto& stdStr = viewStr->get(); EXPECT_EQ(stdStr.sstr(), - (std::string(StrWrapA::struct_) + std::string(SPARTA) + - SUFFIX_const_char_ptr + SUFFIX_ctor)); + (std::string(StrWrapA::struct_).append(SPARTA).append(SUFFIX_const_char_ptr).append(SUFFIX_ctor))); }; testCreateOn(rtl::alloc::Heap); testCreateOn(rtl::alloc::Stack); @@ -154,8 +152,7 @@ namespace rtl_tests const auto& stdStr = viewStr->get(); EXPECT_EQ(stdStr.sstr(), - (std::string(StrWrapA::struct_) + std::string(SPARTA) + - SUFFIX_std_string_lvref + SUFFIX_ctor)); + (std::string(StrWrapA::struct_).append(SPARTA).append(SUFFIX_std_string_lvref).append(SUFFIX_ctor))); }; testCreateOn(rtl::alloc::Heap); testCreateOn(rtl::alloc::Stack); @@ -171,8 +168,7 @@ namespace rtl_tests const auto& stdStr = viewStr->get(); EXPECT_EQ(stdStr.sstr(), - (std::string(StrWrapA::struct_) + std::string(SPARTA) + - SUFFIX_std_string_rvref + SUFFIX_ctor)); + (std::string(StrWrapA::struct_).append(SPARTA).append(SUFFIX_std_string_rvref).append(SUFFIX_ctor))); }; testCreateOn(rtl::alloc::Heap); testCreateOn(rtl::alloc::Stack); @@ -188,8 +184,7 @@ namespace rtl_tests const auto& stdStr = viewStr->get(); EXPECT_EQ(stdStr.sstr(), - (std::string(StrWrapA::struct_) + std::string(SPARTA) + - SUFFIX_std_string_clvref + SUFFIX_ctor)); + (std::string(StrWrapA::struct_).append(SPARTA).append(SUFFIX_std_string_clvref).append(SUFFIX_ctor))); }; testCreateOn(rtl::alloc::Heap); testCreateOn(rtl::alloc::Stack); @@ -268,9 +263,8 @@ namespace rtl_tests ASSERT_TRUE(viewStr); const auto& stdStr = viewStr->get(); - EXPECT_EQ(stdStr.sstr(), - (std::string(StrWrapD::struct_) + std::string(SPARTA) + - SUFFIX_std_string_clvref + SUFFIX_ctor)); + EXPECT_EQ(stdStr.sstr(), + (std::string(StrWrapD::struct_).append(SPARTA).append(SUFFIX_std_string_clvref).append(SUFFIX_ctor))); }; testCreateOn(rtl::alloc::Heap); testCreateOn(rtl::alloc::Stack); diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp index c2ec83f3..1bc09ef0 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp @@ -76,7 +76,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_const_char_ptr; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_const_char_ptr); EXPECT_EQ(retStr, expStr); } { auto [err, robj] = reverseString.bind()(STRA.data()); @@ -86,7 +86,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_const_char_ptr; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_const_char_ptr); EXPECT_EQ(retStr, expStr); } } @@ -102,7 +102,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string); EXPECT_EQ(retStr, expStr); } { auto [err, robj] = reverseString.bind()(STRA.data()); @@ -112,7 +112,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string); EXPECT_EQ(retStr, expStr); } } @@ -129,7 +129,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_ptr; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_ptr); EXPECT_EQ(retStr, expStr); } { std::string str(STRA); @@ -140,7 +140,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_ptr; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_ptr); EXPECT_EQ(retStr, expStr); } } @@ -157,7 +157,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_cptr; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_cptr); EXPECT_EQ(retStr, expStr); } { const std::string str(STRA); @@ -168,7 +168,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_cptr; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_cptr); EXPECT_EQ(retStr, expStr); } } @@ -184,7 +184,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(REV_STR_VOID_RET) + SUFFIX_void; + std::string expStr = std::string(REV_STR_VOID_RET).append(SUFFIX_void); EXPECT_EQ(retStr, expStr); } { auto [err, robj] = reverseString.bind()(); @@ -194,7 +194,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(REV_STR_VOID_RET) + SUFFIX_void; + std::string expStr = std::string(REV_STR_VOID_RET).append(SUFFIX_void); EXPECT_EQ(retStr, expStr); } } @@ -228,7 +228,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_view); EXPECT_EQ(retStr, expStr); } { // explicit call by value resolution. @@ -239,7 +239,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_view); EXPECT_EQ(retStr, expStr); } } @@ -271,7 +271,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(retStr, expStr); } { auto [err, robj] = reverseString.bind()(str); @@ -306,7 +306,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_view); EXPECT_EQ(retStr, expStr); } { // explicit call by value resolution. @@ -316,7 +316,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_view); EXPECT_EQ(retStr, expStr); } } @@ -347,7 +347,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_lvref); EXPECT_EQ(retStr, expStr); } { auto [err, robj] = reverseString.bind()(str); @@ -394,7 +394,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_lvref); EXPECT_EQ(retStr, expStr); } } @@ -425,7 +425,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(retStr, expStr); } { // explicit binding must also behave the same way. @@ -436,7 +436,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(retStr, expStr); } { // explicit binding to non-const ref returns error. @@ -474,7 +474,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_rvref; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_rvref); EXPECT_EQ(retStr, expStr); } } @@ -535,7 +535,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_lvref); EXPECT_EQ(retStr, expStr); } { // Explicitly selecting the const ref overload. @@ -549,7 +549,7 @@ namespace rtl_tests ASSERT_TRUE(robj.canViewAs()); const std::string& retStr = robj.view()->get(); - std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(retStr, expStr); } } From 44a04ad1cc418a7796387cd142f451b2b6b01d62 Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Wed, 11 Feb 2026 09:55:11 +0530 Subject: [PATCH 15/16] clang-mirror generated ids integration. --- CxxTestUtils/inc/GlobalTestUtils.h | 6 ------ .../CxxMirrorTests/CxxMirrorThreadingTest.cpp | 8 ++++---- .../NameSpaceGlobalsTests.cpp | 18 +++++++++--------- .../TypeAware_Function.cpp | 16 ++++++++-------- 4 files changed, 21 insertions(+), 27 deletions(-) diff --git a/CxxTestUtils/inc/GlobalTestUtils.h b/CxxTestUtils/inc/GlobalTestUtils.h index 2deec1db..927ad592 100755 --- a/CxxTestUtils/inc/GlobalTestUtils.h +++ b/CxxTestUtils/inc/GlobalTestUtils.h @@ -26,12 +26,6 @@ namespace test_utils { inline constexpr std::string_view str_revStrOverloadValRef = "revStrOverloadValRef"; inline constexpr std::string_view str_revStrOverloadValCRef = "revStrOverloadValCRef"; - inline constexpr std::string_view str_getComplexNumAsString = "getComplexNumAsString"; - - inline constexpr std::string_view str_setReal = "complex::setReal"; - inline constexpr std::string_view str_setImaginary = "complex::setImaginary"; - inline constexpr std::string_view str_getMagnitude = "complex::getMagnitude"; - inline constexpr std::string_view SUFFIX_void = "_void"; inline constexpr std::string_view SUFFIX_ctor = "_ctor"; inline constexpr std::string_view SUFFIX_const = "_const"; diff --git a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp index e51a9b09..3fe73c5b 100644 --- a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp +++ b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp @@ -133,13 +133,13 @@ namespace rtl_tests rtl::type().function(str_reverseString).build(reverseString), - rtl::type().function(str_getComplexNumAsString).build(getComplexNumAsString), + rtl::type().function(cxx::fn::getComplexNumAsString::id).build(getComplexNumAsString), - rtl::type().function(str_setReal).build(complex::setReal), + rtl::type().function(cxx::fn::complex::setReal::id).build(complex::setReal), - rtl::type().function(str_setImaginary).build(complex::setImaginary), + rtl::type().function(cxx::fn::complex::setImaginary::id).build(complex::setImaginary), - rtl::type().function(str_getMagnitude).build(complex::getMagnitude), + rtl::type().function(cxx::fn::complex::getMagnitude::id).build(complex::getMagnitude), rtl::type().function("ext::sendString").build(my_type::ext::sendString), diff --git a/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp b/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp index 0d3ae7e5..a820c237 100644 --- a/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp @@ -106,21 +106,21 @@ namespace rtl_tests TEST(FunctionInNameSpace, get_namespace_function_types) { - optional setReal = cxx::mirror().getFunction(str_setReal); + optional setReal = cxx::mirror().getFunction(cxx::fn::complex::setReal::id); ASSERT_TRUE(setReal); - optional setImaginary = cxx::mirror().getFunction(str_setImaginary); + optional setImaginary = cxx::mirror().getFunction(cxx::fn::complex::setImaginary::id); ASSERT_TRUE(setImaginary); - EXPECT_TRUE(setReal->getFunctionName() == str_setReal); - EXPECT_TRUE(setImaginary->getFunctionName() == str_setImaginary); + EXPECT_TRUE(setReal->getFunctionName() == cxx::fn::complex::setReal::id); + EXPECT_TRUE(setImaginary->getFunctionName() == cxx::fn::complex::setImaginary::id); } TEST(FunctionInNameSpace, namespace_function_execute_return) { { - optional fnSetReal = cxx::mirror().getFunction(str_setReal); + optional fnSetReal = cxx::mirror().getFunction(cxx::fn::complex::setReal::id); ASSERT_TRUE(fnSetReal); EXPECT_TRUE(fnSetReal->hasSignature()); @@ -132,7 +132,7 @@ namespace rtl_tests EXPECT_TRUE(err == rtl::error::None); ASSERT_TRUE(ret.isEmpty()); } { - optional fnSetImaginary = cxx::mirror().getFunction(str_setImaginary); + optional fnSetImaginary = cxx::mirror().getFunction(cxx::fn::complex::setImaginary::id); ASSERT_TRUE(fnSetImaginary); EXPECT_TRUE(fnSetImaginary->hasSignature()); @@ -144,7 +144,7 @@ namespace rtl_tests EXPECT_TRUE(err == rtl::error::None); ASSERT_TRUE(ret.isEmpty()); } { - optional fnGetMagnitude = cxx::mirror().getFunction(str_getMagnitude); + optional fnGetMagnitude = cxx::mirror().getFunction(cxx::fn::complex::getMagnitude::id); ASSERT_TRUE(fnGetMagnitude); EXPECT_TRUE(fnGetMagnitude->hasSignature<>()); //empty template params checks for zero arguments. @@ -166,7 +166,7 @@ namespace rtl_tests TEST(FunctionInNameSpace, execute_with_wrong_signature) { - optional fnSetReal = cxx::mirror().getFunction(str_setReal); + optional fnSetReal = cxx::mirror().getFunction(cxx::fn::complex::setReal::id); ASSERT_TRUE(fnSetReal); EXPECT_TRUE(fnSetReal->hasSignature()); @@ -184,7 +184,7 @@ namespace rtl_tests TEST(GlobalFunction, get_function_execute_return) { - optional fnGetComplexAsStr = cxx::mirror().getFunction(str_getComplexNumAsString); + optional fnGetComplexAsStr = cxx::mirror().getFunction(cxx::fn::getComplexNumAsString::id); ASSERT_TRUE(fnGetComplexAsStr); rtl::function getComplexNumAsStr = fnGetComplexAsStr->argsT<>().returnT<>(); diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp index 278873fc..786506d5 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp @@ -14,10 +14,10 @@ namespace rtl_tests { TEST(TypeAware_Function, init_errors_validation) { - std::optional setReal = cxx::mirror().getFunction(str_setReal); + std::optional setReal = cxx::mirror().getFunction(cxx::fn::complex::setReal::id); ASSERT_TRUE(setReal); { - EXPECT_TRUE(setReal->getFunctionName() == str_setReal); + EXPECT_TRUE(setReal->getFunctionName() == cxx::fn::complex::setReal::id); { rtl::function functor = setReal->argsT().returnT(); EXPECT_TRUE(functor); @@ -29,10 +29,10 @@ namespace rtl_tests } } - std::optional setImaginary = cxx::mirror().getFunction(str_setImaginary); + std::optional setImaginary = cxx::mirror().getFunction(cxx::fn::complex::setImaginary::id); ASSERT_TRUE(setImaginary); { - EXPECT_TRUE(setImaginary->getFunctionName() == str_setImaginary); + EXPECT_TRUE(setImaginary->getFunctionName() == cxx::fn::complex::setImaginary::id); { rtl::function functor = setImaginary->argsT().returnT(); EXPECT_TRUE(functor); @@ -48,19 +48,19 @@ namespace rtl_tests TEST(TypeAware_Function, namespace_fn_call_with_known_signature) { - std::optional getMagnitude = cxx::mirror().getFunction(str_getMagnitude); + std::optional getMagnitude = cxx::mirror().getFunction(cxx::fn::complex::getMagnitude::id); ASSERT_TRUE(getMagnitude); rtl::function get_magnitude = getMagnitude->argsT<>().returnT(); ASSERT_TRUE(get_magnitude); - std::optional setReal = cxx::mirror().getFunction(str_setReal); + std::optional setReal = cxx::mirror().getFunction(cxx::fn::complex::setReal::id); ASSERT_TRUE(setReal); rtl::function set_real = setReal->argsT().returnT(); ASSERT_TRUE(set_real); - std::optional setImaginary = cxx::mirror().getFunction(str_setImaginary); + std::optional setImaginary = cxx::mirror().getFunction(cxx::fn::complex::setImaginary::id); ASSERT_TRUE(setImaginary); rtl::function set_imaginary = setImaginary->argsT().returnT(); @@ -79,7 +79,7 @@ namespace rtl_tests TEST(TypeAware_Function, global_fn_call_with_known_signature) { - std::optional getComplexNumStr = cxx::mirror().getFunction(str_getComplexNumAsString); + std::optional getComplexNumStr = cxx::mirror().getFunction(cxx::fn::getComplexNumAsString::id); ASSERT_TRUE(getComplexNumStr); { rtl::function get_complex_num_str = getComplexNumStr->argsT<>().returnT(); From 702cd85710b2138b2ad7d24ade63ce231d3822c3 Mon Sep 17 00:00:00 2001 From: neeraj31285 Date: Wed, 11 Feb 2026 10:17:50 +0530 Subject: [PATCH 16/16] clang-mirror generated ids integration. --- CxxTestUtils/inc/GlobalTestUtils.h | 7 ----- .../CxxMirrorTests/CxxMirrorThreadingTest.cpp | 6 ++--- .../NameSpaceGlobalsTests.cpp | 2 +- .../TypeAware_ConstMethod.cpp | 20 +++++++------- .../TypeAware_Function.cpp | 18 ++++++------- .../TypeAware_Method.cpp | 20 +++++++------- .../TypeAware_StaticMethod.cpp | 26 +++++++++---------- .../ReturnAndTargetErased_ConstMethod.cpp | 2 +- .../ReturnErased_Function.cpp | 16 ++++++------ .../ReturnErased_Method.cpp | 16 ++++++------ .../ReturnErased_StaticMethod.cpp | 8 +++--- 11 files changed, 67 insertions(+), 74 deletions(-) diff --git a/CxxTestUtils/inc/GlobalTestUtils.h b/CxxTestUtils/inc/GlobalTestUtils.h index 927ad592..3a527ea0 100755 --- a/CxxTestUtils/inc/GlobalTestUtils.h +++ b/CxxTestUtils/inc/GlobalTestUtils.h @@ -19,13 +19,6 @@ namespace test_utils { inline constexpr std::string_view STRB = "cxxReflection"; inline constexpr std::string_view STRB_REVERSE = "noitcelfeRxxc"; - inline constexpr std::string_view str_reverseString = "reverseString"; - inline constexpr std::string_view str_revStrConstRefArg = "revStrConstRefArg"; - inline constexpr std::string_view str_revStrRValueRefArg = "revStrRValueRefArg"; - inline constexpr std::string_view str_revStrNonConstRefArg = "revStrNonConstRefArg"; - inline constexpr std::string_view str_revStrOverloadValRef = "revStrOverloadValRef"; - inline constexpr std::string_view str_revStrOverloadValCRef = "revStrOverloadValCRef"; - inline constexpr std::string_view SUFFIX_void = "_void"; inline constexpr std::string_view SUFFIX_ctor = "_ctor"; inline constexpr std::string_view SUFFIX_const = "_const"; diff --git a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp index 3fe73c5b..dbcbc3a0 100644 --- a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp +++ b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp @@ -127,11 +127,11 @@ namespace rtl_tests { auto _ = rtl::CxxMirror({ - rtl::type().function(str_reverseString).build(reverseString), + rtl::type().function(cxx::fn::reverseString::id).build(reverseString), - rtl::type().function(str_reverseString).build(reverseString), + rtl::type().function(cxx::fn::reverseString::id).build(reverseString), - rtl::type().function(str_reverseString).build(reverseString), + rtl::type().function(cxx::fn::reverseString::id).build(reverseString), rtl::type().function(cxx::fn::getComplexNumAsString::id).build(getComplexNumAsString), diff --git a/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp b/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp index a820c237..fea71c88 100644 --- a/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp @@ -204,7 +204,7 @@ namespace rtl_tests TEST(GlobalFunction, overloaded_function_execute_return) { - optional fnReverseString = cxx::mirror().getFunction(str_reverseString); + optional fnReverseString = cxx::mirror().getFunction(cxx::fn::reverseString::id); ASSERT_TRUE(fnReverseString); rtl::function reverseString = fnReverseString->argsT().returnT<>(); diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_ConstMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_ConstMethod.cpp index acc8f92b..59d4ae83 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_ConstMethod.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_ConstMethod.cpp @@ -53,7 +53,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::const_method reverse_string = reverseString->targetT() @@ -82,7 +82,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::const_method reverse_string = reverseString->targetT() @@ -140,7 +140,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { //argument lvalue-ref. @@ -204,7 +204,7 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::const_method reverse_string = reverseString->targetT() @@ -242,7 +242,7 @@ namespace rtl_tests StrConst target; std::string str(STRA); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::const_method reverse_string = reverseString->targetT() @@ -303,7 +303,7 @@ namespace rtl_tests StrConst target; std::string str(STRA); { - std::optional reverseString = optStringUtil->getMethod(str_revStrConstRefArg); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrConstRefArg::id); ASSERT_TRUE(reverseString); rtl::const_method reverse_string = reverseString->targetT() @@ -317,7 +317,7 @@ namespace rtl_tests auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } { - std::optional reverseString = optStringUtil->getMethod(str_revStrNonConstRefArg); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrNonConstRefArg::id); ASSERT_TRUE(reverseString); rtl::const_method reverse_string = reverseString->targetT() @@ -331,7 +331,7 @@ namespace rtl_tests auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref).append(SUFFIX_const); EXPECT_EQ(ret_str, exp_str); } { - std::optional reverseString = optStringUtil->getMethod(str_revStrRValueRefArg); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrRValueRefArg::id); ASSERT_TRUE(reverseString); rtl::const_method reverse_string = reverseString->targetT() @@ -353,7 +353,7 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrConst target; - std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValRef); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrOverloadValRef::id); ASSERT_TRUE(reverseString); { rtl::const_method reverse_string = reverseString->targetT() @@ -385,7 +385,7 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrConst target; - std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValCRef); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrOverloadValCRef::id); ASSERT_TRUE(reverseString); { rtl::const_method reverse_string = reverseString->targetT() diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp index 786506d5..803fd5c2 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp @@ -102,7 +102,7 @@ namespace rtl_tests TEST(TypeAware_Function, overload_resolution_with_known_signatures) { - std::optional reverseString = cxx::mirror().getFunction(str_reverseString); + std::optional reverseString = cxx::mirror().getFunction(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::function reverse_string = reverseString->argsT().returnT(); @@ -137,7 +137,7 @@ namespace rtl_tests TEST(TypeAware_Function, lvalue_ref_overload_resolution_with_known_signatures) { - std::optional reverseString = cxx::mirror().getFunction(str_reverseString); + std::optional reverseString = cxx::mirror().getFunction(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::function reverse_string = reverseString->argsT().returnT(); @@ -161,7 +161,7 @@ namespace rtl_tests TEST(TypeAware_Function, rvalue_ref_overload_resolution_with_known_signatures) { - std::optional reverseString = cxx::mirror().getFunction(str_reverseString); + std::optional reverseString = cxx::mirror().getFunction(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::function reverse_string = reverseString->argsT().returnT(); @@ -180,7 +180,7 @@ namespace rtl_tests TEST(TypeAware_Function, ptr_and_const_ptr_overload_resolution_with_known_signatures) { std::string str(STRA); - std::optional reverseString = cxx::mirror().getFunction(str_reverseString); + std::optional reverseString = cxx::mirror().getFunction(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::function reverse_string = reverseString->argsT().returnT(); @@ -204,7 +204,7 @@ namespace rtl_tests { std::string str(STRA); { - std::optional reverseString = cxx::mirror().getFunction(str_revStrConstRefArg); + std::optional reverseString = cxx::mirror().getFunction(cxx::fn::revStrConstRefArg::id); ASSERT_TRUE(reverseString); rtl::function reverse_string = reverseString->argsT().returnT(); @@ -214,7 +214,7 @@ namespace rtl_tests auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(ret_str, exp_str); } { - std::optional reverseString = cxx::mirror().getFunction(str_revStrNonConstRefArg); + std::optional reverseString = cxx::mirror().getFunction(cxx::fn::revStrNonConstRefArg::id); ASSERT_TRUE(reverseString); rtl::function reverse_string = reverseString->argsT().returnT(); @@ -225,7 +225,7 @@ namespace rtl_tests auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_lvref); EXPECT_EQ(ret_str, exp_str); } { - std::optional reverseString = cxx::mirror().getFunction(str_revStrRValueRefArg); + std::optional reverseString = cxx::mirror().getFunction(cxx::fn::revStrRValueRefArg::id); ASSERT_TRUE(reverseString); rtl::function reverse_string = reverseString->argsT().returnT(); @@ -240,7 +240,7 @@ namespace rtl_tests TEST(TypeAware_Function, overloads_with_ref_and_value_args_call_with_known_signature) { - std::optional reverseString = cxx::mirror().getFunction(str_revStrOverloadValRef); + std::optional reverseString = cxx::mirror().getFunction(cxx::fn::revStrOverloadValRef::id); ASSERT_TRUE(reverseString); { rtl::function reverse_string = reverseString->argsT().returnT(); @@ -263,7 +263,7 @@ namespace rtl_tests TEST(TypeAware_Function, overloads_with_const_ref_and_value_args_call_with_known_signature) { - std::optional reverseString = cxx::mirror().getFunction(str_revStrOverloadValCRef); + std::optional reverseString = cxx::mirror().getFunction(cxx::fn::revStrOverloadValCRef::id); ASSERT_TRUE(reverseString); { rtl::function reverse_string = reverseString->argsT().returnT(); diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Method.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Method.cpp index 84529707..dbaa790b 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Method.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Method.cpp @@ -18,7 +18,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::method reverse_string = reverseString->targetT() @@ -47,7 +47,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::method reverse_string = reverseString->targetT() @@ -107,7 +107,7 @@ namespace rtl_tests //non-const target. StrMute target; - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { //argument lvalue-ref @@ -173,7 +173,7 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrMute target; - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::method reverse_string = reverseString->targetT() @@ -200,7 +200,7 @@ namespace rtl_tests StrMute target; std::string str(STRA); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::method reverse_string = reverseString->targetT() @@ -232,7 +232,7 @@ namespace rtl_tests StrMute target; std::string str(STRA); { - std::optional reverseString = optStringUtil->getMethod(str_revStrConstRefArg); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrConstRefArg::id); ASSERT_TRUE(reverseString); rtl::method reverse_string = reverseString->targetT() @@ -244,7 +244,7 @@ namespace rtl_tests auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref); EXPECT_EQ(ret_str, exp_str); } { - std::optional reverseString = optStringUtil->getMethod(str_revStrNonConstRefArg); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrNonConstRefArg::id); ASSERT_TRUE(reverseString); rtl::method reverse_string = reverseString->targetT() @@ -257,7 +257,7 @@ namespace rtl_tests auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref); EXPECT_EQ(ret_str, exp_str); } { - std::optional reverseString = optStringUtil->getMethod(str_revStrRValueRefArg); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrRValueRefArg::id); ASSERT_TRUE(reverseString); rtl::method reverse_string = reverseString->targetT() @@ -278,7 +278,7 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrMute target; - std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValRef); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrOverloadValRef::id); ASSERT_TRUE(reverseString); { rtl::method reverse_string = reverseString->targetT() @@ -309,7 +309,7 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrMute target; - std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValCRef); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrOverloadValCRef::id); ASSERT_TRUE(reverseString); { rtl::method reverse_string = reverseString->targetT() diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_StaticMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_StaticMethod.cpp index ecd46c37..d3a69ba0 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_StaticMethod.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_StaticMethod.cpp @@ -18,7 +18,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::static_method reverse_string = reverseString->argsT() @@ -45,7 +45,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); // has only static-methods. ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::method reverse_string = reverseString.value() @@ -65,7 +65,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); // doesn't have any static-methods. ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); rtl::static_method reverse_string = reverseString.value() @@ -77,7 +77,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); // doesn't have any static-methods. ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::static_method reverse_string = reverseString.value() @@ -95,7 +95,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil.value().getMethod(str_reverseString); + std::optional reverseString = optStringUtil.value().getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::method reverse_string = reverseString.value() @@ -159,7 +159,7 @@ namespace rtl_tests //non-const target. StrMute target; - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { //argument lvalue-ref @@ -217,7 +217,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::static_method reverse_string = reverseString.value() @@ -238,7 +238,7 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); std::string str(STRA); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::static_method reverse_string = reverseString.value() @@ -269,7 +269,7 @@ namespace rtl_tests std::string str(STRA); { - std::optional reverseString = optStringUtil->getMethod(str_revStrConstRefArg); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrConstRefArg::id); ASSERT_TRUE(reverseString); rtl::static_method reverse_string = reverseString.value() @@ -281,7 +281,7 @@ namespace rtl_tests auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } { - std::optional reverseString = optStringUtil->getMethod(str_revStrNonConstRefArg); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrNonConstRefArg::id); ASSERT_TRUE(reverseString); rtl::static_method reverse_string = reverseString.value() @@ -294,7 +294,7 @@ namespace rtl_tests auto exp_str = std::string(StrStatic::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref).append(SUFFIX_static); EXPECT_EQ(ret_str, exp_str); } { - std::optional reverseString = optStringUtil->getMethod(str_revStrRValueRefArg); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrRValueRefArg::id); ASSERT_TRUE(reverseString); rtl::static_method reverse_string = reverseString.value() @@ -314,7 +314,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValRef); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrOverloadValRef::id); ASSERT_TRUE(reverseString); { rtl::static_method reverse_string = reverseString.value() @@ -344,7 +344,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValCRef); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrOverloadValCRef::id); ASSERT_TRUE(reverseString); { rtl::static_method reverse_string = reverseString.value() diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnAndTargetErased_ConstMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnAndTargetErased_ConstMethod.cpp index 3a125e5c..321b1ec1 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnAndTargetErased_ConstMethod.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnAndTargetErased_ConstMethod.cpp @@ -22,7 +22,7 @@ namespace rtl_tests EXPECT_EQ(err, rtl::error::None); EXPECT_TRUE(!robj.isEmpty()); - std::optional oReverseString = recStrConstOverload->getMethod(str_reverseString); + std::optional oReverseString = recStrConstOverload->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(oReverseString); // Both const & non-const overloads are present for this method. diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp index 1bc09ef0..9c56a227 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Function.cpp @@ -45,7 +45,7 @@ namespace rtl_tests TEST(ReturnErased_Function, implicit_resolutions_to_call_by_value_overloads) { - auto reverseStrOpt = cxx::mirror().getFunction(str_reverseString); + auto reverseStrOpt = cxx::mirror().getFunction(cxx::fn::reverseString::id); ASSERT_TRUE(reverseStrOpt); EXPECT_FALSE(reverseStrOpt->hasSignature()); { @@ -203,7 +203,7 @@ namespace rtl_tests TEST(ReturnErased_Function, implicit_resolution_to_ambiguous_lvalue_and_cref_overload) { - auto revStrOverloadValCRefOpt = cxx::mirror().getFunction(str_revStrOverloadValCRef); + auto revStrOverloadValCRefOpt = cxx::mirror().getFunction(cxx::fn::revStrOverloadValCRef::id); ASSERT_TRUE(revStrOverloadValCRefOpt); EXPECT_FALSE(revStrOverloadValCRefOpt->hasSignature()); @@ -247,7 +247,7 @@ namespace rtl_tests TEST(ReturnErased_Function, explicit_resolution_to_ambiguous_lvalue_and_cref_overload) { - auto revStrOverloadValCRefOpt = cxx::mirror().getFunction(str_revStrOverloadValCRef); + auto revStrOverloadValCRefOpt = cxx::mirror().getFunction(cxx::fn::revStrOverloadValCRef::id); ASSERT_TRUE(revStrOverloadValCRefOpt); EXPECT_FALSE(revStrOverloadValCRefOpt->hasSignature()); @@ -284,7 +284,7 @@ namespace rtl_tests TEST(ReturnErased_Function, implicit_resolution_to_ambiguous_lvalue_and_ref_overload) { - auto revStrOverloadValRefOpt = cxx::mirror().getFunction(str_revStrOverloadValRef); + auto revStrOverloadValRefOpt = cxx::mirror().getFunction(cxx::fn::revStrOverloadValRef::id); ASSERT_TRUE(revStrOverloadValRefOpt); EXPECT_FALSE(revStrOverloadValRefOpt->hasSignature()); @@ -324,7 +324,7 @@ namespace rtl_tests TEST(ReturnErased_Function, explicit_resolution_to_ambiguous_lvalue_and_ref_overload) { - auto revStrOverloadValRefOpt = cxx::mirror().getFunction(str_revStrOverloadValRef); + auto revStrOverloadValRefOpt = cxx::mirror().getFunction(cxx::fn::revStrOverloadValRef::id); ASSERT_TRUE(revStrOverloadValRefOpt); EXPECT_FALSE(revStrOverloadValRefOpt->hasSignature()); @@ -359,7 +359,7 @@ namespace rtl_tests TEST(ReturnErased_Function, calling_non_overloaded_non_const_ref_argument) { - auto revStrNonConstRefArgOpt = cxx::mirror().getFunction(str_revStrNonConstRefArg); + auto revStrNonConstRefArgOpt = cxx::mirror().getFunction(cxx::fn::revStrNonConstRefArg::id); ASSERT_TRUE(revStrNonConstRefArgOpt); EXPECT_FALSE(revStrNonConstRefArgOpt->hasSignature()); @@ -402,7 +402,7 @@ namespace rtl_tests TEST(ReturnErased_Function, calling_non_overloaded_const_ref_argument) { - auto revStrConstRefArgOpt = cxx::mirror().getFunction(str_revStrConstRefArg); + auto revStrConstRefArgOpt = cxx::mirror().getFunction(cxx::fn::revStrConstRefArg::id); ASSERT_TRUE(revStrConstRefArgOpt); EXPECT_FALSE(revStrConstRefArgOpt->hasSignature()); @@ -451,7 +451,7 @@ namespace rtl_tests TEST(ReturnErased_Function, calling_non_overloaded_rvalue_ref_argument) { - auto revStrRValueRefArgOpt = cxx::mirror().getFunction(str_revStrRValueRefArg); + auto revStrRValueRefArgOpt = cxx::mirror().getFunction(cxx::fn::revStrRValueRefArg::id); ASSERT_TRUE(revStrRValueRefArgOpt); EXPECT_FALSE(revStrRValueRefArgOpt->hasSignature()); diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Method.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Method.cpp index 20cf969f..b7ec1d52 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Method.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Method.cpp @@ -47,7 +47,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseStrOpt = optStringUtil->getMethod(str_reverseString); + std::optional reverseStrOpt = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseStrOpt); EXPECT_FALSE(reverseStrOpt->hasSignature()); { @@ -220,7 +220,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrOverloadValCRef); + std::optional reverseStrOpt = optStringUtil->getMethod(cxx::fn::revStrOverloadValCRef::id); ASSERT_TRUE(reverseStrOpt); EXPECT_FALSE(reverseStrOpt->hasSignature()); @@ -270,7 +270,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrOverloadValCRef); + std::optional reverseStrOpt = optStringUtil->getMethod(cxx::fn::revStrOverloadValCRef::id); ASSERT_TRUE(reverseStrOpt); EXPECT_FALSE(reverseStrOpt->hasSignature()); @@ -313,7 +313,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrOverloadValRef); + std::optional reverseStrOpt = optStringUtil->getMethod(cxx::fn::revStrOverloadValRef::id); ASSERT_TRUE(reverseStrOpt); EXPECT_FALSE(reverseStrOpt->hasSignature()); @@ -360,7 +360,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrOverloadValRef); + std::optional reverseStrOpt = optStringUtil->getMethod(cxx::fn::revStrOverloadValRef::id); ASSERT_TRUE(reverseStrOpt); EXPECT_FALSE(reverseStrOpt->hasSignature()); @@ -402,7 +402,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrNonConstRefArg); + std::optional reverseStrOpt = optStringUtil->getMethod(cxx::fn::revStrNonConstRefArg::id); ASSERT_TRUE(reverseStrOpt); EXPECT_FALSE(reverseStrOpt->hasSignature()); @@ -450,7 +450,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrConstRefArg); + std::optional reverseStrOpt = optStringUtil->getMethod(cxx::fn::revStrConstRefArg::id); ASSERT_TRUE(reverseStrOpt); EXPECT_FALSE(reverseStrOpt->hasSignature()); @@ -505,7 +505,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrRValueRefArg); + std::optional reverseStrOpt = optStringUtil->getMethod(cxx::fn::revStrRValueRefArg::id); ASSERT_TRUE(reverseStrOpt); EXPECT_FALSE(reverseStrOpt->hasSignature()); diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_StaticMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_StaticMethod.cpp index afbc3106..98f9eeea 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_StaticMethod.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_StaticMethod.cpp @@ -20,7 +20,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); // has only static-methods. ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::method reverse_string = reverseString.value() @@ -48,7 +48,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); // doesn't have any static-methods. ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); rtl::static_method reverse_string = reverseString.value() @@ -64,7 +64,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); // doesn't have any static-methods. ASSERT_TRUE(optStringUtil); - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::static_method reverse_string = reverseString.value() @@ -86,7 +86,7 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); ASSERT_TRUE(optStringUtil); - std::optional reverseStrOpt = optStringUtil->getMethod(str_reverseString); + std::optional reverseStrOpt = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseStrOpt); EXPECT_FALSE(reverseStrOpt->hasSignature()); auto str = std::string(STRA);