Implement attribute parsing
This commit is contained in:
parent
151e0b1a81
commit
ccb2aaa189
15 changed files with 512 additions and 86 deletions
|
|
@ -17,6 +17,8 @@ namespace cppast
|
|||
/// The known C++ attributes.
|
||||
enum class cpp_attribute_kind
|
||||
{
|
||||
// update get_attribute_kind() in tokenizer, when updating this
|
||||
|
||||
alignas_,
|
||||
carries_dependency,
|
||||
deprecated,
|
||||
|
|
@ -52,6 +54,8 @@ namespace cppast
|
|||
case cpp_attribute_kind::unknown:
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
return "<error>";
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
|
|
|
|||
|
|
@ -144,17 +144,19 @@ namespace cppast
|
|||
}
|
||||
|
||||
/// \effects Builds a [cppast::cpp_base_class]() and adds it.
|
||||
void base_class(std::string name, std::unique_ptr<cpp_type> type,
|
||||
cpp_access_specifier_kind access, bool is_virtual)
|
||||
cpp_base_class& base_class(std::string name, std::unique_ptr<cpp_type> type,
|
||||
cpp_access_specifier_kind access, bool is_virtual)
|
||||
{
|
||||
add_base_class(
|
||||
return add_base_class(
|
||||
cpp_base_class::build(std::move(name), std::move(type), access, is_virtual));
|
||||
}
|
||||
|
||||
/// \effects Adds a new base class.
|
||||
void add_base_class(std::unique_ptr<cpp_base_class> base) noexcept
|
||||
cpp_base_class& add_base_class(std::unique_ptr<cpp_base_class> base) noexcept
|
||||
{
|
||||
auto bptr = base.get();
|
||||
class_->bases_.push_back(*class_, std::move(base));
|
||||
return *bptr;
|
||||
}
|
||||
|
||||
/// \effects Builds a [cppast::cpp_access_specifier]() and adds it.
|
||||
|
|
|
|||
|
|
@ -136,6 +136,12 @@ namespace cppast
|
|||
attributes_.push_back(std::move(attr));
|
||||
}
|
||||
|
||||
/// \effects Adds multiple arguments for that entity.
|
||||
void add_attribute(const cpp_attribute_list& list) noexcept
|
||||
{
|
||||
attributes_.insert(attributes_.end(), list.begin(), list.end());
|
||||
}
|
||||
|
||||
/// \returns The specified user data.
|
||||
void* user_data() const noexcept
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue