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/CxxTestRegistration/inc/TestMirrorProvider.h b/CxxTestRegistration/inc/TestMirrorProvider.h index ee792140..a825f3de 100644 --- a/CxxTestRegistration/inc/TestMirrorProvider.h +++ b/CxxTestRegistration/inc/TestMirrorProvider.h @@ -1,18 +1,16 @@ #pragma once #include -#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_view pRecordName); +}; diff --git a/CxxTestRegistration/inc/reg_decls.h b/CxxTestRegistration/inc/reg_decls.h new file mode 100644 index 00000000..5ca210c0 --- /dev/null +++ b/CxxTestRegistration/inc/reg_decls.h @@ -0,0 +1,117 @@ +/***************************************************************************** + * * + * 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 + +#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..0f6bb7be --- /dev/null +++ b/CxxTestRegistration/inc/reg_ids.h @@ -0,0 +1,916 @@ +/***************************************************************************** + * * + * 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 +#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/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/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 e7fd4bd8..271a36ed 100644 --- a/CxxTestRegistration/src/CMakeLists.txt +++ b/CxxTestRegistration/src/CMakeLists.txt @@ -4,32 +4,26 @@ 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" - - "${PROJECT_SOURCE_DIR}/inc/rtcl_meta_ids.h" ) # Add any additional source files if needed 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..f07acb5f 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_view 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..e6bd2bd5 --- /dev/null +++ b/CxxTestRegistration/src/regs0_Animal.cpp @@ -0,0 +1,84 @@ +/***************************************************************************** + * * + * 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" +#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)); + + /* 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(static_cast(&Animal::setAnimalName))); + + fns.push_back(rtl::type().member() + .method(cxx::type::Animal::fn::setAnimalName::id) + .build(static_cast(&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)); + + /* 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(static_cast(&Animal::updateZooKeeper))); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::Animal::fn::updateZooKeeper::id) + .build(static_cast(&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..bb5fefc9 --- /dev/null +++ b/CxxTestRegistration/src/regs10_Complex.cpp @@ -0,0 +1,45 @@ +/***************************************************************************** + * * + * 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" +#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..889553c9 --- /dev/null +++ b/CxxTestRegistration/src/regs11_StringConst.cpp @@ -0,0 +1,106 @@ +/***************************************************************************** + * * + * 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" +#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)); + + /* 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))); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::reverseString::id) + .build(static_cast(&StrConst::reverseString))); + + fns.push_back(rtl::type().member() + .methodConst(cxx::type::StrConst::fn::reverseString::id) + .build(static_cast(&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)); + } +} \ No newline at end of file diff --git a/CxxTestRegistration/src/regs1_Date.cpp b/CxxTestRegistration/src/regs1_Date.cpp new file mode 100644 index 00000000..a9db0755 --- /dev/null +++ b/CxxTestRegistration/src/regs1_Date.cpp @@ -0,0 +1,116 @@ +/***************************************************************************** + * * + * 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" +#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..63772287 --- /dev/null +++ b/CxxTestRegistration/src/regs2_Book.cpp @@ -0,0 +1,79 @@ +/***************************************************************************** + * * + * 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" +#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..51795c6e --- /dev/null +++ b/CxxTestRegistration/src/regs3_Person.cpp @@ -0,0 +1,95 @@ +/***************************************************************************** + * * + * 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" +#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..86e430c9 --- /dev/null +++ b/CxxTestRegistration/src/regs4_StringMute.cpp @@ -0,0 +1,107 @@ +/***************************************************************************** + * * + * 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" +#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)); + + /* 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))); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::reverseString::id) + .build(static_cast(&StrMute::reverseString))); + + fns.push_back(rtl::type().member() + .method(cxx::type::StrMute::fn::reverseString::id) + .build(static_cast(&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..81e7bd8d --- /dev/null +++ b/CxxTestRegistration/src/regs5_StringStatic.cpp @@ -0,0 +1,107 @@ +/***************************************************************************** + * * + * 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" +#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)); + + /* 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(static_cast(&StrStatic::reverseString))); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::reverseString::id) + .build(static_cast(&StrStatic::reverseString))); + + fns.push_back(rtl::type().member() + .methodStatic(cxx::type::StrStatic::fn::reverseString::id) + .build(static_cast(&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..733170fa --- /dev/null +++ b/CxxTestRegistration/src/regs6_StringConstOverload.cpp @@ -0,0 +1,44 @@ +/***************************************************************************** + * * + * 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" +#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..a9034131 --- /dev/null +++ b/CxxTestRegistration/src/regs7_StringOps.cpp @@ -0,0 +1,87 @@ +/***************************************************************************** + * * + * 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" +#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)); + + /* 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(static_cast(&reverseString))); + + 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)); + + 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..06d7c319 --- /dev/null +++ b/CxxTestRegistration/src/regs8_StringWrap.cpp @@ -0,0 +1,106 @@ +/***************************************************************************** + * * + * 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" +#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..9ff81d5a --- /dev/null +++ b/CxxTestRegistration/src/regs9_Library.cpp @@ -0,0 +1,53 @@ +/***************************************************************************** + * * + * 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" +#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..3a527ea0 100755 --- a/CxxTestUtils/inc/GlobalTestUtils.h +++ b/CxxTestUtils/inc/GlobalTestUtils.h @@ -13,46 +13,32 @@ 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 = "revStrOverloadValRefAndCRef"; + 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 constexpr const char* str_getComplexNumAsString = "getComplexNumAsString"; + inline constexpr std::string_view SUFFIX_std_string = "_std::string"; - 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 SUFFIX_std_string_ptr = "_std::string*"; + inline constexpr std::string_view SUFFIX_std_string_cptr = "_const_std::string*"; - 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_std_string_lvref = "_std::string&"; + inline constexpr std::string_view SUFFIX_std_string_clvref = "_const_std::string&"; - static const char* SUFFIX_std_string = "_std::string"; + inline constexpr std::string_view SUFFIX_std_string_rvref = "_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 REV_STR_VOID_RET = "func_reverseString(void)->[return_str]"; - static const char* SUFFIX_std_string_lvref = "_std::string&"; - static const char* SUFFIX_std_string_clvref = "_const_std::string&"; - - static const char* SUFFIX_std_string_rvref = "_std::string&&"; - - static const char* 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/CxxTestUtils/inc/TestUtilsAnimal.h b/CxxTestUtils/inc/TestUtilsAnimal.h index cab364e2..aefbd1f0 100644 --- a/CxxTestUtils/inc/TestUtilsAnimal.h +++ b/CxxTestUtils/inc/TestUtilsAnimal.h @@ -20,15 +20,9 @@ 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 const bool assert_zero_instance_count(); diff --git a/CxxTestUtils/inc/TestUtilsBook.h b/CxxTestUtils/inc/TestUtilsBook.h index 1b380af2..e7aebc69 100644 --- a/CxxTestUtils/inc/TestUtilsBook.h +++ b/CxxTestUtils/inc/TestUtilsBook.h @@ -16,31 +16,18 @@ 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 const bool assert_zero_instance_count(); }; 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 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 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 452efcb2..504f0753 100644 --- a/CxxTestUtils/inc/TestUtilsDate.h +++ b/CxxTestUtils/inc/TestUtilsDate.h @@ -15,23 +15,12 @@ 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 const bool assert_zero_instance_count(); static const std::size_t get_instance_count(); }; 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(); @@ -43,12 +32,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 const char* struct_ = "nsdate::Date"; - static constexpr const char* str_updateDate = "updateDate"; - static constexpr const char* str_getAsString = "getAsString"; + 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..5c029bde 100644 --- a/CxxTestUtils/inc/TestUtilsPerson.h +++ b/CxxTestUtils/inc/TestUtilsPerson.h @@ -17,19 +17,10 @@ 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 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/CxxMirrorTests/CxxMirrorThreadingTest.cpp b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp index e38f677d..dbcbc3a0 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" @@ -30,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"; @@ -43,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"; @@ -58,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"; @@ -77,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"; @@ -125,19 +127,19 @@ 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(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), @@ -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"; @@ -218,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"; @@ -255,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().methodConst(animal::str_getFamilyName).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::setFamilyName), - rtl::type().member().methodStatic(animal::str_updateZooKeeper).build(&Animal::updateZooKeeper), + rtl::type().member().methodConst(cxx::type::Animal::fn::getFamilyName::id).build(&Animal::getFamilyName), - #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. + rtl::type().member().method(cxx::type::Animal::fn::setAnimalName::id).build(&Animal::setAnimalName), - rtl::type().member() - .method(animal::str_setAnimalName) - .build(static_cast(&Animal::setAnimalName)), //overloaded method, taking rvalue reference as argument. + rtl::type().member().methodStatic(cxx::type::Animal::fn::updateZooKeeper::id).build(&Animal::updateZooKeeper), - rtl::type().member() - .methodStatic(animal::str_updateZooKeeper) - .build(static_cast(&Animal::updateZooKeeper)), //static 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::setAnimalName::id) + .build(static_cast(&Animal::setAnimalName)), //overloaded 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() + .method(cxx::type::Animal::fn::setAnimalName::id) + .build(static_cast(&Animal::setAnimalName)), //overloaded method, taking rvalue reference as argument. - 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 non-const lvalue reference as argument. - rtl::type().member() - .methodStatic(animal::str_updateZooKeeper) - .build(&Animal::updateZooKeeper), + 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() - .methodStatic(animal::str_updateZooKeeper) - .build(&Animal::updateZooKeeper) - #endif }); std::cout << "\n [t3]\trtl_tests::InitMirror::reflectingAnimal() ==> Done.\n"; diff --git a/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp index d3edf5b8..97017bec 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(std::string(rtcl::type::Book::id)); + optional classBook = cxx::mirror().getRecord(cxx::type::Book::id); ASSERT_TRUE(classBook); auto [err0, book] = classBook->ctorT<>()(alloc::Heap); @@ -83,14 +84,14 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - optional oSetAuthor = classBook->getMethod(std::string(rtcl::type::Book::method::setAuthor)); + optional oSetAuthor = classBook->getMethod(cxx::type::Book::fn::setAuthor::id); ASSERT_TRUE(oSetAuthor); EXPECT_FALSE(oSetAuthor->hasSignature()); 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()); @@ -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); @@ -112,14 +113,14 @@ 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()); 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()); @@ -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); @@ -141,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. @@ -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); @@ -173,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. @@ -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); @@ -205,14 +206,14 @@ 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()); 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()); @@ -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); @@ -234,14 +235,14 @@ 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()); 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()); @@ -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); @@ -263,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. @@ -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); @@ -292,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. @@ -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); @@ -321,14 +322,14 @@ 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())); 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()); @@ -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); @@ -352,14 +353,14 @@ 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())); 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()); @@ -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); @@ -383,14 +384,14 @@ 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())); 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()); @@ -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); @@ -414,14 +415,14 @@ 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())); 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()); @@ -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); @@ -445,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()); @@ -454,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()); @@ -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); @@ -478,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())); @@ -487,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()); @@ -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); @@ -511,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())); @@ -524,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()); @@ -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); @@ -548,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())); @@ -561,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 65010391..656979b4 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp @@ -11,36 +11,36 @@ using namespace std; using namespace rtl; using namespace test_utils; -using namespace test_mirror; + 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); 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()); 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()); @@ -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()); @@ -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()); } @@ -85,13 +85,13 @@ 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); + 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()); @@ -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); + 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()); @@ -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()); } @@ -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<>()); @@ -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::setAnimalName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -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 5ae96280..d98a7f0f 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 { @@ -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,11 +95,11 @@ 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(); - 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()); @@ -113,11 +113,11 @@ 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(); - 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()); @@ -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); @@ -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,11 +275,11 @@ 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(); - 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()); @@ -295,11 +295,11 @@ 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(); - 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()); @@ -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 1113fbf8..aec4602c 100644 --- a/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp @@ -10,14 +10,14 @@ using namespace std; using namespace rtl; using namespace test_utils; -using namespace test_mirror; + 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,30 +111,30 @@ 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(); - 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()); { - 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(); - auto [err, ret] = setAuthor(book)(book::AUTHOR); + auto [err, ret] = setAuthor(book)(book::AUTHOR.data()); 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(); - auto [err, ret] = setDescription(book)(book::DESCRIPTION); + auto [err, ret] = setDescription(book)(book::DESCRIPTION.data()); EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } @@ -156,30 +156,30 @@ 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(); - 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()); { - 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(); - auto [err, ret] = setAuthor(book)(book::AUTHOR); + auto [err, ret] = setAuthor(book)(book::AUTHOR.data()); 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(); - auto [err, ret] = setDescription(book)(book::DESCRIPTION); + auto [err, ret] = setDescription(book)(book::DESCRIPTION.data()); EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } @@ -201,30 +201,30 @@ 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(); - 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()); { - 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(); - auto [err, ret] = setAuthor(book)(book::AUTHOR); + auto [err, ret] = setAuthor(book)(book::AUTHOR.data()); 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(); - auto [err, ret] = setDescription(book)(book::DESCRIPTION); + auto [err, ret] = setDescription(book)(book::DESCRIPTION.data()); EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } @@ -246,30 +246,30 @@ 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(); - 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()); { - 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(); - auto [err, ret] = setAuthor(book)(book::AUTHOR); + auto [err, ret] = setAuthor(book)(book::AUTHOR.data()); 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(); - auto [err, ret] = setDescription(book)(book::DESCRIPTION); + auto [err, ret] = setDescription(book)(book::DESCRIPTION.data()); EXPECT_TRUE(err == error::None); EXPECT_TRUE(ret.isEmpty()); } @@ -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,16 +345,16 @@ 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(); 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)); @@ -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,16 +426,16 @@ 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(); 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)); @@ -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,16 +507,16 @@ 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(); 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)); @@ -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,16 +588,16 @@ 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(); 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/MoveConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp index 2695339b..673a6f1a 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 { @@ -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 @@ -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(); @@ -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/NameSpaceGlobalsTests.cpp b/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp index 061305d1..fea71c88 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 { @@ -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<>(); @@ -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<>(); @@ -212,25 +212,25 @@ 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()); 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', //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()); 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/PerfectForwardingTests.cpp b/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp index bb743143..a502b27a 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 { @@ -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::setAnimalName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for an R-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -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()); @@ -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::setAnimalName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a non-const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -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()); @@ -125,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. @@ -134,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::setAnimalName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -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()); @@ -169,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. @@ -178,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::setAnimalName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for an R-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -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()); @@ -211,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. @@ -220,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::setAnimalName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a non-const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -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()); @@ -253,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. @@ -262,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::setAnimalName::id); ASSERT_TRUE(oSetAnimalName); // Verify that the method has the correct signature for a const L-value reference. EXPECT_TRUE((oSetAnimalName->hasSignature())); @@ -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()); @@ -289,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(); @@ -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()); @@ -323,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(); @@ -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()); @@ -353,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(); @@ -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/ReflectionOpErrorCodeTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp index 809b78d6..99ea8e42 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 { @@ -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); @@ -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. @@ -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. @@ -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. @@ -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); @@ -303,17 +303,17 @@ 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(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(); @@ -331,17 +331,17 @@ 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(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(); diff --git a/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp b/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp index 1f594f0c..dbc7f1dc 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp @@ -6,14 +6,14 @@ #include "TestUtilsDate.h" using namespace test_utils; -using namespace test_mirror; + 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); @@ -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<>(); @@ -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. diff --git a/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp b/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp index a9e80956..7cc62c76 100644 --- a/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp @@ -9,16 +9,16 @@ using namespace std; using namespace rtl; using namespace test_utils; -using namespace test_mirror; + 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(); @@ -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()); @@ -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())); @@ -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 3603a545..59d4ae83 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<>() @@ -49,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() @@ -78,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() @@ -106,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() @@ -115,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() @@ -125,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); } } @@ -136,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. @@ -146,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. @@ -159,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. @@ -172,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. @@ -185,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); } } @@ -200,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() @@ -210,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); } } { @@ -237,8 +241,8 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrConst target; - std::string str = STRA; - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::string str(STRA); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::const_method reverse_string = reverseString->targetT() @@ -247,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() @@ -256,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); } } @@ -297,9 +301,9 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrConst target; - std::string str = STRA; + 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() @@ -310,10 +314,10 @@ 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); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrNonConstRefArg::id); ASSERT_TRUE(reverseString); rtl::const_method reverse_string = reverseString->targetT() @@ -324,10 +328,10 @@ 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); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrRValueRefArg::id); ASSERT_TRUE(reverseString); rtl::const_method reverse_string = reverseString->targetT() @@ -337,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); } } @@ -349,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() @@ -358,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() @@ -369,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); } } @@ -381,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() @@ -390,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() @@ -399,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); } } @@ -411,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() @@ -421,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() @@ -430,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 f59e35db..803fd5c2 100644 --- a/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp @@ -8,16 +8,16 @@ using namespace test_utils; -using namespace test_mirror; + 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(); @@ -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(); @@ -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); } } @@ -137,23 +137,23 @@ 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(); 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); } } @@ -161,14 +161,14 @@ 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(); 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,22 +179,22 @@ 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::string str(STRA); + std::optional reverseString = cxx::mirror().getFunction(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { 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_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,19 +202,19 @@ 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); + std::optional reverseString = cxx::mirror().getFunction(cxx::fn::revStrConstRefArg::id); ASSERT_TRUE(reverseString); 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_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); + std::optional reverseString = cxx::mirror().getFunction(cxx::fn::revStrNonConstRefArg::id); ASSERT_TRUE(reverseString); rtl::function reverse_string = reverseString->argsT().returnT(); @@ -222,17 +222,17 @@ 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); + std::optional reverseString = cxx::mirror().getFunction(cxx::fn::revStrRValueRefArg::id); ASSERT_TRUE(reverseString); rtl::function reverse_string = reverseString->argsT().returnT(); 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); } } @@ -240,14 +240,14 @@ 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(); 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); } } @@ -263,21 +263,21 @@ 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(); 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 8013e060..dbaa790b 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 { @@ -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() @@ -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); } } @@ -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 @@ -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); } } @@ -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() @@ -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,8 +199,8 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrMute target; - std::string str = STRA; - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::string str(STRA); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::method reverse_string = reverseString->targetT() @@ -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,9 +230,9 @@ namespace rtl_tests ASSERT_TRUE(optStringUtil); StrMute target; - std::string str = STRA; + 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() @@ -241,10 +241,10 @@ 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); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrNonConstRefArg::id); ASSERT_TRUE(reverseString); rtl::method reverse_string = reverseString->targetT() @@ -254,10 +254,10 @@ 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); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrRValueRefArg::id); ASSERT_TRUE(reverseString); rtl::method reverse_string = reverseString->targetT() @@ -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); } } @@ -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() @@ -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); } } @@ -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() @@ -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 b8009f6d..d3a69ba0 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 { @@ -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() @@ -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); } } @@ -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 @@ -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); } } @@ -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() @@ -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,8 +237,8 @@ namespace rtl_tests std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); ASSERT_TRUE(optStringUtil); - std::string str = STRA; - std::optional reverseString = optStringUtil->getMethod(str_reverseString); + std::string str(STRA); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id); ASSERT_TRUE(reverseString); { rtl::static_method reverse_string = reverseString.value() @@ -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,9 +267,9 @@ 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); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrConstRefArg::id); ASSERT_TRUE(reverseString); rtl::static_method reverse_string = reverseString.value() @@ -278,10 +278,10 @@ 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); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrNonConstRefArg::id); ASSERT_TRUE(reverseString); rtl::static_method reverse_string = reverseString.value() @@ -291,10 +291,10 @@ 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); + std::optional reverseString = optStringUtil->getMethod(cxx::fn::revStrRValueRefArg::id); ASSERT_TRUE(reverseString); rtl::static_method reverse_string = reverseString.value() @@ -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); } } @@ -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() @@ -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); } } @@ -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() @@ -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/ReturnAndTargetErased_ConstMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnAndTargetErased_ConstMethod.cpp index a68000d9..321b1ec1 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 { @@ -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. @@ -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 4957d63c..bf3dfd04 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 { @@ -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 2cfd9420..9c56a227 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'. @@ -45,19 +45,20 @@ 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()); { + 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,24 +69,24 @@ 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()); 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); + 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(STRA_REVERSE) + SUFFIX_const_char_ptr; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_const_char_ptr); EXPECT_EQ(retStr, expStr); } } @@ -94,24 +95,24 @@ 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()); 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); + 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(STRA_REVERSE) + SUFFIX_std_string; + std::string expStr = std::string(STRA_REVERSE).append(SUFFIX_std_string); EXPECT_EQ(retStr, expStr); } } @@ -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); @@ -128,10 +129,10 @@ 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; + std::string str(STRA); auto [err, robj] = reverseString.bind()(&str); EXPECT_EQ(err, rtl::error::None); @@ -139,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); } } @@ -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); @@ -156,10 +157,10 @@ 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; + const std::string str(STRA); auto [err, robj] = reverseString.bind()(&str); EXPECT_EQ(err, rtl::error::None); @@ -167,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); } } @@ -183,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()(); @@ -193,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); } } @@ -202,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()); @@ -227,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. @@ -238,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); } } @@ -246,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()); @@ -270,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); @@ -283,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()); @@ -305,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. @@ -315,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); } } @@ -323,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()); @@ -346,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); @@ -358,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()); @@ -393,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); } } @@ -401,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()); @@ -424,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. @@ -435,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. @@ -450,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()); @@ -473,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); } } @@ -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()); @@ -534,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. @@ -548,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); } } diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Method.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedInvocationTests/ReturnErased_Method.cpp index c2fb873e..b7ec1d52 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 { @@ -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()); { @@ -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); } } @@ -219,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()); @@ -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); } } @@ -269,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()); @@ -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); @@ -312,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()); @@ -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); } } @@ -359,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()); @@ -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); @@ -401,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()); @@ -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); } } @@ -449,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()); @@ -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. @@ -504,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()); @@ -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 c75d8796..98f9eeea 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 { @@ -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,9 +86,10 @@ 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); { 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()); } 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); }