Class query_builder_base

Synopsis

#include <include/flecs/addons/cpp/builder.hpp>

template<typename ... Components>
class query_builder_base
    : public query_builder_i<query_builder_base<Components...>, Components ...>

Description

No description yet.

Inheritance

Ancestors: query_builder_i

Methods

query_builder_base overload
build
operator ecs_query_t *
operator query< Components ... >
world

Source

Lines 902-953 in include/flecs/addons/cpp/builder.hpp.

template<typename ... Components>
class query_builder_base
    : public query_builder_i<query_builder_base<Components...>, Components ...>
{
public:
    query_builder_base(flecs::world_t *world) 
        : query_builder_i<query_builder_base<Components...>, Components ...>(&m_desc)
        , m_desc({})
        , m_world(world)
    { 
        this->populate_filter_from_pack();
    }

    query_builder_base(const query_builder_base& obj) 
        : query_builder_i<query_builder_base<Components...>, Components ...>(&m_desc, obj.m_term_index)
    {
        m_world = obj.m_world;
        m_desc = obj.m_desc;
    }

    query_builder_base(query_builder_base&& obj) 
        : query_builder_i<query_builder_base<Components...>, Components ...>(&m_desc, obj.m_term_index)
    {
        m_world = obj.m_world;
        m_desc = obj.m_desc;
    }

    operator query<Components ...>() const;

    operator ecs_query_t*() const {
        ecs_query_t *result = ecs_query_init(this->m_world, &this->m_desc);

        if (!result) {
            ecs_abort(ECS_INVALID_PARAMETER, NULL);
        }

        if (this->m_desc.filter.terms_buffer) {
            ecs_os_free(m_desc.filter.terms_buffer);
        }

        return result;
    }    

    query<Components ...> build() const;

    ecs_query_desc_t m_desc;

    flecs::world_t* world() override { return m_world; }

protected:
    flecs::world_t *m_world;
};