-
Notifications
You must be signed in to change notification settings - Fork 171
/
Copy pathcpp_enum.cpp
45 lines (36 loc) · 1.18 KB
/
cpp_enum.cpp
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
// Copyright (C) 2017-2023 Jonathan Müller and cppast contributors
// SPDX-License-Identifier: MIT
#include <cppast/cpp_enum.hpp>
#include <cppast/cpp_entity_kind.hpp>
using namespace cppast;
cpp_entity_kind cpp_enum_value::kind() noexcept
{
return cpp_entity_kind::enum_value_t;
}
std::unique_ptr<cpp_enum_value> cpp_enum_value::build(const cpp_entity_index& idx, cpp_entity_id id,
std::string name,
std::unique_ptr<cpp_expression> value)
{
auto result
= std::unique_ptr<cpp_enum_value>(new cpp_enum_value(std::move(name), std::move(value)));
idx.register_definition(std::move(id), type_safe::ref(*result));
return result;
}
cpp_entity_kind cpp_enum_value::do_get_entity_kind() const noexcept
{
return kind();
}
cpp_entity_kind cpp_enum::kind() noexcept
{
return cpp_entity_kind::enum_t;
}
cpp_entity_kind cpp_enum::do_get_entity_kind() const noexcept
{
return kind();
}
type_safe::optional<cpp_scope_name> cpp_enum::do_get_scope_name() const
{
if (scoped_)
return type_safe::ref(*this);
return type_safe::nullopt;
}