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

dtool/src/cppparser/cppTypeDeclaration.cxx

Go to the documentation of this file.
00001 // Filename: cppTypeDeclaration.cxx
00002 // Created by:  drose (14Aug00)
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 "cppTypeDeclaration.h"
00021 
00022 ////////////////////////////////////////////////////////////////////
00023 //     Function: CPPTypeDeclaration::Constructor
00024 //       Access: Public
00025 //  Description: Constructs a new CPPTypeDeclaration object for the
00026 //               given type.
00027 ////////////////////////////////////////////////////////////////////
00028 CPPTypeDeclaration::
00029 CPPTypeDeclaration(CPPType *type) :
00030   CPPInstance(type, (CPPIdentifier *)NULL)
00031 {
00032   assert(_type != NULL);
00033   if (_type->_declaration == (CPPTypeDeclaration *)NULL) {
00034     _type->_declaration = this;
00035   }
00036 }
00037 
00038 ////////////////////////////////////////////////////////////////////
00039 //     Function: CPPTypeDeclaration::substitute_decl
00040 //       Access: Public, Virtual
00041 //  Description:
00042 ////////////////////////////////////////////////////////////////////
00043 CPPDeclaration *CPPTypeDeclaration::
00044 substitute_decl(CPPDeclaration::SubstDecl &subst,
00045                 CPPScope *current_scope, CPPScope *global_scope) {
00046   CPPDeclaration *decl =
00047     CPPInstance::substitute_decl(subst, current_scope, global_scope);
00048   assert(decl != NULL);
00049   if (decl->as_type_declaration()) {
00050     return decl;
00051   }
00052   assert(decl->as_instance() != NULL);
00053   return new CPPTypeDeclaration(decl->as_instance()->_type);
00054 }
00055 
00056 ////////////////////////////////////////////////////////////////////
00057 //     Function: CPPTypeDeclaration::output
00058 //       Access: Public, Virtual
00059 //  Description:
00060 ////////////////////////////////////////////////////////////////////
00061 void CPPTypeDeclaration::
00062 output(ostream &out, int indent_level, CPPScope *scope, bool) const {
00063   _type->output(out, indent_level, scope, true);
00064 }
00065 
00066 ////////////////////////////////////////////////////////////////////
00067 //     Function: CPPTypeDeclaration::get_subtype
00068 //       Access: Public, Virtual
00069 //  Description:
00070 ////////////////////////////////////////////////////////////////////
00071 CPPDeclaration::SubType CPPTypeDeclaration::
00072 get_subtype() const {
00073   return ST_type_declaration;
00074 }
00075 
00076 ////////////////////////////////////////////////////////////////////
00077 //     Function: CPPTypeDeclaration::as_type_declaration
00078 //       Access: Public, Virtual
00079 //  Description:
00080 ////////////////////////////////////////////////////////////////////
00081 CPPTypeDeclaration *CPPTypeDeclaration::
00082 as_type_declaration() {
00083   return this;
00084 }

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