Generalize basic_cpp_entity_ref to use predicate

This commit is contained in:
Jonathan Müller 2017-01-21 19:53:37 +01:00
commit 21c59afc71
4 changed files with 68 additions and 33 deletions

View file

@ -7,6 +7,7 @@
#include <cppast/cpp_entity_index.hpp>
#include <cppast/cpp_entity_ref.hpp>
#include <cppast/cpp_entity_type.hpp>
#include <cppast/cpp_scope.hpp>
namespace cppast
@ -57,16 +58,23 @@ namespace cppast
{
}
cpp_entity_type do_get_entity_type() const noexcept override
{
return cpp_entity_type::namespace_t;
}
cpp_entity_type do_get_entity_type() const noexcept override;
bool inline_;
};
/// \exclude
namespace detail
{
struct cpp_namespace_ref_predicate
{
bool operator()(const cpp_entity& e);
};
} // namespace detail
/// A reference to a [cppast::cpp_namespace]().
using cpp_namespace_ref = basic_cpp_entity_ref<cpp_namespace, cpp_entity_type::namespace_t>;
using cpp_namespace_ref =
basic_cpp_entity_ref<cpp_namespace, detail::cpp_namespace_ref_predicate>;
/// A [cppast::cpp_entity]() modelling a namespace alias.
class cpp_namespace_alias final : public cpp_entity
@ -95,10 +103,7 @@ namespace cppast
{
}
cpp_entity_type do_get_entity_type() const noexcept override
{
return cpp_entity_type::namespace_alias_t;
}
cpp_entity_type do_get_entity_type() const noexcept override;
cpp_namespace_ref target_;
};
@ -130,10 +135,7 @@ namespace cppast
{
}
cpp_entity_type do_get_entity_type() const noexcept override
{
return cpp_entity_type::using_directive_t;
}
cpp_entity_type do_get_entity_type() const noexcept override;
cpp_entity_id target_;
};
@ -165,10 +167,7 @@ namespace cppast
{
}
cpp_entity_type do_get_entity_type() const noexcept override
{
return cpp_entity_type::using_declaration_t;
}
cpp_entity_type do_get_entity_type() const noexcept override;
cpp_entity_id target_;
};