2013-12-23 01:26:24 -06:00
|
|
|
#ifndef TYPE_H
|
|
|
|
|
#define TYPE_H
|
|
|
|
|
|
|
|
|
|
#ifndef NULL
|
2014-03-06 13:13:40 -05:00
|
|
|
#define NULL ((void*)0)
|
2013-12-23 01:26:24 -06:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <iostream>
|
2014-07-18 08:52:15 -07:00
|
|
|
#include <set>
|
2013-12-23 01:26:24 -06:00
|
|
|
|
2014-01-07 13:14:58 -05:00
|
|
|
//Circular dependency
|
|
|
|
|
class ASTData;
|
|
|
|
|
#include "ASTData.h"
|
2013-12-23 01:26:24 -06:00
|
|
|
#include "util.h"
|
|
|
|
|
|
2014-05-19 20:00:35 -04:00
|
|
|
enum ValueType {none, template_type, template_type_type, void_type, boolean, integer, floating, double_percision, character };
|
2013-12-23 01:26:24 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class Type {
|
|
|
|
|
public:
|
|
|
|
|
Type();
|
2014-07-18 08:52:15 -07:00
|
|
|
Type(ValueType typeIn, int indirectionIn = 0);
|
|
|
|
|
Type(ValueType typeIn, std::set<std::string> traitsIn); //Mostly for template type type's
|
|
|
|
|
Type(NodeTree<ASTData>* typeDefinitionIn, int indirectionIn = 0);
|
|
|
|
|
Type(NodeTree<ASTData>* typeDefinitionIn, std::set<std::string> traitsIn);
|
|
|
|
|
Type(ValueType typeIn, NodeTree<ASTData>* typeDefinitionIn, int indirectionIn, std::set<std::string> traitsIn);
|
|
|
|
|
Type(ValueType typeIn, NodeTree<Symbol>* templateDefinitionIn, std::set<std::string> traitsIn = std::set<std::string>());
|
2013-12-23 01:26:24 -06:00
|
|
|
~Type();
|
2014-03-06 13:13:40 -05:00
|
|
|
bool const operator==(const Type &other)const;
|
|
|
|
|
bool const operator!=(const Type &other)const;
|
2014-05-05 13:52:12 -04:00
|
|
|
Type* clone();
|
2014-07-20 14:21:41 -07:00
|
|
|
std::string toString(bool showTraits = true);
|
2014-05-19 20:00:35 -04:00
|
|
|
int getIndirection();
|
|
|
|
|
void setIndirection(int indirectionIn);
|
|
|
|
|
void increaseIndirection();
|
|
|
|
|
void decreaseIndirection();
|
|
|
|
|
void modifyIndirection(int mod);
|
2014-06-09 00:21:38 -07:00
|
|
|
|
|
|
|
|
ValueType baseType;
|
2014-01-07 13:14:58 -05:00
|
|
|
NodeTree<ASTData>* typeDefinition;
|
2014-05-09 02:56:55 -04:00
|
|
|
NodeTree<Symbol>* templateDefinition;
|
2014-06-09 00:21:38 -07:00
|
|
|
std::map<std::string, Type*> templateTypeReplacement;
|
2014-07-18 08:52:15 -07:00
|
|
|
std::set<std::string> traits;
|
|
|
|
|
private:
|
2014-05-19 20:00:35 -04:00
|
|
|
int indirection;
|
2013-12-23 01:26:24 -06:00
|
|
|
};
|
|
|
|
|
|
2014-06-09 00:21:38 -07:00
|
|
|
#endif
|