選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

61 行
2.0 KiB

  1. #pragma once
  2. namespace cpphibernate {
  3. namespace mariadb {
  4. struct field_t;
  5. struct table_t;
  6. struct schema_t;
  7. /**
  8. * @brief Inclusive or exclusive field and table filter.
  9. * Is used in update and read operations to select the fields that should be updated / fetched.
  10. */
  11. struct filter_t
  12. {
  13. public:
  14. using field_set_type = std::set<const field_t *>;
  15. using table_set_type = std::set<const table_t *>;
  16. ssize_t cache_id { 0 }; //!< Unique ID that indicates the current filtered tables and fields
  17. bool exclusive { true }; //!< True: Use exclusive filter. False: Use inclusive filter.
  18. field_set_type fields; //!< Set of fields assigned to the filter.
  19. table_set_type tables; //!< Set of tables assigned to the filter.
  20. public:
  21. /**
  22. * @brief Returns true if the passed table is excluded.
  23. */
  24. inline bool is_excluded(const table_t& table) const;
  25. /**
  26. * @brief Returns true if the passed field is excluded.
  27. */
  28. inline bool is_excluded(const field_t& field) const;
  29. /**
  30. * @brief Set included fields and tables.
  31. *
  32. * @param[in] schema Mariadb driver schame to use for looking up fields and tables.
  33. * @param[in] args Fields and tables from the cpphibernate schema to include in this filter.
  34. */
  35. template<typename... T_args>
  36. inline void set_inclusive(const schema_t& schema, T_args&&... args);
  37. /**
  38. * @brief Set excluded fields and tables.
  39. *
  40. * @param[in] schema Mariadb driver schame to use for looking up fields and tables.
  41. * @param[in] args Fields and tables from the cpphibernate schema to exclude in this filter.
  42. */
  43. template<typename... T_args>
  44. inline void set_exclusive(const schema_t& schema, T_args&&... args);
  45. /**
  46. * @brief Clear the filter.
  47. */
  48. inline void clear();
  49. };
  50. } }