Panda3D
Loading...
Searching...
No Matches
interrogateComponent.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 interrogateComponent.cxx
10 * @author drose
11 * @date 2000-08-08
12 */
13
16
17// This static string is just kept around as a handy bogus return value for
18// functions that must return a const string reference.
19std::string InterrogateComponent::_empty_string;
20
21/**
22 * Formats the component for output to a data file.
23 */
25output(std::ostream &out) const {
26 idf_output_string(out, _name);
27 out << _alt_names.size() << " ";
28
29 Strings::const_iterator vi;
30 for (vi = _alt_names.begin(); vi != _alt_names.end(); ++vi) {
31 idf_output_string(out, *vi);
32 }
33}
34
35/**
36 * Reads the data file as previously formatted by output().
37 */
39input(std::istream &in) {
40 idf_input_string(in, _name);
41
42 int num_alt_names;
43 in >> num_alt_names;
44 _alt_names.reserve(num_alt_names);
45 for (int i = 0; i < num_alt_names; ++i) {
46 std::string alt_name;
47 idf_input_string(in, alt_name);
48 _alt_names.push_back(alt_name);
49 }
50}
void input(std::istream &in)
Reads the data file as previously formatted by output().
void output(std::ostream &out) const
Formats the component for output to a data file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void idf_input_string(istream &in, string &str)
Reads the given string from the input file, as previously written by output_string().
void idf_output_string(ostream &out, const string &str, char whitespace)
Writes the indicated string to the output file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.