Skip to content

Commit 43df73d

Browse files
authored
Merge pull request #104 from ReflectCxx/develop
Removed logical namespace grouping.
2 parents 89e6c19 + 3c9010a commit 43df73d

39 files changed

+251
-534
lines changed

CxxTestRegistration/src/AnimalRegistration.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ namespace test_mirror
4747
fns.push_back(rtl::type().member<Animal>()
4848
.methodStatic<const std::string&>(animal::str_updateZooKeeper)
4949
.build(&Animal::updateZooKeeper));
50-
51-
#if defined(__GNUC__) && !defined(__clang__)
5250
/*
5351
GCC here fails to automatically resolve the correct overloaded functor
5452
when both a lvalue reference and an rvalue overload exist.
@@ -71,22 +69,5 @@ namespace test_mirror
7169
fns.push_back(rtl::type().member<Animal>()
7270
.methodStatic<std::string&&>(animal::str_updateZooKeeper)
7371
.build(static_cast<std::string(*)(std::string&&)>(&Animal::updateZooKeeper))); //static method, taking rvalue reference as argument.
74-
#else
75-
fns.push_back(rtl::type().member<Animal>()
76-
.method<std::string&>(animal::str_setAnimalName)
77-
.build(&Animal::setAnimalName)); //overloaded method, taking non-const lvalue reference as argument.
78-
79-
fns.push_back(rtl::type().member<Animal>()
80-
.method<std::string&&>(animal::str_setAnimalName)
81-
.build(&Animal::setAnimalName)); //overloaded method, taking rvalue reference as argument.
82-
83-
fns.push_back(rtl::type().member<Animal>()
84-
.methodStatic<std::string&>(animal::str_updateZooKeeper)
85-
.build(&Animal::updateZooKeeper)); //static method, taking non-const lvalue reference as argument.
86-
87-
fns.push_back(rtl::type().member<Animal>()
88-
.methodStatic<std::string&&>(animal::str_updateZooKeeper)
89-
.build(&Animal::updateZooKeeper)); //static method, taking rvalue reference as argument.
90-
#endif
9172
}
9273
}

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: 5 additions & 7 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
@@ -46,11 +45,10 @@ namespace test_mirror
4645
* RTL will ignore this duplicate registration and retain the first one. Emits a warning on the console:
4746
* "[WARNING] Multiple registrations of the same type with different names detected."
4847
*/ fns.push_back(rtl::type().member<std::string>()
49-
.methodConst("empty")
48+
.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>()

CxxTestRegistration/src/StrConstRegistration.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ namespace test_mirror
3535
.build(&StrConst::reverseString));
3636

