blob: 3674e27e29eea66f7ef72e3cd24c45e0c59ff6f3 (
plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/**
** \file ast/chunk-list.hh
** \brief Declaration of ast::ChunkList.
*/
#pragma once
#include <ast/ast.hh>
namespace ast
{
/// ChunkList.
class ChunkList : public Ast
{
public:
using list_type = std::list<ChunkInterface*>;
/// Define value type
using value_type = list_type::value_type;
/// Define size type
using size_type = list_type::size_type;
/// Define reference to value type
using reference = list_type::reference;
/// Define const reference to value type
using const_reference = list_type::const_reference;
/// Define shorthand type for D-declations iterator.
using iterator = list_type::iterator;
/// Define shorthand type for D-declations const iterator.
using const_iterator = list_type::const_iterator;
iterator begin();
iterator end();
const_iterator begin() const;
const_iterator end() const;
/// Prepend \a d.
void push_front(ChunkInterface* d);
/// Append \a d.
void emplace_back(ChunkInterface* d);
/// Splice the content of \a ds in front of this list.
void splice_front(ChunkList& ds);
/// Splice the content of \a ds at the back this list.
void splice_back(ChunkList& ds);
/// Construct a ChunkList node.
ChunkList(const Location& location);
public:
/** \name Ctor & dtor.
** \{ */
/// Construct a ChunkList node.
ChunkList(const Location& location, const ChunkList::list_type& chunks);
ChunkList(const ChunkList&) = delete;
ChunkList& operator=(const ChunkList&) = delete;
/// Destroy a ChunkList node.
~ChunkList() override;
/** \} */
/// \name Visitors entry point.
/// \{ */
/// Accept a const visitor \a v.
void accept(ConstVisitor& v) const override;
/// Accept a non-const visitor \a v.
void accept(Visitor& v) override;
/// \}
/** \name Accessors.
** \{ */
/// Return declarations.
const ChunkList::list_type& chunks_get() const;
/// Return declarations.
ChunkList::list_type& chunks_get();
/** \} */
protected:
/// Declarations.
ChunkList::list_type chunks_;
};
} // namespace ast
#include <ast/chunk-list.hxx>
|