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
15#include "eggMiscFuncs.h"
16
17#include "indent.h"
18#include "string_utils.h"
19
20TypeHandle EggExternalReference::_type_handle;
21
22
23/**
24 *
25 */
26EggExternalReference::
27EggExternalReference(const std::string &node_name, const std::string &filename)
28 : EggFilenameNode(node_name, filename) {
29}
30
31/**
32 *
33 */
34EggExternalReference::
35EggExternalReference(const EggExternalReference &copy)
36 : EggFilenameNode(copy) {
37}
38
39/**
40 *
41 */
42EggExternalReference &EggExternalReference::
43operator = (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 */
52write(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 */
63 return std::string("egg");
64}
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.
virtual void write(std::ostream &out, int indent_level) const
Writes the reference to the indicated output stream in Egg format.
This is an egg node that contains a filename.
const Filename & get_filename() const
Returns a nonmodifiable reference to the filename.
void write_header(std::ostream &out, int indent_level, const char *egg_keyword) const
Writes the first line of the egg object, e.g.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition: dcindent.cxx:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.