-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathcpp_var_list.h
More file actions
62 lines (52 loc) · 1.33 KB
/
Copy pathcpp_var_list.h
File metadata and controls
62 lines (52 loc) · 1.33 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
59
60
61
62
// Copyright (C) 2022 Satya Das and CppParser contributors
// SPDX-License-Identifier: MIT
#ifndef E9679E26_EB4E_4C8F_952F_FEDCCFB07380
#define E9679E26_EB4E_4C8F_952F_FEDCCFB07380
#include "cppast/cpp_entity.h"
#include "cppast/cpp_var.h"
namespace cppast {
class CppVarDeclInList : public CppTypeModifier, public CppVarDecl
{
public:
CppVarDeclInList(CppTypeModifier modifier, CppVarDecl varDecl)
: CppTypeModifier(modifier)
, CppVarDecl(std::move(varDecl))
{
}
};
using CppVarDeclList = std::vector<CppVarDeclInList>;
/**
* @brief List of variables declared in a line without repeating its type, e.g. int i, j; is a var-list.
*/
class CppVarList : public CppEntity
{
public:
static constexpr auto EntityType()
{
return CppEntityType::VAR_LIST;
}
public:
CppVarList(CppVar* firstVar, CppVarDeclInList varDecl)
: CppEntity(EntityType())
, firstVar_(firstVar)
{
addVarDecl(std::move(varDecl));
}
void addVarDecl(CppVarDeclInList varDecl)
{
varDeclList_.push_back(std::move(varDecl));
}
const std::unique_ptr<CppVar>& firstVar() const
{
return firstVar_;
}
const CppVarDeclList& varDeclList() const
{
return varDeclList_;
}
private:
std::unique_ptr<CppVar> firstVar_;
CppVarDeclList varDeclList_;
};
} // namespace cppast
#endif /* E9679E26_EB4E_4C8F_952F_FEDCCFB07380 */