root / trunk / compiler / cppAst / ast / types / TupleType.hpp @ 7
1 |
/**
|
---|---|
2 |
*
|
3 |
* OOAS Compiler - C++ AST
|
4 |
*
|
5 |
* Copyright 2015, AIT Austrian Institute of Technology.
|
6 |
* All rights reserved.
|
7 |
*
|
8 |
* SEE THE "LICENSE" FILE FOR THE TERMS UNDER WHICH THIS FILE IS PROVIDED.
|
9 |
*
|
10 |
* If you modify the file please update the list of contributors below to in-
|
11 |
* clude your name. Please also stick to the coding convention of using TABs
|
12 |
* to do the basic (block-level) indentation and spaces for anything after
|
13 |
* that. (Enable the display of special chars and it should be pretty obvious
|
14 |
* what this means.) Also, remove all trailing whitespace.
|
15 |
*
|
16 |
* Contributors:
|
17 |
* Willibald Krenn (AIT)
|
18 |
* Stephan Zimmerer (AIT)
|
19 |
* Christoph Czurda (AIT)
|
20 |
*
|
21 |
*/
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
#pragma once
|
27 |
|
28 |
#include <ast/types/Type.hpp> |
29 |
#include <ast/Containers.hpp> |
30 |
#include <deque> |
31 |
#include <ast/IAstVisitor.hpp> |
32 |
#include <string> |
33 |
|
34 |
namespace Ast {
|
35 |
|
36 |
class TupleType final |
37 |
: public Type
|
38 |
{ |
39 |
protected:
|
40 |
TypeList m_innerTypes; |
41 |
|
42 |
TupleType(): Type(TypeKind::TupleType), m_innerTypes() {} |
43 |
TupleType(const TupleType &toCopy): Type(toCopy), m_innerTypes(toCopy.m_innerTypes) {}
|
44 |
|
45 |
static TupleType* create() {return new TupleType();} |
46 |
static TupleType* createCopy(const TupleType& toCopy) {return new TupleType(toCopy);} |
47 |
public:
|
48 |
friend class Ast; |
49 |
friend class Type; |
50 |
|
51 |
|
52 |
void init(TypeIdentifier* identifierRef, bool anonymousType, TypeList* typeListRef) { |
53 |
Type::init(identifierRef, anonymousType); |
54 |
m_innerTypes = std::move(*typeListRef); |
55 |
} |
56 |
|
57 |
TypeList& innerTypes() {return m_innerTypes;};
|
58 |
|
59 |
void addType(Type* aType) {m_innerTypes.push_back(aType);};
|
60 |
void accept(IAstVisitor& visitor) override {visitor.visit(this);}; |
61 |
}; |
62 |
} |