Panda3D
eggExternalReference.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file eggExternalReference.cxx
10  * @author drose
11  * @date 1999-02-11
12  */
13 
14 #include "eggExternalReference.h"
15 #include "eggMiscFuncs.h"
16 
17 #include "indent.h"
18 #include "string_utils.h"
19 
20 TypeHandle EggExternalReference::_type_handle;
21 
22 
23 /**
24  *
25  */
26 EggExternalReference::
27 EggExternalReference(const std::string &node_name, const std::string &filename)
28  : EggFilenameNode(node_name, filename) {
29 }
30 
31 /**
32  *
33  */
34 EggExternalReference::
35 EggExternalReference(const EggExternalReference &copy)
36  : EggFilenameNode(copy) {
37 }
38 
39 /**
40  *
41  */
42 EggExternalReference &EggExternalReference::
43 operator = (const EggExternalReference &copy) {
44  EggFilenameNode::operator = (copy);
45  return *this;
46 }
47 
48 /**
49  * Writes the reference to the indicated output stream in Egg format.
50  */
52 write(std::ostream &out, int indent_level) const {
53  write_header(out, indent_level, "<File>");
54  enquote_string(out, get_filename(), indent_level + 2) << "\n";
55  indent(out, indent_level) << "}\n";
56 }
57 
58 /**
59  * Returns the default extension for this filename type.
60  */
61 std::string EggExternalReference::
63  return std::string("egg");
64 }
const Filename & get_filename() const
Returns a nonmodifiable reference to the filename.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void write_header(std::ostream &out, int indent_level, const char *egg_keyword) const
Writes the first line of the egg object, e.g.
This is an egg node that contains a filename.
ostream & enquote_string(ostream &out, const string &str, int indent_level, bool always_quote)
Writes the string to the indicated output stream.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition: indent.cxx:20
virtual void write(std::ostream &out, int indent_level) const
Writes the reference to the indicated output stream in Egg format.
Defines a reference to another egg file which should be inserted at this point.
virtual std::string get_default_extension() const
Returns the default extension for this filename type.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.