-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathcpp_throw_statement.h
More file actions
50 lines (39 loc) · 927 Bytes
/
Copy pathcpp_throw_statement.h
File metadata and controls
50 lines (39 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (C) 2022 Satya Das and CppParser contributors
// SPDX-License-Identifier: MIT
#ifndef F15509A7_09DA_415D_ACD7_9E0129DA3999
#define F15509A7_09DA_415D_ACD7_9E0129DA3999
#include "cppast/cpp_entity.h"
#include "cppast/cpp_expression.h"
#include <memory>
namespace cppast {
class CppThrowStatement : public CppEntity
{
public:
static constexpr auto EntityType()
{
return CppEntityType::THROW_STATEMENT;
}
public:
CppThrowStatement(std::unique_ptr<CppExpression> expr)
: CppEntity(EntityType())
, expr_(std::move(expr))
{
}
CppThrowStatement()
: CppThrowStatement(std::unique_ptr<CppExpression>())
{
}
public:
bool hasException() const
{
return expr_.get() != nullptr;
}
const CppExpression& exception() const
{
return *expr_;
}
private:
std::unique_ptr<CppExpression> expr_;
};
} // namespace cppast
#endif /* F15509A7_09DA_415D_ACD7_9E0129DA3999 */