00001 // Filename: parameterRemapBasicStringToString.cxx 00002 // Created by: drose (09Aug00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "parameterRemapBasicStringToString.h" 00020 #include "interfaceMaker.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Function: ParameterRemapBasicStringToString::Constructor 00024 // Access: Public 00025 // Description: 00026 //////////////////////////////////////////////////////////////////// 00027 ParameterRemapBasicStringToString:: 00028 ParameterRemapBasicStringToString(CPPType *orig_type) : 00029 ParameterRemapToString(orig_type) 00030 { 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: ParameterRemapBasicStringToString::pass_parameter 00035 // Access: Public, Virtual 00036 // Description: Outputs an expression that converts the indicated 00037 // variable from the original type to the new type, for 00038 // passing into the actual C++ function. 00039 //////////////////////////////////////////////////////////////////// 00040 void ParameterRemapBasicStringToString:: 00041 pass_parameter(ostream &out, const string &variable_name) { 00042 out << variable_name; 00043 } 00044 00045 //////////////////////////////////////////////////////////////////// 00046 // Function: ParameterRemapBasicStringToString::prepare_return_expr 00047 // Access: Public, Virtual 00048 // Description: This will be called immediately before 00049 // get_return_expr(). It outputs whatever lines the 00050 // remapper needs to the function to set up its return 00051 // value, e.g. to declare a temporary variable or 00052 // something. It should return the modified expression. 00053 //////////////////////////////////////////////////////////////////// 00054 string ParameterRemapBasicStringToString:: 00055 prepare_return_expr(ostream &out, int indent_level, const string &expression) { 00056 InterfaceMaker::indent(out, indent_level) 00057 << "static basic_string<char> string_holder = " << expression << ";\n"; 00058 return "string_holder"; 00059 } 00060 00061 //////////////////////////////////////////////////////////////////// 00062 // Function: ParameterRemapBasicStringToString::get_return_expr 00063 // Access: Public, Virtual 00064 // Description: Returns an expression that evalutes to the 00065 // appropriate value type for returning from the 00066 // function, given an expression of the original type. 00067 //////////////////////////////////////////////////////////////////// 00068 string ParameterRemapBasicStringToString:: 00069 get_return_expr(const string &expression) { 00070 return "string_holder.c_str()"; 00071 }