Skip to content

Commit 8a165a8

Browse files
committed
removed logical namespace grouping.
1 parent f4a2620 commit 8a165a8

25 files changed

+95
-173
lines changed

CxxTestRegistration/src/CalenderRegistration.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ namespace test_mirror
3939
.build(&nsdate::Calender::getSavedDate));
4040

4141
// class Calender, registering after the methods. (order doesn't matter)
42-
fns.push_back(rtl::type().ns(date::ns)
43-
.record<nsdate::Calender>(calender::struct_)
42+
fns.push_back(rtl::type().record<nsdate::Calender>(calender::struct_)
4443
.build());
4544
}
4645
}

CxxTestRegistration/src/ComplexRegistration.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,13 @@ namespace test_mirror
1818
/* Grouping functions under a namespace, which is optional. they can be registered without it as well.
1919
but if registered under namspace, then to retrieve it from CxxMirror object, namespace name must be passed,
2020
e.g. cxx::mirror().getFunction("namespace_name", "function_name") & cxx::mirror().getRecord("namespace_name", "record_name") */
21-
fns.push_back(rtl::type().ns(str_complex)
22-
.function(str_setReal)
21+
fns.push_back(rtl::type().function(str_setReal)
2322
.build(complex::setReal));
2423

25-
fns.push_back(rtl::type().ns(str_complex)
26-
.function(str_setImaginary)
24+
fns.push_back(rtl::type().function(str_setImaginary)
2725
.build(complex::setImaginary));
2826

29-
fns.push_back(rtl::type().ns(str_complex)
30-
.function(str_getMagnitude)
27+
fns.push_back(rtl::type().function(str_getMagnitude)
3128
.build(complex::getMagnitude));
3229
}
3330
}

CxxTestRegistration/src/DateRegistration.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ namespace test_mirror
1818
{
1919
// Constructors registration, class/struct name and type must be passed 'record<TYPE>("NAME")'.
2020
// Registers default constructor with implicit registration of destructor & copy-constructor.
21-
fns.push_back(rtl::type().ns(date::ns)
22-
.record<nsdate::Date>(date::struct_)
21+
fns.push_back(rtl::type().record<nsdate::Date>(date::struct_)
2322
.build());
2423

2524
// Overloaded constructor, taking 'string' as argument, signature must be specified as template parameter.

CxxTestRegistration/src/EventRegistration.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ namespace test_mirror
1818
{
1919
// Registering 'Event' for reflection; instance creation via reflection fails since its default constructor is private or deleted.
2020
// At least one member must be registered for RTL to recognize the type. be it property, member-function or constructor.
21-
fns.push_back(rtl::type().ns(event::ns)
22-
.record<nsdate::Event>(event::struct_)
21+
fns.push_back(rtl::type().record<nsdate::Event>(event::struct_)
2322
.build());
2423

2524
fns.push_back(rtl::type().member<nsdate::Event>()

CxxTestRegistration/src/PodStdRegistration.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace test_mirror
99
{
1010
id.insert(std::make_pair("int", rtl::traits::uid<int>::value));
1111
id.insert(std::make_pair("char", rtl::traits::uid<char>::value));
12-
id.insert(std::make_pair("string", rtl::traits::uid<std::string>::value));
13-
id.insert(std::make_pair("string_view", rtl::traits::uid<std::string_view>::value));
12+
id.insert(std::make_pair("std::string", rtl::traits::uid<std::string>::value));
13+
id.insert(std::make_pair("std::string_view", rtl::traits::uid<std::string_view>::value));
1414
}
1515

1616
void Register::stdTypes(std::vector<rtl::Function>& fns)
@@ -33,8 +33,7 @@ namespace test_mirror
3333
fns.push_back(rtl::type().record<char>("char")
3434
.build());
3535

36-
fns.push_back(rtl::type().ns("std")
37-
.record<std::string_view>("string_view")
36+
fns.push_back(rtl::type().record<std::string_view>("std::string_view")
3837
.build());
3938

4039
// Registers std::string class
@@ -49,8 +48,7 @@ namespace test_mirror
4948
.methodConst<void>("empty")
5049
.build(&std::string::empty));
5150

52-
fns.push_back(rtl::type().ns("std")
53-
.record<std::string>("string")
51+
fns.push_back(rtl::type().record<std::string>("std::string")
5452
.build());
5553

5654
fns.push_back(rtl::type().member<std::string>()

CxxTestUtils/inc/GlobalTestUtils.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ namespace test_utils {
2929

3030
static constexpr const char* str_getComplexNumAsString = "getComplexNumAsString";
3131

32-
static constexpr const char* str_complex = "complex";
33-
static constexpr const char* str_setReal = "setReal";
34-
35-
static constexpr const char* str_setImaginary = "setImaginary";
36-
static constexpr const char* str_getMagnitude = "getMagnitude";
32+
static constexpr const char* str_setReal = "complex::setReal";
33+
static constexpr const char* str_setImaginary = "complex::setImaginary";
34+
static constexpr const char* str_getMagnitude = "complex::getMagnitude";
3735

3836
static const char* SUFFIX_void = "_void";
3937
static const char* SUFFIX_ctor = "_ctor";

CxxTestUtils/inc/TestUtilsDate.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ namespace test_utils
1515
{
1616
struct event
1717
{
18-
static constexpr const char* ns = "nsdate";
19-
static constexpr const char* struct_ = "Event";
18+
static constexpr const char* struct_ = "nsdate::Event";
2019
static constexpr const char* str_getDate = "getDate";
2120
static constexpr const char* str_reset = "reset";
2221

@@ -26,8 +25,7 @@ namespace test_utils
2625

2726
struct calender
2827
{
29-
static constexpr const char* ns = "nsdate";
30-
static constexpr const char* struct_ = "Calender";
28+
static constexpr const char* struct_ = "nsdate::Calender";
3129
static constexpr const char* str_create = "create";
3230
static constexpr const char* str_getTheDate = "getTheDate";
3331
static constexpr const char* str_getSavedDate = "getSavedDate";
@@ -48,8 +46,7 @@ namespace test_utils
4846
static constexpr const char* DATE_STR0 = "23/12/2024";
4947
static constexpr const char* DATE_STR1 = "04/05/2025";
5048

51-
static constexpr const char* ns = "nsdate";
52-
static constexpr const char* struct_ = "Date";
49+
static constexpr const char* struct_ = "nsdate::Date";
5350
static constexpr const char* str_updateDate = "updateDate";
5451
static constexpr const char* str_getAsString = "getAsString";
5552

RTLTestRunApp/src/CxxMirrorTests/CxxMirrorObjectTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ namespace rtl_tests
262262
// (one global, one inside namespace "std").
263263
// Both functions wrap the same function-pointer, so their FunctorIds match.
264264
rtl::type().function("strlen").build(strlen),
265-
rtl::type().ns("std").function("strlen").build(std::strlen)
265+
rtl::type().function("std::strlen").build(std::strlen)
266266
});
267267

268268
// Lookup global function "strlen".
@@ -290,7 +290,7 @@ namespace rtl_tests
290290
}
291291

292292
// Lookup namespaced function "std::strlen".
293-
std::optional<rtl::Function> stdStrLen = cxxMirror.getFunction("std", "strlen");
293+
std::optional<rtl::Function> stdStrLen = cxxMirror.getFunction("std::strlen");
294294
ASSERT_TRUE(stdStrLen);
295295
{
296296
auto strlen_fn = stdStrLen->argsT<const char*>().returnT<>();

RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace rtl_tests
3030
{
3131
auto _ = rtl::CxxMirror({
3232

33-
rtl::type().ns(event::ns).record<nsdate::Event>(event::struct_).build(),
33+
rtl::type().record<nsdate::Event>(event::struct_).build(),
3434

3535
rtl::type().member<nsdate::Event>().method(event::str_reset).build(&nsdate::Event::reset),
3636
});
@@ -58,7 +58,7 @@ namespace rtl_tests
5858
{
5959
auto _ = rtl::CxxMirror({
6060

61-
rtl::type().ns(date::ns).record<nsdate::Date>(date::struct_).build(),
61+
rtl::type().record<nsdate::Date>(date::struct_).build(),
6262

6363
rtl::type().member<nsdate::Date>().constructor<std::string>().build(),
6464

@@ -77,7 +77,7 @@ namespace rtl_tests
7777
{
7878
auto _ = rtl::CxxMirror({
7979

80-
rtl::type().ns(date::ns).record<nsdate::Calender>(calender::struct_).build(),
80+
rtl::type().record<nsdate::Calender>(calender::struct_).build(),
8181

8282
rtl::type().member<nsdate::Calender>().methodStatic(calender::str_create).build(&nsdate::Calender::create),
8383

@@ -104,9 +104,9 @@ namespace rtl_tests
104104

105105
rtl::type().record<std::vector<int>>("vector_int").build(),
106106

107-
rtl::type().ns("std").record<std::string>("string").build(),
107+
rtl::type().record<std::string>("std::string").build(),
108108

109-
rtl::type().ns("std").record<std::string_view>("string_view").build(),
109+
rtl::type().record<std::string_view>("std::string_view").build(),
110110

111111
rtl::type().member<std::string>().methodConst("empty").build(&std::string::empty),
112112

@@ -133,19 +133,19 @@ namespace rtl_tests
133133

134134
rtl::type().function(str_getComplexNumAsString).build(getComplexNumAsString),
135135

136-
rtl::type().ns(str_complex).function(str_setReal).build(complex::setReal),
136+
rtl::type().function(str_setReal).build(complex::setReal),
137137

138-
rtl::type().ns(str_complex).function(str_setImaginary).build(complex::setImaginary),
138+
rtl::type().function(str_setImaginary).build(complex::setImaginary),
139139

140-
rtl::type().ns(str_complex).function(str_getMagnitude).build(complex::getMagnitude),
140+
rtl::type().function(str_getMagnitude).build(complex::getMagnitude),
141141

142-
rtl::type().ns("ext").function("sendString").build(my_type::ext::sendString),
142+
rtl::type().function("ext::sendString").build(my_type::ext::sendString),
143143

144-
rtl::type().ns("ext").function<const char*>("sendAsString").build(my_type::ext::sendAsString),
144+
rtl::type().function<const char*>("ext::sendAsString").build(my_type::ext::sendAsString),
145145

146-
rtl::type().ns("ext").function<my_type::Person>("sendAsString").build(my_type::ext::sendAsString),
146+
rtl::type().function<my_type::Person>("ext::sendAsString").build(my_type::ext::sendAsString),
147147

148-
rtl::type().ns("ext").function<my_type::Person&&>("sendAsString").build(my_type::ext::sendAsString)
148+
rtl::type().function<my_type::Person&&>("ext::sendAsString").build(my_type::ext::sendAsString)
149149
});
150150

151151
std::cout << "\n [t9]\trtl_tests::InitMirror::reflectingCStyleFunctions() ==> Done.\n";

RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ namespace rtl_tests
1616
{
1717
TEST(RTLInterfaceCxxMirror, get_record_types_with_wrong_names)
1818
{
19-
optional<Function> badFunc = cxx::mirror().getFunction(date::ns, "wrong_date_struct");
19+
optional<Function> badFunc = cxx::mirror().getFunction("wrong_date_struct");
2020
EXPECT_FALSE(badFunc);
2121

22-
optional<Record> badRec = cxx::mirror().getRecord(date::ns, "wrong" + std::string(date::struct_));
22+
optional<Record> badRec = cxx::mirror().getRecord("wrong" + std::string(date::struct_));
2323
EXPECT_FALSE(badRec);
2424
}
2525

2626

2727
TEST(HeapAllocConstructorDate, wrong_args)
2828
{
2929
{
30-
optional<Record> classDate = cxx::mirror().getRecord(date::ns, date::struct_);
30+
optional<Record> classDate = cxx::mirror().getRecord(date::struct_);
3131
ASSERT_TRUE(classDate);
3232

3333
rtl::constructor<std::string, int> ctorT = classDate->ctorT<std::string, int>();
@@ -44,7 +44,7 @@ namespace rtl_tests
4444
TEST(StackAllocConstructorDate, wrong_args)
4545
{
4646
{
47-
optional<Record> classDate = cxx::mirror().getRecord(date::ns, date::struct_);
47+
optional<Record> classDate = cxx::mirror().getRecord(date::struct_);
4848
ASSERT_TRUE(classDate);
4949

5050
rtl::constructor<std::string, int> ctorT = classDate->ctorT<std::string, int>();
@@ -61,7 +61,7 @@ namespace rtl_tests
6161
TEST(HeapAllocConstructorDate, args_void)
6262
{
6363
{
64-
optional<Record> classDate = cxx::mirror().getRecord(date::ns, date::struct_);
64+
optional<Record> classDate = cxx::mirror().getRecord(date::struct_);
6565
ASSERT_TRUE(classDate);
6666

6767
auto [err, date] = classDate->ctorT()(alloc::Heap);
@@ -78,7 +78,7 @@ namespace rtl_tests
7878
TEST(StackAllocConstructorDate, args_void)
7979
{
8080
{
81-
optional<Record> classDate = cxx::mirror().getRecord(date::ns, date::struct_);
81+
optional<Record> classDate = cxx::mirror().getRecord(date::struct_);
8282
ASSERT_TRUE(classDate);
8383

8484
auto [err, date] = classDate->ctorT()(alloc::Stack);
@@ -95,7 +95,7 @@ namespace rtl_tests
9595
TEST(HeapAllocConstructorDate, args_string)
9696
{
9797
{
98-
optional<Record> classDate = cxx::mirror().getRecord(date::ns, date::struct_);
98+
optional<Record> classDate = cxx::mirror().getRecord(date::struct_);
9999
ASSERT_TRUE(classDate);
100100

101101
rtl::constructor<std::string> ctorT = classDate->ctorT<std::string>();
@@ -113,7 +113,7 @@ namespace rtl_tests
113113
TEST(StackAllocConstructorDate, args_string)
114114
{
115115
{
116-
optional<Record> classDate = cxx::mirror().getRecord(date::ns, date::struct_);
116+
optional<Record> classDate = cxx::mirror().getRecord(date::struct_);
117117
ASSERT_TRUE(classDate);
118118

119119
rtl::constructor<std::string> ctorT = classDate->ctorT<std::string>();
@@ -131,7 +131,7 @@ namespace rtl_tests
131131
TEST(HeapAllocConstructorDate, args_unsigned_unsigned_unsigned)
132132
{
133133
{
134-
optional<Record> classDate = cxx::mirror().getRecord(date::ns, date::struct_);
134+
optional<Record> classDate = cxx::mirror().getRecord(date::struct_);
135135
ASSERT_TRUE(classDate);
136136

137137
auto ctorT = classDate->ctorT<unsigned, unsigned, unsigned>();
@@ -151,7 +151,7 @@ namespace rtl_tests
151151
TEST(StackAllocConstructorDate, args_unsigned_unsigned_unsigned)
152152
{
153153
{
154-
optional<Record> classDate = cxx::mirror().getRecord(date::ns, date::struct_);
154+
optional<Record> classDate = cxx::mirror().getRecord(date::struct_);
155155
ASSERT_TRUE(classDate);
156156

157157
unsigned day = date::DAY;
@@ -175,7 +175,7 @@ namespace rtl_tests
175175
TEST(DestructorDate, non_virtual_on_heap)
176176
{
177177
{
178-
optional<Record> classDate = cxx::mirror().getRecord(date::ns, date::struct_);
178+
optional<Record> classDate = cxx::mirror().getRecord(date::struct_);
179179
ASSERT_TRUE(classDate);
180180

181181
auto [err, date] = classDate->ctorT()(alloc::Heap);
@@ -192,7 +192,7 @@ namespace rtl_tests
192192
TEST(DestructorDate, non_virtual_on_stack)
193193
{
194194
{
195-
optional<Record> classDate = cxx::mirror().getRecord(date::ns, date::struct_);
195+
optional<Record> classDate = cxx::mirror().getRecord(date::struct_);
196196
ASSERT_TRUE(classDate);
197197

198198
auto [err, date] = classDate->ctorT()(alloc::Stack);

0 commit comments

Comments
 (0)