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

dtool/src/cppparser/cppClassTemplateParameter.cxx

Go to the documentation of this file.
00001 // Filename: cppClassTemplateParameter.cxx
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 
00020 #include "cppClassTemplateParameter.h"
00021 #include "cppIdentifier.h"
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //     Function: CPPClassTemplateParameter::Constructor
00025 //       Access: Public
00026 //  Description:
00027 ////////////////////////////////////////////////////////////////////
00028 CPPClassTemplateParameter::
00029 CPPClassTemplateParameter(CPPIdentifier *ident, CPPType *default_type) :
00030   CPPType(CPPFile()),
00031   _ident(ident),
00032   _default_type(default_type)
00033 {
00034 }
00035 
00036 ////////////////////////////////////////////////////////////////////
00037 //     Function: CPPClassTemplateParameter::is_fully_specified
00038 //       Access: Public, Virtual
00039 //  Description: Returns true if this declaration is an actual,
00040 //               factual declaration, or false if some part of the
00041 //               declaration depends on a template parameter which has
00042 //               not yet been instantiated.
00043 ////////////////////////////////////////////////////////////////////
00044 bool CPPClassTemplateParameter::
00045 is_fully_specified() const {
00046   return false;
00047 }
00048 
00049 ////////////////////////////////////////////////////////////////////
00050 //     Function: CPPClassTemplateParameter::output
00051 //       Access: Public, Virtual
00052 //  Description:
00053 ////////////////////////////////////////////////////////////////////
00054 void CPPClassTemplateParameter::
00055 output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
00056   if (complete) {
00057     out << "class ";
00058     _ident->output(out, scope);
00059     if (_default_type) {
00060       out << " = ";
00061       _default_type->output(out, indent_level, scope, false);
00062     }
00063   } else {
00064     _ident->output(out, scope);
00065   }
00066 }
00067 
00068 
00069 ////////////////////////////////////////////////////////////////////
00070 //     Function: CPPClassTemplateParameter::get_subtype
00071 //       Access: Public, Virtual
00072 //  Description:
00073 ////////////////////////////////////////////////////////////////////
00074 CPPDeclaration::SubType CPPClassTemplateParameter::
00075 get_subtype() const {
00076   return ST_class_template_parameter;
00077 }
00078 
00079 ////////////////////////////////////////////////////////////////////
00080 //     Function: CPPClassTemplateParameter::as_classTemplateParameter
00081 //       Access: Public, Virtual
00082 //  Description:
00083 ////////////////////////////////////////////////////////////////////
00084 CPPClassTemplateParameter *CPPClassTemplateParameter::
00085 as_class_template_parameter() {
00086   return this;
00087 }
00088 
00089 ////////////////////////////////////////////////////////////////////
00090 //     Function: CPPClassTemplateParameter::is_equal
00091 //       Access: Protected, Virtual
00092 //  Description: Called by CPPDeclaration() to determine whether this type is
00093 //               equivalent to another type of the same type.
00094 ////////////////////////////////////////////////////////////////////
00095 bool CPPClassTemplateParameter::
00096 is_equal(const CPPDeclaration *other) const {
00097   const CPPClassTemplateParameter *ot = ((CPPDeclaration *)other)->as_class_template_parameter();
00098   assert(ot != NULL);
00099 
00100   if (_default_type != ot->_default_type) {
00101     return false;
00102   }
00103 
00104   return *_ident == *ot->_ident;
00105 }
00106 
00107 
00108 ////////////////////////////////////////////////////////////////////
00109 //     Function: CPPClassTemplateParameter::is_less
00110 //       Access: Protected, Virtual
00111 //  Description: Called by CPPDeclaration() to determine whether this type
00112 //               should be ordered before another type of the same
00113 //               type, in an arbitrary but fixed ordering.
00114 ////////////////////////////////////////////////////////////////////
00115 bool CPPClassTemplateParameter::
00116 is_less(const CPPDeclaration *other) const {
00117   const CPPClassTemplateParameter *ot = ((CPPDeclaration *)other)->as_class_template_parameter();
00118   assert(ot != NULL);
00119 
00120   if (_default_type != ot->_default_type) {
00121     return _default_type < ot->_default_type;
00122   }
00123 
00124   return *_ident < *ot->_ident;
00125 }

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