00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CPPINSTANCEIDENTIFIER_H
00020 #define CPPINSTANCEIDENTIFIER_H
00021
00022 #include <dtoolbase.h>
00023
00024 #include <vector>
00025 #include <string>
00026
00027 using namespace std;
00028
00029 class CPPIdentifier;
00030 class CPPParameterList;
00031 class CPPType;
00032 class CPPExpression;
00033 class CPPScope;
00034 class CPPPreprocessor;
00035
00036 enum CPPInstanceIdentifierType {
00037 IIT_pointer,
00038 IIT_reference,
00039 IIT_scoped_pointer,
00040 IIT_array,
00041 IIT_const,
00042 IIT_paren,
00043 IIT_func,
00044 };
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 class CPPInstanceIdentifier {
00055 public:
00056 CPPInstanceIdentifier(CPPIdentifier *ident);
00057
00058 CPPType *unroll_type(CPPType *start_type);
00059
00060 void add_modifier(CPPInstanceIdentifierType type);
00061 void add_func_modifier(CPPParameterList *params, int flags);
00062 void add_scoped_pointer_modifier(CPPIdentifier *scoping);
00063 void add_array_modifier(CPPExpression *expr);
00064
00065 CPPScope *get_scope(CPPScope *current_scope, CPPScope *global_scope,
00066 CPPPreprocessor *error_sink = NULL) const;
00067
00068 CPPIdentifier *_ident;
00069
00070 class Modifier {
00071 public:
00072 Modifier(CPPInstanceIdentifierType type);
00073 static Modifier func_type(CPPParameterList *params, int flags);
00074 static Modifier array_type(CPPExpression *expr);
00075 static Modifier scoped_pointer_type(CPPIdentifier *scoping);
00076
00077 CPPInstanceIdentifierType _type;
00078 CPPParameterList *_func_params;
00079 int _func_flags;
00080 CPPIdentifier *_scoping;
00081 CPPExpression *_expr;
00082 };
00083 typedef vector<Modifier> Modifiers;
00084 Modifiers _modifiers;
00085
00086 private:
00087 CPPType *
00088 r_unroll_type(CPPType *start_type, Modifiers::const_iterator mi);
00089 };
00090
00091 #endif