3737
// numereous other overloads.
38-
#if defined(__GNUC__) && !defined(__clang__)
3938
/*
4039
GCC here fails to automatically resolve the correct overloaded functor
4140
when both a lvalue reference and an rvalue overload exist.
@@ -54,19 +53,7 @@ namespace test_mirror
5453
fns.push_back(rtl::type().member<StrConst>()
5554
.methodConst<std::string&&>(str_reverseString)
5655
.build(static_cast<std::string(StrConst::*)(std::string&&) const>(&StrConst::reverseString)));
57-
#else
58-
fns.push_back(rtl::type().member<StrConst>()
59-
.methodConst<std::string&>(str_reverseString)
60-
.build(&StrConst::reverseString));
61-
62-
fns.push_back(rtl::type().member<StrConst>()
63-
.methodConst<std::string&&>(str_reverseString)
64-
.build(&StrConst::reverseString));
6556

66-
fns.push_back(rtl::type().member<StrConst>()
67-
.methodConst<const std::string&>(str_reverseString)
68-
.build(&StrConst::reverseString));
69-
#endif
7057
fns.push_back(rtl::type().member<StrConst>()
7158
.methodConst<std::string*>(str_reverseString)
7259
.build(&StrConst::reverseString));

CxxTestRegistration/src/StrFuncsRegistration.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace test_mirror
2323
fns.push_back(rtl::type().function<const char*>(str_reverseString)
2424
.build(reverseString));
2525
// numereous other overloads.
26-
#if defined(__GNUC__) && !defined(__clang__)
26+
2727
/*
2828
GCC here fails to automatically resolve the correct overloaded functor
2929
when both a lvalue reference and an rvalue overload exist.
@@ -39,16 +39,7 @@ namespace test_mirror
3939

4040
fns.push_back(rtl::type().function<std::string&&>(str_reverseString)
4141
.build(static_cast<std::string(*)(std::string&&)>(reverseString)));
42-
#else
43-
fns.push_back(rtl::type().function<std::string&>(str_reverseString)
44-
.build(reverseString));
45-
46-
fns.push_back(rtl::type().function<std::string&&>(str_reverseString)
47-
.build(reverseString));
4842

49-
fns.push_back(rtl::type().function<const std::string&>(str_reverseString)
50-
.build(reverseString));
51-
#endif
5243
fns.push_back(rtl::type().function<std::string*>(str_reverseString)
5344
.build(reverseString));
5445

CxxTestRegistration/src/StrMuteRegistration.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace test_mirror
3535
.build(&StrMute::reverseString));
3636

3737
// numereous other overloads.
38-
#if defined(__GNUC__) && !defined(__clang__)
38+
3939
/*
4040
GCC here fails to automatically resolve the correct overloaded functor
4141
when both a lvalue reference and an rvalue overload exist.
@@ -54,19 +54,7 @@ namespace test_mirror
5454
fns.push_back(rtl::type().member<StrMute>()
5555
.method<std::string&&>(str_reverseString)
5656
.build(static_cast<std::string(StrMute::*)(std::string&&)>(&StrMute::reverseString)));
57-
#else
58-
fns.push_back(rtl::type().member<StrMute>()
59-
.method<std::string&>(str_reverseString)
60-
.build(&StrMute::reverseString));
6157

62-
fns.push_back(rtl::type().member<StrMute>()
63-
.method<std::string&&>(str_reverseString)
64-
.build(&StrMute::reverseString));
65-
66-
fns.push_back(rtl::type().member<StrMute>()
67-
.method<const std::string&>(str_reverseString)
68-
.build(&StrMute::reverseString));
69-
#endif
7058
fns.push_back(rtl::type().member<StrMute>()
7159
.method<std::string*>(str_reverseString)
7260
.build(&StrMute::reverseString));

CxxTestRegistration/src/StrStaticRegistration.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ namespace test_mirror
3535
.build(&StrStatic::reverseString));
3636

3737
// numereous other overloads.
38-
#if defined(__GNUC__) && !defined(__clang__)
3938
/*
4039
GCC here fails to automatically resolve the correct overloaded functor
4140
when both a lvalue reference and an rvalue overload exist.
@@ -54,19 +53,7 @@ namespace test_mirror
5453
fns.push_back(rtl::type().member<StrStatic>()
5554
.methodStatic<std::string&&>(str_reverseString)
5655
.build(static_cast<std::string(*)(std::string&&)>(&StrStatic::reverseString)));
57-
#else
58-
fns.push_back(rtl::type().member<StrStatic>()
59-
.methodStatic<std::string&>(str_reverseString)
60-
.build(&StrStatic::reverseString));
61-
62-
fns.push_back(rtl::type().member<StrStatic>()
63-
.methodStatic<std::string&&>(str_reverseString)
64-
.build(&StrStatic::reverseString));
6556

66-
fns.push_back(rtl::type().member<StrStatic>()
67-
.methodStatic<const std::string&>(str_reverseString)
68-
.build(&StrStatic::reverseString));
69-
#endif
7057
fns.push_back(rtl::type().member<StrStatic>()
7158
.methodStatic<std::string*>(str_reverseString)
7259
.build(&StrStatic::reverseString));

0 commit comments

Comments
 (0)