Panda3D
 All Classes Functions Variables Enumerations
interrogateComponent.cxx
1 // Filename: interrogateComponent.cxx
2 // Created by: drose (08Aug00)
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 "interrogateComponent.h"
16 #include "interrogate_datafile.h"
17 
18 // This static string is just kept around as a handy bogus return
19 // value for functions that must return a const string reference.
20 string InterrogateComponent::_empty_string;
21 
22 ////////////////////////////////////////////////////////////////////
23 // Function: InterrogateComponent::output
24 // Access: Public
25 // Description: Formats the component for output to a data file.
26 ////////////////////////////////////////////////////////////////////
28 output(ostream &out) const {
29  idf_output_string(out, _name);
30  out << _alt_names.size() << " ";
31 
32  Strings::const_iterator vi;
33  for (vi = _alt_names.begin(); vi != _alt_names.end(); ++vi) {
34  idf_output_string(out, *vi);
35  }
36 }
37 
38 ////////////////////////////////////////////////////////////////////
39 // Function: InterrogateComponent::input
40 // Access: Public
41 // Description: Reads the data file as previously formatted by
42 // output().
43 ////////////////////////////////////////////////////////////////////
45 input(istream &in) {
46  idf_input_string(in, _name);
47 
48  int num_alt_names;
49  in >> num_alt_names;
50  _alt_names.reserve(num_alt_names);
51  for (int i = 0; i < num_alt_names; ++i) {
52  string alt_name;
53  idf_input_string(in, alt_name);
54  _alt_names.push_back(alt_name);
55  }
56 }
void input(istream &in)
Reads the data file as previously formatted by output().
void output(ostream &out) const
Formats the component for output to a data file.