forked from standardese/cppast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpp_member_variable.cpp
More file actions
58 lines (48 loc) · 2.14 KB
/
Copy pathcpp_member_variable.cpp
File metadata and controls
58 lines (48 loc) · 2.14 KB
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
51
52
53
54
55
56
57
58
// Copyright (C) 2017-2018 Jonathan Müller <[email protected]>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
#include <cppast/cpp_member_variable.hpp>
#include <cppast/cpp_entity_kind.hpp>
using namespace cppast;
cpp_entity_kind cpp_member_variable::kind() noexcept
{
return cpp_entity_kind::member_variable_t;
}
std::unique_ptr<cpp_member_variable> cpp_member_variable::build(const cpp_entity_index& idx,
cpp_entity_id id, std::string name,
std::unique_ptr<cpp_type> type,
std::unique_ptr<cpp_expression> def,
bool is_mutable)
{
auto result = std::unique_ptr<cpp_member_variable>(
new cpp_member_variable(std::move(name), std::move(type), std::move(def), is_mutable));
idx.register_definition(std::move(id), type_safe::cref(*result));
return result;
}
cpp_entity_kind cpp_member_variable::do_get_entity_kind() const noexcept
{
return kind();
}
cpp_entity_kind cpp_bitfield::kind() noexcept
{
return cpp_entity_kind::bitfield_t;
}
std::unique_ptr<cpp_bitfield> cpp_bitfield::build(const cpp_entity_index& idx, cpp_entity_id id,
std::string name, std::unique_ptr<cpp_type> type,
unsigned no_bits, bool is_mutable)
{
auto result = std::unique_ptr<cpp_bitfield>(
new cpp_bitfield(std::move(name), std::move(type), no_bits, is_mutable));
idx.register_definition(std::move(id), type_safe::cref(*result));
return result;
}
std::unique_ptr<cpp_bitfield> cpp_bitfield::build(std::unique_ptr<cpp_type> type, unsigned no_bits,
bool is_mutable)
{
return std::unique_ptr<cpp_bitfield>(
new cpp_bitfield("", std::move(type), no_bits, is_mutable));
}
cpp_entity_kind cpp_bitfield::do_get_entity_kind() const noexcept
{
return kind();
}