Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code refactor rttr core and tests #327

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/rttr/detail/library/library_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,6 @@ bool library_private::load_native()
{
std::wstring wfile_name = convert_utf8_to_utf16(m_file_name);

std::vector<std::wstring> paths_to_try;

std::vector<std::wstring> prefix_list = {L"lib"};
std::vector<std::wstring> suffix_list = {L".dll"};

Expand Down
2 changes: 1 addition & 1 deletion src/rttr/detail/metadata/metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace detail
class RTTR_API metadata
{
public:
metadata() { }
metadata() = default;
metadata(variant key, variant value) : m_key(std::move(key)), m_value(std::move(value)) { }
metadata(const metadata& other) : m_key(other.m_key), m_value(other.m_value) {}
metadata(metadata&& other) : m_key(std::move(other.m_key)), m_value(std::move(other.m_value)) {}
Expand Down
4 changes: 1 addition & 3 deletions src/rttr/detail/registration/registration_executer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ namespace detail

/////////////////////////////////////////////////////////////////////////////////////////

registration_executer::registration_executer()
{
}
registration_executer::registration_executer() = default;

/////////////////////////////////////////////////////////////////////////////////////////

Expand Down
4 changes: 2 additions & 2 deletions src/rttr/detail/type/type_register.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,8 @@ std::string type_register_private::derive_template_instance_name(type_data* info
if (has_custom_name)
return info->name;

const auto start_pos = info->name.find("<");
const auto end_pos = info->name.rfind(">");
const auto start_pos = info->name.find('<');
const auto end_pos = info->name.rfind('>');

if (start_pos == std::string::npos || end_pos == std::string::npos)
return info->name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ class RTTR_LOCAL variant_sequential_view_private

RTTR_INLINE variant_sequential_view_private(const variant_sequential_view_private& other) = default;

RTTR_INLINE ~variant_sequential_view_private()
{

}
RTTR_INLINE ~variant_sequential_view_private() = default;

RTTR_INLINE type get_type() const RTTR_NOEXCEPT
{
Expand Down
2 changes: 1 addition & 1 deletion src/rttr/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class library_manager
}

private:
library_manager() {}
library_manager() = default;

static library_manager& get_instance()
{
Expand Down
2 changes: 1 addition & 1 deletion src/rttr/registration.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ class RTTR_API registration
static const detail::private_access private_access;

private:
registration() {}
registration() = default;
registration(const std::shared_ptr<detail::registration_executer>& reg_exec) : m_reg_exec(reg_exec) { }
registration(const registration& other);
registration& operator=(const registration& other);
Expand Down
8 changes: 2 additions & 6 deletions src/rttr/variant_associative_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ namespace rttr

/////////////////////////////////////////////////////////////////////////////////

variant_associative_view::variant_associative_view()
{
}
variant_associative_view::variant_associative_view() = default;

/////////////////////////////////////////////////////////////////////////////////

Expand All @@ -52,9 +50,7 @@ variant_associative_view::variant_associative_view(const variant_associative_vie

/////////////////////////////////////////////////////////////////////////////////

variant_associative_view::~variant_associative_view() RTTR_NOEXCEPT
{
}
variant_associative_view::~variant_associative_view() RTTR_NOEXCEPT = default;

/////////////////////////////////////////////////////////////////////////////////

Expand Down
8 changes: 2 additions & 6 deletions src/rttr/variant_sequential_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ namespace rttr

/////////////////////////////////////////////////////////////////////////////////

variant_sequential_view::variant_sequential_view()
{
}
variant_sequential_view::variant_sequential_view() = default;

/////////////////////////////////////////////////////////////////////////////////

Expand All @@ -52,9 +50,7 @@ variant_sequential_view::variant_sequential_view(const variant_sequential_view&

/////////////////////////////////////////////////////////////////////////////////

variant_sequential_view::~variant_sequential_view() RTTR_NOEXCEPT
{
}
variant_sequential_view::~variant_sequential_view() RTTR_NOEXCEPT = default;

/////////////////////////////////////////////////////////////////////////////////

Expand Down
4 changes: 2 additions & 2 deletions src/unit_tests/variant/variant_conv_to_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ TEST_CASE("variant::to_string() - from empty", "[variant]")
{
variant var;
bool ok = false;
CHECK(var.to_string(&ok) == "");
CHECK(var.to_string(&ok).empty());
CHECK(ok == false);
}

Expand Down Expand Up @@ -400,7 +400,7 @@ TEST_CASE("variant::to_string() - from enum", "[variant]")
{
variant var = unregisterd_enum::VALUE_1;
bool ok = false;
CHECK(var.to_string(&ok) == "");
CHECK(var.to_string(&ok).empty());
CHECK(ok == false);
CHECK(var.convert(type::get<std::string>()) == false);
}
Expand Down
2 changes: 1 addition & 1 deletion src/unit_tests/visitor/visitor_test_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static bool get_prop_as_function() { return true; }

static std::string g_text;

static void set_global_value(std::string text) { g_text = text; }
static void set_global_value(const std::string& text) { g_text = std::move(text); }
static std::string get_global_value() { return g_text; }

using namespace rttr;
Expand Down