etc: Fix build and test errors on CI

This commit is contained in:
Joshua Scott 2018-12-11 01:19:30 +00:00
parent 377136ef0d
commit c7829e5235
3 changed files with 8 additions and 6 deletions

View File

@ -125,7 +125,8 @@ namespace pclass
template <typename SrcT, typename DestT>
static void declare()
{
ValueCaster::get<SrcT>().add_caster<SrcT, DestT>();
ValueCaster &caster = ValueCaster::get<SrcT>();
caster.add_caster<SrcT, DestT>();
}
/**
@ -355,7 +356,7 @@ namespace pclass
{
const auto it = s_caster_lookup.find(src_type.hash_code());
if (it != s_caster_lookup.end())
return it->second.cast<DestT>(value);
return it->second->cast_value<DestT>(value);
throw cast_error(src_type, typeid(DestT));
}
@ -363,7 +364,8 @@ namespace pclass
Value ValueCaster::cast(const Value& value)
{
ValueCaster::declare<SrcT, DestT>();
return ValueCaster::get<SrcT>().cast<DestT>(value);
ValueCaster &caster = ValueCaster::get<SrcT>();
return caster.cast_value<DestT>(value);
}
template <typename DestT>

View File

@ -65,7 +65,7 @@ namespace pclass
// Define string types
define_primitive<std::string>("std::string");
define_primitive<std::wstring>("std::wstring");
define_primitive<std::u16string>("std::wstring");
// Define the base class for all classes
define_class<PropertyClass>("class PropertyClass");

View File

@ -213,7 +213,7 @@ public:
// Test strings
pclass::StaticProperty<std::string> string;
pclass::StaticProperty<std::wstring> wstring;
pclass::StaticProperty<std::u16string> wstring;
// Test single precision and double precision floating point integers
pclass::StaticProperty<float> float32;
@ -268,7 +268,7 @@ void define_types()
#define EXPECTED_uint32 0x0708090A
#define EXPECTED_uint64 0x0B0C0D0E0F101112
#define EXPECTED_string "This is a test value"
#define EXPECTED_wstring L"This is a test value"
#define EXPECTED_wstring u"This is a test value"
#define EXPECTED_float32 3.1415927410125732421875f
#define EXPECTED_float64 3.141592653589793115997963468544185161590576171875
#define EXPECTED_vector3d Vector3D(24.0f, 61.0f, 3.62f)