Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

64 righe
2.1 KiB

  1. #pragma once
  2. #include "field_simple.h"
  3. #include "../../helper/type_properties.h"
  4. namespace cpphibernate {
  5. namespace mariadb {
  6. /**
  7. * @brief Field that represents a simple value.
  8. */
  9. template<typename T_field>
  10. struct field_value_t
  11. : public field_simple_t<T_field>
  12. {
  13. private:
  14. using base_type = field_simple_t<T_field>;
  15. public:
  16. static constexpr decltype(auto) field_type =
  17. hana::type_c<mp::decay_t<T_field>>;
  18. static constexpr decltype(auto) value_type =
  19. hana::type_c<typename decltype(+field_type)::type::value_type>;
  20. static constexpr decltype(auto) value_props =
  21. type_properties<typename decltype(+value_type)::type> { };
  22. public:
  23. /**
  24. * @brief Value constructor. Creates a mariadb field from the cpphibernate field.
  25. *
  26. * @param[in] p_owner Owner of the field.
  27. * @param[in] p_schema Cpphibernate schema the mariadb field belongs to.
  28. * @param[in] p_table Cpphibernate table the mariadb field belongs to.
  29. * @param[in] p_field Cpphibernate field to create mariadb field for.
  30. */
  31. template<
  32. typename T_schema,
  33. typename T_table>
  34. inline field_value_t(
  35. const table_t& p_owner,
  36. const T_schema& p_schema,
  37. const T_table& p_table,
  38. const T_field& p_field);
  39. /**
  40. * @brief Get the value of this field from the current dataset.
  41. *
  42. * @param[in] context Data context to get the dataset from.
  43. *
  44. * @return Value of the field from the current dataset.
  45. */
  46. virtual value_t get(const data_context& context) const;
  47. /**
  48. * @brief Set a new value of this field in the current dataset.
  49. *
  50. * @param[in] context Data context to get the dataset from.
  51. * @param[in] value Value of the field to assign to the dataset.
  52. */
  53. virtual void set(const data_context& context, const value_t& value) const;
  54. };
  55. } }