00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CPPTYPE_H
00020 #define CPPTYPE_H
00021
00022 #include <dtoolbase.h>
00023
00024 #include "cppDeclaration.h"
00025
00026 #include <set>
00027
00028 class CPPType;
00029 class CPPTypedef;
00030 class CPPTypeDeclaration;
00031
00032
00033
00034
00035 class CPPTypeCompare {
00036 public:
00037 bool operator () (CPPType *a, CPPType *b) const;
00038 };
00039
00040
00041
00042
00043
00044 class CPPType : public CPPDeclaration {
00045 public:
00046 typedef vector<CPPTypedef *> Typedefs;
00047 Typedefs _typedefs;
00048
00049 CPPType(const CPPFile &file);
00050
00051 virtual CPPType *resolve_type(CPPScope *current_scope,
00052 CPPScope *global_scope);
00053
00054 virtual bool is_tbd() const;
00055
00056 bool has_typedef_name() const;
00057 string get_typedef_name(CPPScope *scope = NULL) const;
00058
00059 virtual string get_simple_name() const;
00060 virtual string get_local_name(CPPScope *scope = NULL) const;
00061 virtual string get_fully_scoped_name() const;
00062 virtual string get_preferred_name() const;
00063
00064 virtual bool is_incomplete() const;
00065 virtual bool is_equivalent(const CPPType &other) const;
00066
00067 void output_instance(ostream &out, const string &name,
00068 CPPScope *scope) const;
00069 virtual void output_instance(ostream &out, int indent_level,
00070 CPPScope *scope,
00071 bool complete, const string &prename,
00072 const string &name) const;
00073
00074 virtual CPPType *as_type();
00075
00076
00077 static CPPType *new_type(CPPType *type);
00078
00079 static void record_preferred_name_for(const CPPType *type, const string &name);
00080 static string get_preferred_name_for(const CPPType *type);
00081
00082 CPPTypeDeclaration *_declaration;
00083
00084 protected:
00085 typedef set<CPPType *, CPPTypeCompare> Types;
00086 static Types _types;
00087
00088 typedef map<string, string> PreferredNames;
00089 static PreferredNames _preferred_names;
00090 };
00091
00092 #endif