Remove cpp_scope
This commit is contained in:
parent
36425c096b
commit
023ce3e87c
5 changed files with 8 additions and 56 deletions
|
|
@ -2,8 +2,8 @@
|
|||
// This file is subject to the license terms in the LICENSE file
|
||||
// found in the top-level directory of this distribution.
|
||||
|
||||
#ifndef CPPAST_CPP_SCOPE_HPP_INCLUDED
|
||||
#define CPPAST_CPP_SCOPE_HPP_INCLUDED
|
||||
#ifndef CPPAST_CPP_ENTITY_CONTAINER_HPP_INCLUDED
|
||||
#define CPPAST_CPP_ENTITY_CONTAINER_HPP_INCLUDED
|
||||
|
||||
#include <cppast/cpp_entity.hpp>
|
||||
|
||||
|
|
@ -54,33 +54,6 @@ namespace cppast
|
|||
private:
|
||||
detail::intrusive_list<T> children_;
|
||||
};
|
||||
|
||||
/// Base class for all entities that add a scope.
|
||||
///
|
||||
/// Examples are namespaces and classes,
|
||||
/// or anything else that can appear followed by `::`.
|
||||
class cpp_scope : public cpp_entity, public cpp_entity_container<cpp_scope, cpp_entity>
|
||||
{
|
||||
public:
|
||||
/// \returns The name of the scope.
|
||||
/// By default, this is the same name as the entity,
|
||||
/// but derived classes can override it.
|
||||
std::string scope_name() const
|
||||
{
|
||||
return do_get_scope_name();
|
||||
}
|
||||
|
||||
protected:
|
||||
using cpp_entity::cpp_entity;
|
||||
|
||||
private:
|
||||
/// \returns The name of the new scope,
|
||||
/// defaults to the name of the entity.
|
||||
virtual std::string do_get_scope_name() const
|
||||
{
|
||||
return name();
|
||||
}
|
||||
};
|
||||
} // namespace cppast
|
||||
|
||||
#endif // CPPAST_CPP_SCOPE_HPP_INCLUDED
|
||||
#endif // CPPAST_CPP_ENTITY_CONTAINER_HPP_INCLUDED
|
||||
|
|
@ -22,10 +22,6 @@ namespace cppast
|
|||
count,
|
||||
};
|
||||
|
||||
/// \returns Whether or not a given entity type is one derived from [cppast::cpp_scope]().
|
||||
/// One example is [cppast::cpp_entity_type::namespace_t]().
|
||||
bool is_scope(cpp_entity_type type) noexcept;
|
||||
|
||||
/// \returns Whether or not a given entity type is a C++ type.
|
||||
bool is_type(cpp_entity_type type) noexcept;
|
||||
} // namespace cppast
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#define CPPAST_CPP_FILE_HPP_INCLUDED
|
||||
|
||||
#include <cppast/cpp_entity_index.hpp>
|
||||
#include <cppast/cpp_scope.hpp>
|
||||
#include <cppast/cpp_entity_container.hpp>
|
||||
|
||||
namespace cppast
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,15 +5,16 @@
|
|||
#ifndef CPPAST_CPP_NAMESPACE_HPP_INCLUDED
|
||||
#define CPPAST_CPP_NAMESPACE_HPP_INCLUDED
|
||||
|
||||
#include <cppast/cpp_entity_container.hpp>
|
||||
#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
|
||||
{
|
||||
/// A [cppast::cpp_entity]() modelling a namespace.
|
||||
class cpp_namespace final : public cpp_scope
|
||||
class cpp_namespace final : public cpp_entity,
|
||||
public cpp_entity_container<cpp_namespace, cpp_entity>
|
||||
{
|
||||
public:
|
||||
/// Builds a [cppast::cpp_namespace]().
|
||||
|
|
@ -54,7 +55,7 @@ namespace cppast
|
|||
|
||||
private:
|
||||
cpp_namespace(std::string name, bool is_inline)
|
||||
: cpp_scope(std::move(name)), inline_(is_inline)
|
||||
: cpp_entity(std::move(name)), inline_(is_inline)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,24 +6,6 @@
|
|||
|
||||
using namespace cppast;
|
||||
|
||||
bool cppast::is_scope(cpp_entity_type type) noexcept
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case cpp_entity_type::namespace_t:
|
||||
return true;
|
||||
|
||||
case cpp_entity_type::file_t:
|
||||
case cpp_entity_type::namespace_alias_t:
|
||||
case cpp_entity_type::using_directive_t:
|
||||
case cpp_entity_type::using_declaration_t:
|
||||
case cpp_entity_type::count:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cppast::is_type(cpp_entity_type type) noexcept
|
||||
{
|
||||
switch (type)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue