Parse cpp_type_alias and simple cpp_type's
This commit is contained in:
parent
a38641ecb1
commit
b183513166
13 changed files with 533 additions and 13 deletions
|
|
@ -14,7 +14,18 @@ namespace cppast
|
|||
/// \exclude
|
||||
namespace detail
|
||||
{
|
||||
void check_entity_cast(const cpp_entity& e, cpp_entity_kind expected_kind);
|
||||
void check_entity_cast_impl(const cpp_entity& e, cpp_entity_kind expected_kind);
|
||||
|
||||
template <typename T>
|
||||
void check_entity_cast(const cpp_entity& e)
|
||||
{
|
||||
check_entity_cast_impl(e, T::kind());
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void check_entity_cast<cpp_entity>(const cpp_entity&)
|
||||
{
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
/// A basic reference to some kind of [cppast::cpp_entity]().
|
||||
|
|
@ -46,7 +57,7 @@ namespace cppast
|
|||
auto entity = idx.lookup(target_);
|
||||
if (!entity)
|
||||
return type_safe::nullopt;
|
||||
detail::check_entity_cast(entity.value(), T::kind());
|
||||
detail::check_entity_cast<T>(entity.value());
|
||||
return static_cast<const T&>(entity.value());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace cppast
|
|||
{
|
||||
public:
|
||||
/// \returns A newly created unexposed type.
|
||||
std::unique_ptr<cpp_unexposed_type> build(std::string name)
|
||||
static std::unique_ptr<cpp_unexposed_type> build(std::string name)
|
||||
{
|
||||
return std::unique_ptr<cpp_unexposed_type>(new cpp_unexposed_type(std::move(name)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ namespace cppast
|
|||
class cpp_type_alias final : public cpp_entity
|
||||
{
|
||||
public:
|
||||
static cpp_entity_kind kind() noexcept;
|
||||
|
||||
/// \returns A newly created and registered type alias.
|
||||
static std::unique_ptr<cpp_type_alias> build(const cpp_entity_index& idx, cpp_entity_id id,
|
||||
std::string name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue