Parse cpp_function_template
This commit is contained in:
parent
d6f0997fb6
commit
eeb48f1df5
18 changed files with 397 additions and 60 deletions
|
|
@ -85,7 +85,7 @@ namespace cppast
|
|||
/// \requires The comment must not be empty, if there is one.
|
||||
void set_comment(type_safe::optional<std::string> comment) noexcept
|
||||
{
|
||||
comment_ = std::move(comment.value());
|
||||
comment_ = std::move(comment.value_or(""));
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -64,8 +64,15 @@ namespace cppast
|
|||
/// \returns Whether or not a given entity kind is a C++ type.
|
||||
bool is_type(cpp_entity_kind kind) noexcept;
|
||||
|
||||
/// \returns Whether or not a given entity kind is a C++ function.
|
||||
bool is_function(cpp_entity_kind kind) noexcept;
|
||||
|
||||
/// \returns Whether or not a given entity kind is a C++ (template) parameter.
|
||||
bool is_parameter(cpp_entity_kind kind) noexcept;
|
||||
|
||||
/// \returns Whether or not a given entity kind is a C++ template.
|
||||
/// \notes A template template parameter is not considered a template for this function.
|
||||
/// \notes Template specializations are also considered templates here.
|
||||
bool is_template(cpp_entity_kind kind) noexcept;
|
||||
} // namespace cppast
|
||||
|
||||
|
|
|
|||
|
|
@ -147,8 +147,9 @@ namespace cppast
|
|||
|
||||
/// \returns The finished function without registering it.
|
||||
/// \notes This is intended for templated functions only.
|
||||
std::unique_ptr<T> finish()
|
||||
std::unique_ptr<T> finish(cpp_function_body_kind body_kind)
|
||||
{
|
||||
function->body_ = body_kind;
|
||||
return std::move(function);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ namespace cppast
|
|||
class cpp_function_template final : public cpp_template
|
||||
{
|
||||
public:
|
||||
static cpp_entity_kind kind() noexcept;
|
||||
|
||||
/// Builder for [cppast::cpp_function_template]().
|
||||
class builder : public basic_builder<cpp_function_template, cpp_function_base>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -201,13 +201,7 @@ namespace cppast
|
|||
class builder : public basic_member_builder<cpp_conversion_op>
|
||||
{
|
||||
public:
|
||||
/// \effects Creates it giving it the return type.
|
||||
/// \notes It does not have a name as it is given by the return type.
|
||||
builder(std::unique_ptr<cpp_type> type)
|
||||
{
|
||||
function =
|
||||
std::unique_ptr<cpp_conversion_op>(new cpp_conversion_op(std::move(type)));
|
||||
}
|
||||
using basic_member_builder::basic_member_builder;
|
||||
|
||||
/// \effects Marks the conversion operator `explicit`.
|
||||
void is_explicit() noexcept
|
||||
|
|
@ -227,8 +221,8 @@ namespace cppast
|
|||
}
|
||||
|
||||
private:
|
||||
cpp_conversion_op(std::unique_ptr<cpp_type> return_t)
|
||||
: cpp_member_function_base("", std::move(return_t)), explicit_(false)
|
||||
cpp_conversion_op(std::string name, std::unique_ptr<cpp_type> return_t)
|
||||
: cpp_member_function_base(std::move(name), std::move(return_t)), explicit_(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -135,6 +135,8 @@ namespace cppast
|
|||
public cpp_variable_base
|
||||
{
|
||||
public:
|
||||
static cpp_entity_kind kind() noexcept;
|
||||
|
||||
/// \returns A newly created and registered non type template parameter.
|
||||
/// \notes The `default_value` may be `nullptr` in which case the parameter has no default.
|
||||
static std::unique_ptr<cpp_non_type_template_parameter> build(
|
||||
|
|
@ -173,6 +175,8 @@ namespace cppast
|
|||
public cpp_entity_container<cpp_template_template_parameter, cpp_template_parameter>
|
||||
{
|
||||
public:
|
||||
static cpp_entity_kind kind() noexcept;
|
||||
|
||||
/// Builds a [cppast::cpp_template_template_parameter]().
|
||||
class builder
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue