Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

typeinfo.h

Go to the documentation of this file.
00001 /*
00002   Copyright (C) 1997-2001 Shigeru Chiba, Tokyo Institute of Technology.
00003 
00004   Permission to use, copy, distribute and modify this software and   
00005   its documentation for any purpose is hereby granted without fee,        
00006   provided that the above copyright notice appear in all copies and that 
00007   both that copyright notice and this permission notice appear in 
00008   supporting documentation.
00009 
00010   Shigeru Chiba makes no representations about the suitability of this 
00011   software for any purpose.  It is provided "as is" without express or
00012   implied warranty.
00013 */
00014 
00015 #ifndef _typeinfo_h
00016 #define _typeinfo_h
00017 
00018 #include "types.h"
00019 
00020 class Ptree;
00021 class Class;
00022 class Environment;
00023 class Bind;
00024 
00025 enum TypeInfoId {
00026     UndefType,
00027     BuiltInType, ClassType, EnumType, TemplateType,
00028     PointerType, ReferenceType, PointerToMemberType,
00029     ArrayType, FunctionType
00030 };
00031 
00032 // These are used by TypeInfo::WhatBuiltinType()
00033 //
00034 enum {
00035     CharType = 1, IntType = 2, ShortType = 4, LongType = 8,
00036     LongLongType = 16, SignedType = 32, UnsignedType = 64, FloatType = 128,
00037     DoubleType = 256, LongDoubleType = 512, VoidType = 1024,
00038     BooleanType = 2048
00039 };
00040 
00041 /*
00042   TypeInfo interprets an encoded type name.  For details of the encoded
00043   type name, see class Encoding in encoding.h and encoding.cc.
00044 */
00045 class OCXXMOP TypeInfo : public LightObject {
00046 public:
00047     TypeInfo();
00048     void Unknown();
00049     void Set(char*, Environment*);
00050     void Set(Class*);
00051     void SetVoid();
00052     void SetInt();
00053     void SetMember(Ptree*);
00054 
00055     TypeInfoId WhatIs();
00056 
00057     bool IsNoReturnType();
00058 
00059     bool IsConst();
00060     bool IsVolatile();
00061 
00062     uint IsBuiltInType();
00063     bool IsFunction();
00064     bool IsEllipsis();
00065     bool IsPointerType();
00066     bool IsReferenceType();
00067     bool IsArray();
00068     bool IsPointerToMember();
00069     bool IsTemplateClass();
00070     Class* ClassMetaobject();
00071     bool IsClass(Class*&);
00072     bool IsEnum();
00073     bool IsEnum(Ptree*& spec);
00074 
00075     void Dereference() { --refcount; }
00076     void Dereference(TypeInfo&);
00077     void Reference() { ++refcount; }
00078     void Reference(TypeInfo&);
00079     bool NthArgument(int, TypeInfo&);
00080     int NumOfArguments();
00081     bool NthTemplateArgument(int, TypeInfo&);
00082 
00083     Ptree* FullTypeName();
00084     Ptree* MakePtree(Ptree* = nil);
00085 
00086 private:
00087     static Ptree* GetQualifiedName(Environment*, Ptree*);
00088     static Ptree* GetQualifiedName2(Class*);
00089     void Normalize();
00090     bool ResolveTypedef(Environment*&, char*&, bool);
00091 
00092     static char* SkipCv(char*, Environment*&);
00093     static char* SkipName(char*, Environment*);
00094     static char* GetReturnType(char*, Environment*);
00095     static char* SkipType(char*, Environment*);
00096 
00097 private:
00098     int refcount;
00099     char* encode;
00100     Class* metaobject;
00101     Environment* env;
00102 };
00103 
00104 #endif /* _typeinfo_h */

Generated on Mon Feb 10 17:32:59 2003 for VFiasco Semantics Compiler by doxygen1.2.15