|
- #pragma once
-
- #include "field_simple.h"
- #include "../../helper/type_properties.h"
-
- namespace cpphibernate {
- namespace mariadb {
-
- /**
- * @brief Field that represents a simple value.
- */
- template<typename T_field>
- struct field_value_t
- : public field_simple_t<T_field>
- {
- private:
- using base_type = field_simple_t<T_field>;
-
- public:
- static constexpr decltype(auto) field_type =
- hana::type_c<mp::decay_t<T_field>>;
- static constexpr decltype(auto) value_type =
- hana::type_c<typename decltype(+field_type)::type::value_type>;
- static constexpr decltype(auto) value_props =
- type_properties<typename decltype(+value_type)::type> { };
-
- public:
- /**
- * @brief Value constructor. Creates a mariadb field from the cpphibernate field.
- *
- * @param[in] p_owner Owner of the field.
- * @param[in] p_schema Cpphibernate schema the mariadb field belongs to.
- * @param[in] p_table Cpphibernate table the mariadb field belongs to.
- * @param[in] p_field Cpphibernate field to create mariadb field for.
- */
- template<
- typename T_schema,
- typename T_table>
- inline field_value_t(
- const table_t& p_owner,
- const T_schema& p_schema,
- const T_table& p_table,
- const T_field& p_field);
-
- /**
- * @brief Get the value of this field from the current dataset.
- *
- * @param[in] context Data context to get the dataset from.
- *
- * @return Value of the field from the current dataset.
- */
- virtual value_t get(const data_context& context) const;
-
- /**
- * @brief Set a new value of this field in the current dataset.
- *
- * @param[in] context Data context to get the dataset from.
- * @param[in] value Value of the field to assign to the dataset.
- */
- virtual void set(const data_context& context, const value_t& value) const;
- };
-
- } }
|