14 virtual void write_c(std::ostream& out)
20 class BasicType : public AtomicType {
22 static BasicType VOID;
23 static BasicType BOOL;
24 static BasicType CHAR;
25 static BasicType SHORT;
27 static BasicType LONG;
28 static BasicType FLOAT;
29 static BasicType DOUBLE;
32 BasicType(const std::string& name)
41 : atomic_type(0), _const(false), _static(false), pointer(0), ref(0)
44 void write_c_type(std::ostream& out)
50 atomic_type->write_c(out);
51 for(int i = 0; i < pointer; ++i)
53 for(int i = 0; i < ref; ++i)
59 if(atomic_type == &BasicType::VOID && pointer == 0)
64 AtomicType* atomic_type;
67 // number of '*' in the type declaration...
69 // number of '&' in the type declaration...
73 class StringType : public AtomicType {
77 this->name = "string";
78 assert(_instance == 0);
83 assert(_instance == this);
87 static StringType* instance()
92 virtual void write_c(std::ostream& out)
98 static StringType* _instance;
109 virtual ~ClassMember()
117 Visbility visibility;
120 class Function : public ClassMember {
130 std::vector<Parameter> parameters;
133 class Class : public AtomicType {
136 for(std::vector<ClassMember*>::iterator i = members.begin();
137 i != members.end(); ++i)
141 std::vector<ClassMember*> members;
149 class CompilationUnit {
152 for(std::vector<Function*>::iterator i = functions.begin();
153 i != functions.end(); ++i)
155 for(std::vector<AtomicType*>::iterator i = types.begin();
156 i != types.end(); ++i)
158 for(std::vector<Namespace*>::iterator i = namespaces.begin();
159 i != namespaces.end(); ++i)
163 std::vector<Function*> functions;
164 std::vector<AtomicType*> types;
165 std::vector<Namespace*> namespaces;