Panda3D
dcDeclaration.h
1 // Filename: dcDeclaration.h
2 // Created by: drose (18Jun04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef DCDECLARATION_H
16 #define DCDECLARATION_H
17 
18 #include "dcbase.h"
19 
20 class DCClass;
21 class DCSwitch;
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : DCDeclaration
25 // Description : This is a common interface for a declaration in a DC
26 // file. Currently, this is either a class or a typedef
27 // declaration (import declarations are still collected
28 // together at the top, and don't inherit from this
29 // object). Its only purpose is so that classes and
30 // typedefs can be stored in one list together so they
31 // can be ordered correctly on output.
32 ////////////////////////////////////////////////////////////////////
33 class EXPCL_DIRECT DCDeclaration {
34 public:
35  virtual ~DCDeclaration();
36 
37 PUBLISHED:
38  virtual DCClass *as_class();
39  virtual const DCClass *as_class() const;
40  virtual DCSwitch *as_switch();
41  virtual const DCSwitch *as_switch() const;
42 
43  virtual void output(ostream &out) const;
44  void write(ostream &out, int indent_level) const;
45 
46 public:
47  virtual void output(ostream &out, bool brief) const=0;
48  virtual void write(ostream &out, bool brief, int indent_level) const=0;
49 };
50 
51 INLINE ostream &operator << (ostream &out, const DCDeclaration &decl) {
52  decl.output(out);
53  return out;
54 }
55 
56 #endif
57 
virtual void output(ostream &out) const
Write a string representation of this instance to <out>.
This represents a switch statement, which can appear inside a class body and represents two or more a...
Definition: dcSwitch.h:33
Defines a particular DistributedClass as read from an input .dc file.
Definition: dcClass.h:47
This is a common interface for a declaration in a DC file.
Definition: dcDeclaration.h:33