Panda3D
eggExternalReference.cxx
1 // Filename: eggExternalReference.cxx
2 // Created by: drose (11Feb99)
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 #include "eggExternalReference.h"
16 #include "eggMiscFuncs.h"
17 
18 #include "indent.h"
19 #include "string_utils.h"
20 
21 TypeHandle EggExternalReference::_type_handle;
22 
23 
24 ////////////////////////////////////////////////////////////////////
25 // Function: EggExternalReference::Constructor
26 // Access: Public
27 // Description:
28 ////////////////////////////////////////////////////////////////////
29 EggExternalReference::
30 EggExternalReference(const string &node_name, const string &filename)
31  : EggFilenameNode(node_name, filename) {
32 }
33 
34 ////////////////////////////////////////////////////////////////////
35 // Function: EggExternalReference::Copy constructor
36 // Access: Public
37 // Description:
38 ////////////////////////////////////////////////////////////////////
39 EggExternalReference::
40 EggExternalReference(const EggExternalReference &copy)
41  : EggFilenameNode(copy) {
42 }
43 
44 ////////////////////////////////////////////////////////////////////
45 // Function: EggExternalReference::Copy assignment operator
46 // Access: Public
47 // Description:
48 ////////////////////////////////////////////////////////////////////
49 EggExternalReference &EggExternalReference::
50 operator = (const EggExternalReference &copy) {
51  EggFilenameNode::operator = (copy);
52  return *this;
53 }
54 
55 ////////////////////////////////////////////////////////////////////
56 // Function: EggExternalReference::write
57 // Access: Public, Virtual
58 // Description: Writes the reference to the indicated output
59 // stream in Egg format.
60 ////////////////////////////////////////////////////////////////////
62 write(ostream &out, int indent_level) const {
63  write_header(out, indent_level, "<File>");
64  enquote_string(out, get_filename(), indent_level + 2) << "\n";
65  indent(out, indent_level) << "}\n";
66 }
67 
68 ////////////////////////////////////////////////////////////////////
69 // Function: EggExternalReference::get_default_extension
70 // Access: Public, Virtual
71 // Description: Returns the default extension for this filename type.
72 ////////////////////////////////////////////////////////////////////
75  return string("egg");
76 }
const Filename & get_filename() const
Returns a nonmodifiable reference to the filename.
This is an egg node that contains a filename.
virtual string get_default_extension() const
Returns the default extension for this filename type.
virtual void write(ostream &out, int indent_level) const
Writes the reference to the indicated output stream in Egg format.
void write_header(ostream &out, int indent_level, const char *egg_keyword) const
Writes the first line of the egg object, e.g.
Defines a reference to another egg file which should be inserted at this point.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85