diff --git a/include/vcml/properties/property.h b/include/vcml/properties/property.h index 4041ab39..3f09b198 100644 --- a/include/vcml/properties/property.h +++ b/include/vcml/properties/property.h @@ -469,7 +469,7 @@ class property : public property_base virtual size_t size() const override { return m_size; } virtual size_t count() const override { return m_count; } - virtual const char* type() const override { return "void"; } + virtual const char* type() const override; constexpr bool is_inited() const { return m_inited; } constexpr bool is_default() const { return !m_inited; } @@ -575,6 +575,22 @@ inline void property::str(const string& s) { } } +template +inline const char* property::type() const { + switch (m_size) { + case 1: + return "u8"; + case 2: + return "u16"; + case 4: + return "u32"; + case 8: + return "u64"; + default: + return "void"; + } +} + template inline u64 property::get(size_t idx) const { VCML_ERROR_ON(idx >= m_count, "index %zu out of bounds", idx);