root/trunk/compiler/cppAst/ast/identifiers/AttributeIdentifier.hpp
| 7 | krennw | /**
 | |
|   *
 | |||
|   *                  OOAS Compiler - C++ AST
 | |||
|   *
 | |||
|   * Copyright 2015, AIT Austrian Institute of Technology.
 | |||
|   * All rights reserved.
 | |||
|   *
 | |||
|   * SEE THE "LICENSE" FILE FOR THE TERMS UNDER WHICH THIS FILE IS PROVIDED.
 | |||
|   *
 | |||
|   * If you modify the file please update the list of contributors below to in-
 | |||
|   * clude your name. Please also stick to the coding convention of using TABs
 | |||
|   * to do the basic (block-level) indentation and spaces for anything after
 | |||
|   * that. (Enable the display of special chars and it should be pretty obvious
 | |||
|   * what this means.) Also, remove all trailing whitespace.
 | |||
|   *
 | |||
|   * Contributors:
 | |||
|   *               Willibald Krenn (AIT)
 | |||
|   *               Stephan Zimmerer (AIT)
 | |||
|   *               Christoph Czurda (AIT)
 | |||
|   *
 | |||
|   */
 | |||
| 2 | krennw | ||
| #pragma once
 | |||
| #include <ast/identifiers/ValueReferenceIdentifier.hpp>
 | |||
| #include <ast/expressions/Expression.hpp>
 | |||
| namespace Ast {
 | |||
| class AttributeIdentifier final
 | |||
| 	: public ValueReferenceIdentifier
 | |||
| {
 | |||
| protected:
 | |||
| 	bool m_isStatic;
 | |||
| 	bool m_isObservable;
 | |||
| 	bool m_isControllable;
 | |||
| 	Expression* m_initializer;
 | |||
| 	AttributeIdentifier():
 | |||
| 		ValueReferenceIdentifier(IdentifierKind::AttributeIdentifier),
 | |||
| 		m_isStatic    (false),
 | |||
| 		m_isObservable (false),
 | |||
| 		m_isControllable (false),
 | |||
| 		m_initializer (nullptr)
 | |||
| 	{}
 | |||
| 	AttributeIdentifier(const AttributeIdentifier& toCopy) :
 | |||
| 		ValueReferenceIdentifier(toCopy),
 | |||
| 		m_isStatic    (toCopy.m_isStatic),
 | |||
| 		m_isObservable (toCopy.m_isObservable),
 | |||
| 		m_isControllable (toCopy.m_isControllable),
 | |||
| 		m_initializer (toCopy.m_initializer)
 | |||
| 	{}
 | |||
| 	static AttributeIdentifier* create() {return new AttributeIdentifier();}
 | |||
| 	static AttributeIdentifier* createCopy(const AttributeIdentifier& toCopy) {return new AttributeIdentifier(toCopy);}
 | |||
| public:
 | |||
| 	friend class Ast;
 | |||
| 	friend class Identifier;
 | |||
| 	void init (std::int32_t line, std::int32_t col, const char* text,
 | |||
| 			IScope* scopeRef, Type* typeRef, Expression* initRef,
 | |||
| 			bool isStatic, bool isControllable, bool isObservable)
 | |||
| 	{
 | |||
| 		ValueReferenceIdentifier::init(line,col,text,scopeRef,typeRef);
 | |||
| 		m_initializer = initRef;
 | |||
| 		m_isStatic = isStatic;
 | |||
| 		m_isControllable = isControllable;
 | |||
| 		m_isObservable = isObservable;
 | |||
| 	}
 | |||
| 	Expression* initializer() const { return m_initializer; };
 | |||
| 	bool isStatic() const { return m_isStatic; };
 | |||
| 	bool isObservable() const { return m_isObservable; };
 | |||
| 	bool isControllable() const { return m_isControllable; };
 | |||
| 	void accept(IAstVisitor& visitor) override { visitor.visit(this); };
 | |||
| 	void setInitializer(Expression* newExpr) { m_initializer = newExpr; };
 | |||
| };
 | |||
| }
 |