Add support for array types
This commit is contained in:
parent
b183513166
commit
0eb14d8cab
4 changed files with 111 additions and 11 deletions
|
|
@ -15,6 +15,7 @@ namespace cppast
|
|||
{
|
||||
public:
|
||||
/// \returns A newly created array.
|
||||
/// \notes `size` may be `nullptr`.
|
||||
static std::unique_ptr<cpp_array_type> build(std::unique_ptr<cpp_type> type,
|
||||
std::unique_ptr<cpp_expression> size)
|
||||
{
|
||||
|
|
@ -28,10 +29,11 @@ namespace cppast
|
|||
return *type_;
|
||||
}
|
||||
|
||||
/// \returns A [cppast::cpp_expression]() that is the size of the array.
|
||||
const cpp_expression& size() const noexcept
|
||||
/// \returns An optional reference to the [cppast::cpp_expression]() that is the size of the array.
|
||||
/// \notes An unsized array - `T[]` - does not have a size.
|
||||
type_safe::optional_ref<const cpp_expression> size() const noexcept
|
||||
{
|
||||
return *size_;
|
||||
return type_safe::opt_cref(size_.get());
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace cppast
|
|||
/// An unexposed [cppast::cpp_expression]().
|
||||
///
|
||||
/// There is no further information than a string available.
|
||||
class cpp_unexposed_expression final : cpp_expression
|
||||
class cpp_unexposed_expression final : public cpp_expression
|
||||
{
|
||||
public:
|
||||
/// \returns A newly created unexposed expression.
|
||||
|
|
@ -90,7 +90,7 @@ namespace cppast
|
|||
};
|
||||
|
||||
/// A [cppast::cpp_expression]() that is a literal.
|
||||
class cpp_literal_expression final : cpp_expression
|
||||
class cpp_literal_expression final : public cpp_expression
|
||||
{
|
||||
public:
|
||||
/// \returns A newly created literal expression.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue