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

dtool/src/cppparser/cppType.h

Go to the documentation of this file.
00001 // Filename: cppType.h
00002 // Created by:  drose (19Oct99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
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 // This is an STL function object used to uniquely order CPPType
00034 // pointers.
00035 class CPPTypeCompare {
00036 public:
00037   bool operator () (CPPType *a, CPPType *b) const;
00038 };
00039 
00040 ///////////////////////////////////////////////////////////////////
00041 //       Class : CPPType
00042 // Description :
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

Generated on Thu May 1 22:12:56 2003 for DTool by doxygen1.3