Panda3D
 All Classes Functions Variables Enumerations
interrogateFunctionWrapper.cxx
00001 // Filename: interrogateFunctionWrapper.cxx
00002 // Created by:  drose (06Aug00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "interrogateFunctionWrapper.h"
00016 #include "indexRemapper.h"
00017 #include "interrogate_datafile.h"
00018 
00019 #include <algorithm>
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //     Function: InterrogateFunctionWrapper::Parameter::output
00023 //       Access: Public
00024 //  Description:
00025 ////////////////////////////////////////////////////////////////////
00026 void InterrogateFunctionWrapper::Parameter::
00027 output(ostream &out) const {
00028   idf_output_string(out, _name);
00029   out << _parameter_flags << " " << _type << " ";
00030 }
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //     Function: InterrogateFunctionWrapper::Parameter::input
00034 //       Access: Public
00035 //  Description:
00036 ////////////////////////////////////////////////////////////////////
00037 void InterrogateFunctionWrapper::Parameter::
00038 input(istream &in) {
00039   idf_input_string(in, _name);
00040   in >> _parameter_flags >> _type;
00041 }
00042 
00043 ////////////////////////////////////////////////////////////////////
00044 //     Function: InterrogateFunctionWrapper::output
00045 //       Access: Public
00046 //  Description: Formats the InterrogateFunctionWrapper data for
00047 //               output to a data file.
00048 ////////////////////////////////////////////////////////////////////
00049 void InterrogateFunctionWrapper::
00050 output(ostream &out) const {
00051   InterrogateComponent::output(out);
00052   out << _flags << " "
00053       << _function << " "
00054       << _return_type << " "
00055       << _return_value_destructor << " ";
00056   idf_output_string(out, _unique_name);
00057   idf_output_string(out, _comment);
00058   idf_output_vector(out, _parameters);
00059 }
00060 
00061 ////////////////////////////////////////////////////////////////////
00062 //     Function: InterrogateFunctionWrapper::input
00063 //       Access: Public
00064 //  Description: Reads the data file as previously formatted by
00065 //               output().
00066 ////////////////////////////////////////////////////////////////////
00067 void InterrogateFunctionWrapper::
00068 input(istream &in) {
00069   InterrogateComponent::input(in);
00070   in >> _flags
00071      >> _function
00072      >> _return_type
00073      >> _return_value_destructor;
00074   idf_input_string(in, _unique_name);
00075   idf_input_string(in, _comment);
00076   idf_input_vector(in, _parameters);
00077 }
00078 
00079 ////////////////////////////////////////////////////////////////////
00080 //     Function: InterrogateFunctionWrapper::remap_indices
00081 //       Access: Public
00082 //  Description: Remaps all internal index numbers according to the
00083 //               indicated map.  This called from
00084 //               InterrogateDatabase::remap_indices().
00085 ////////////////////////////////////////////////////////////////////
00086 void InterrogateFunctionWrapper::
00087 remap_indices(const IndexRemapper &remap) {
00088   _return_value_destructor = remap.map_from(_return_value_destructor);
00089   _return_type = remap.map_from(_return_type);
00090 
00091   Parameters::iterator pi;
00092   for (pi = _parameters.begin(); pi != _parameters.end(); ++pi) {
00093     (*pi)._type = remap.map_from((*pi)._type);
00094   }
00095 }
 All Classes Functions Variables Enumerations