Panda3D
|
00001 // Filename: dcDeclaration.h 00002 // Created by: drose (18Jun04) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef DCDECLARATION_H 00016 #define DCDECLARATION_H 00017 00018 #include "dcbase.h" 00019 00020 class DCClass; 00021 class DCSwitch; 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Class : DCDeclaration 00025 // Description : This is a common interface for a declaration in a DC 00026 // file. Currently, this is either a class or a typedef 00027 // declaration (import declarations are still collected 00028 // together at the top, and don't inherit from this 00029 // object). Its only purpose is so that classes and 00030 // typedefs can be stored in one list together so they 00031 // can be ordered correctly on output. 00032 //////////////////////////////////////////////////////////////////// 00033 class EXPCL_DIRECT DCDeclaration { 00034 public: 00035 virtual ~DCDeclaration(); 00036 00037 PUBLISHED: 00038 virtual DCClass *as_class(); 00039 virtual const DCClass *as_class() const; 00040 virtual DCSwitch *as_switch(); 00041 virtual const DCSwitch *as_switch() const; 00042 00043 virtual void output(ostream &out) const; 00044 void write(ostream &out, int indent_level) const; 00045 00046 public: 00047 virtual void output(ostream &out, bool brief) const=0; 00048 virtual void write(ostream &out, bool brief, int indent_level) const=0; 00049 }; 00050 00051 INLINE ostream &operator << (ostream &out, const DCDeclaration &decl) { 00052 decl.output(out); 00053 return out; 00054 } 00055 00056 #endif 00057