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

dtool/src/cppparser/cppTemplateParameterList.h

Go to the documentation of this file.
00001 // Filename: cppTemplateParameterList.h
00002 // Created by:  drose (28Oct99)
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 CPPTEMPLATEPARAMETERLIST_H
00020 #define CPPTEMPLATEPARAMETERLIST_H
00021 
00022 #include <dtoolbase.h>
00023 
00024 #include "cppDeclaration.h"
00025 
00026 #include <vector>
00027 #include <string>
00028 
00029 class CPPScope;
00030 
00031 ///////////////////////////////////////////////////////////////////
00032 //       Class : CPPTemplateParameterList
00033 // Description : This class serves to store the parameter list for a
00034 //               template function or class, both for the formal
00035 //               parameter list (given when the template is defined)
00036 //               and for the actual parameter list (given when the
00037 //               template is instantiated).
00038 ////////////////////////////////////////////////////////////////////
00039 class CPPTemplateParameterList {
00040 public:
00041   CPPTemplateParameterList();
00042 
00043   string get_string() const;
00044   void build_subst_decl(const CPPTemplateParameterList &formal_params,
00045                         CPPDeclaration::SubstDecl &subst,
00046                         CPPScope *current_scope, CPPScope *global_scope) const;
00047 
00048   bool is_fully_specified() const;
00049   bool is_tbd() const;
00050 
00051   bool operator == (const CPPTemplateParameterList &other) const;
00052   bool operator != (const CPPTemplateParameterList &other) const;
00053   bool operator < (const CPPTemplateParameterList &other) const;
00054 
00055   CPPTemplateParameterList *substitute_decl(CPPDeclaration::SubstDecl &subst,
00056                                             CPPScope *current_scope,
00057                                             CPPScope *global_scope);
00058 
00059   void output(ostream &out, CPPScope *scope) const;
00060   void write_formal(ostream &out, CPPScope *scope) const;
00061 
00062   typedef vector<CPPDeclaration *> Parameters;
00063   Parameters _parameters;
00064 };
00065 
00066 inline ostream &
00067 operator << (ostream &out, const CPPTemplateParameterList &plist) {
00068   plist.output(out, (CPPScope *)NULL);
00069   return out;
00070 }
00071 
00072 
00073 // This is an STL function object used to uniquely order
00074 // CPPTemplateParameterList pointers.
00075 class CPPTPLCompare {
00076 public:
00077   bool operator () (const CPPTemplateParameterList *a,
00078                     const CPPTemplateParameterList *b) const {
00079     return (*a) < (*b);
00080   }
00081 };
00082 
00083 #endif
00084 
00085 

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