Add support for forward declarations
This commit is contained in:
parent
c31e306e91
commit
210fcf2c36
12 changed files with 332 additions and 64 deletions
|
|
@ -13,6 +13,7 @@
|
|||
#include <cppast/cpp_entity_index.hpp>
|
||||
#include <cppast/cpp_entity.hpp>
|
||||
#include <cppast/cpp_expression.hpp>
|
||||
#include <cppast/cpp_forward_declarable.hpp>
|
||||
#include <cppast/cpp_type.hpp>
|
||||
|
||||
namespace cppast
|
||||
|
|
@ -48,7 +49,12 @@ namespace cppast
|
|||
};
|
||||
|
||||
/// A [cppast::cpp_entity]() modelling a C++ enumeration.
|
||||
class cpp_enum final : public cpp_entity, public cpp_entity_container<cpp_enum, cpp_enum_value>
|
||||
///
|
||||
/// This can either be a definition or just a forward declaration.
|
||||
/// If it is just forward declared, it will not have any children.
|
||||
class cpp_enum final : public cpp_entity,
|
||||
public cpp_entity_container<cpp_enum, cpp_enum_value>,
|
||||
public cpp_forward_declarable
|
||||
{
|
||||
public:
|
||||
static cpp_entity_kind kind() noexcept;
|
||||
|
|
@ -79,6 +85,15 @@ namespace cppast
|
|||
return std::move(enum_);
|
||||
}
|
||||
|
||||
/// \effects Marks the enum as forward declaration.
|
||||
/// \returns The finished enum.
|
||||
/// \notes It will not be registered, as it is not the main definition.
|
||||
std::unique_ptr<cpp_enum> finish_declaration(cpp_entity_id definition_id) noexcept
|
||||
{
|
||||
enum_->set_definition(definition_id);
|
||||
return std::move(enum_);
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<cpp_enum> enum_;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue