Add cpp_class_template and _specialization

This commit is contained in:
Jonathan Müller 2017-02-05 21:58:31 +01:00
commit 7b4beea8df
5 changed files with 107 additions and 0 deletions

View file

@ -0,0 +1,19 @@
// Copyright (C) 2017 Jonathan Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
#include <cppast/cpp_class_template.hpp>
#include <cppast/cpp_entity_kind.hpp>
using namespace cppast;
cpp_entity_kind cpp_class_template::do_get_entity_kind() const noexcept
{
return cpp_entity_kind::class_template_t;
}
cpp_entity_kind cpp_class_template_specialization::do_get_entity_kind() const noexcept
{
return cpp_entity_kind::class_template_specialization_t;
}

View file

@ -73,6 +73,10 @@ const char* cppast::to_string(cpp_entity_kind kind) noexcept
return "function template";
case cpp_entity_kind::function_template_specialization_t:
return "function template specialization";
case cpp_entity_kind::class_template_t:
return "class template";
case cpp_entity_kind::class_template_specialization_t:
return "class tempalte specialization";
case cpp_entity_kind::count:
break;
@ -114,6 +118,8 @@ bool cppast::is_type(cpp_entity_kind kind) noexcept
case cpp_entity_kind::alias_template_t:
case cpp_entity_kind::function_template_t:
case cpp_entity_kind::function_template_specialization_t:
case cpp_entity_kind::class_template_t:
case cpp_entity_kind::class_template_specialization_t:
case cpp_entity_kind::count:
break;
}
@ -128,6 +134,8 @@ bool cppast::is_template(cpp_entity_kind kind) noexcept
case cpp_entity_kind::alias_template_t:
case cpp_entity_kind::function_template_t:
case cpp_entity_kind::function_template_specialization_t:
case cpp_entity_kind::class_template_t:
case cpp_entity_kind::class_template_specialization_t:
return true;
case cpp_entity_kind::file_t:

View file

@ -8,6 +8,7 @@
#include <cppast/cpp_entity.hpp>
#include <cppast/cpp_entity_kind.hpp>
#include <cppast/cpp_class.hpp>
#include <cppast/cpp_class_template.hpp>
#include <cppast/cpp_enum.hpp>
#include <cppast/cpp_file.hpp>
#include <cppast/cpp_function.hpp>
@ -68,6 +69,10 @@ bool detail::visit(const cpp_entity& e, detail::visitor_callback_t cb, void* fun
return handle_container<cpp_function_template>(e, cb, functor);
case cpp_entity_kind::function_template_specialization_t:
return handle_container<cpp_function_template_specialization>(e, cb, functor);
case cpp_entity_kind::class_template_t:
return handle_container<cpp_class_template>(e, cb, functor);
case cpp_entity_kind::class_template_specialization_t:
return handle_container<cpp_class_template_specialization>(e, cb, functor);
case cpp_entity_kind::namespace_alias_t:
case cpp_entity_kind::using_directive_t: