#ifndef QUERY_QUERY_HELPER_HPP #define QUERY_QUERY_HELPER_HPP #include "macro_map.hpp" #include #include template struct basic_query; struct table { template table(const basic_query &qc); const std::string name; }; struct field { const std::string name; friend std::ostream& operator<<(std::ostream &out, const field &f) { out << f.name; return out; } }; template struct basic_query { const table& operator()() const { return table_; } const table table_; }; template table::table(const basic_query&) : name(QueryClass::internal_table_name_) { } #define FIELD(x) const field x{#x}; #define QUERY_HELPER(C, ...) \ namespace qh { \ namespace internal { \ struct C##_query { \ MAP(FIELD, __VA_ARGS__) \ }; } \ static const internal:: C##_query C; \ } #endif //QUERY_QUERY_HELPER_HPP