From 2fa4c2b806b144e19ccce877044eac09de795705 Mon Sep 17 00:00:00 2001 From: Hugues Delorme Date: Thu, 9 Jan 2025 19:00:22 +0100 Subject: [PATCH] Base: minor code change for PropertyValueConversion::Variant --- src/base/property_value_conversion.cpp | 13 ++++++------- src/base/property_value_conversion.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/base/property_value_conversion.cpp b/src/base/property_value_conversion.cpp index fd24b714..046d59e6 100644 --- a/src/base/property_value_conversion.cpp +++ b/src/base/property_value_conversion.cpp @@ -91,11 +91,11 @@ static gp_XYZ xyzFromString(std::string_view str) } // namespace PropertyValueConversion::Variant::Variant(bool v) - : BaseType(v) + : BaseVariantType(v) {} PropertyValueConversion::Variant::Variant(int v) - : BaseType(v) + : BaseVariantType(v) {} PropertyValueConversion::Variant::Variant(float v) @@ -103,22 +103,21 @@ PropertyValueConversion::Variant::Variant(float v) {} PropertyValueConversion::Variant::Variant(double v) - : BaseType(v) + : BaseVariantType(v) {} PropertyValueConversion::Variant::Variant(const char* str) - : BaseType(std::string(str)) + : BaseVariantType(std::string(str)) {} PropertyValueConversion::Variant::Variant(const std::string& str) - : BaseType(str) + : BaseVariantType(str) {} PropertyValueConversion::Variant::Variant(Span bytes) - : BaseType(std::vector(bytes.begin(), bytes.end())) + : BaseVariantType(std::vector(bytes.begin(), bytes.end())) {} - PropertyValueConversion::Variant PropertyValueConversion::toVariant(const Property& prop) const { auto fnError = [&](std::string_view text) { diff --git a/src/base/property_value_conversion.h b/src/base/property_value_conversion.h index db2cd95d..4e7f5cc0 100644 --- a/src/base/property_value_conversion.h +++ b/src/base/property_value_conversion.h @@ -18,13 +18,13 @@ namespace Mayo { // Mechanism to convert value of a Property object to/from a basic variant type class PropertyValueConversion { public: + // Alias of the std::variant<...> type used by custom PropertyValueConversion::Variant using BaseVariantType = std::variant< std::monostate, bool, int, double, std::string, std::vector >; // Variant type to be used when (de)serializing values class Variant : public BaseVariantType { public: - using BaseType = BaseVariantType; Variant() = default; Variant(bool v); Variant(int v);