query/include/matador/object/collection_resolver.hpp

32 lines
838 B
C++

#ifndef MATADOR_COLLECTION_RESOLVER_HPP
#define MATADOR_COLLECTION_RESOLVER_HPP
#include "matador/object/abstract_type_resolver.hpp"
#include "matador/object/object_ptr.hpp"
#include <typeindex>
#include <vector>
namespace matador::object {
class abstract_collection_resolver {
public:
virtual ~abstract_collection_resolver() = default;
[[nodiscard]] const std::type_index& type() const { return type_; }
protected:
explicit abstract_collection_resolver(const std::type_index& ti) : type_(ti) {}
public:
const std::type_index type_;
};
template<typename Type>
class collection_resolver : public abstract_type_resolver {
public:
collection_resolver() : abstract_type_resolver(typeid(std::vector<Type>)) {}
virtual std::vector<Type> resolve(const utils::identifier& id) = 0;
};
}
#endif //MATADOR_COLLECTION_RESOLVER_HPP