implemented lazy loading for object_ptr and belongs_to
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
#include "matador/utils/identifier_to_value_converter.hpp"
|
||||
|
||||
namespace matador::utils {
|
||||
value identifier_to_value_converter::convert(const identifier &id) {
|
||||
id.serialize(*this);
|
||||
|
||||
return value_;
|
||||
}
|
||||
|
||||
void identifier_to_value_converter::serialize(int8_t &x, const field_attributes &) {
|
||||
value_ = x;
|
||||
}
|
||||
|
||||
void identifier_to_value_converter::serialize(int16_t &x, const field_attributes &) {
|
||||
value_ = x;
|
||||
}
|
||||
|
||||
void identifier_to_value_converter::serialize(int32_t &x, const field_attributes &) {
|
||||
value_ = x;
|
||||
}
|
||||
|
||||
void identifier_to_value_converter::serialize(int64_t &x, const field_attributes &) {
|
||||
value_ = x;
|
||||
}
|
||||
|
||||
void identifier_to_value_converter::serialize(uint8_t &x, const field_attributes &) {
|
||||
value_ = x;
|
||||
}
|
||||
|
||||
void identifier_to_value_converter::serialize(uint16_t &x, const field_attributes &) {
|
||||
value_ = x;
|
||||
}
|
||||
|
||||
void identifier_to_value_converter::serialize(uint32_t &x, const field_attributes &) {
|
||||
value_ = x;
|
||||
}
|
||||
|
||||
void identifier_to_value_converter::serialize(uint64_t &x, const field_attributes &) {
|
||||
value_ = x;
|
||||
}
|
||||
|
||||
void identifier_to_value_converter::serialize(const char *x, const field_attributes &) {
|
||||
value_ = x;
|
||||
}
|
||||
|
||||
void identifier_to_value_converter::serialize(std::string &x, const field_attributes &) {
|
||||
value_ = x;
|
||||
}
|
||||
|
||||
void identifier_to_value_converter::serialize(null_type_t &/*x*/, const field_attributes &) {
|
||||
value_.type(basic_type::Null);
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,14 @@ value &value::operator=(value &&x) noexcept {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool value::operator==(const value &rhs) const {
|
||||
return type_ == rhs.type_ && value_ == rhs.value_;
|
||||
}
|
||||
|
||||
bool value::operator!=(const value &rhs) const {
|
||||
return !operator==(rhs);
|
||||
}
|
||||
|
||||
std::string value::str() const {
|
||||
return as<std::string>().value_or("");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user