00001 // Filename: parameterRemapToString.cxx 00002 // Created by: drose (01Aug00) 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 "parameterRemapToString.h" 00020 #include "interrogate.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Function: ParameterRemapToString::Constructor 00024 // Access: Public 00025 // Description: 00026 //////////////////////////////////////////////////////////////////// 00027 ParameterRemapToString:: 00028 ParameterRemapToString(CPPType *orig_type) : 00029 ParameterRemap(orig_type) 00030 { 00031 static CPPType *char_star_type = (CPPType *)NULL; 00032 if (char_star_type == (CPPType *)NULL) { 00033 char_star_type = parser.parse_type("const char *"); 00034 } 00035 00036 _new_type = char_star_type; 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: ParameterRemapToString::pass_parameter 00041 // Access: Public, Virtual 00042 // Description: Outputs an expression that converts the indicated 00043 // variable from the original type to the new type, for 00044 // passing into the actual C++ function. 00045 //////////////////////////////////////////////////////////////////// 00046 void ParameterRemapToString:: 00047 pass_parameter(ostream &out, const string &variable_name) { 00048 out << variable_name; 00049 } 00050 00051 //////////////////////////////////////////////////////////////////// 00052 // Function: ParameterRemapToString::get_return_expr 00053 // Access: Public, Virtual 00054 // Description: Returns an expression that evalutes to the 00055 // appropriate value type for returning from the 00056 // function, given an expression of the original type. 00057 //////////////////////////////////////////////////////////////////// 00058 string ParameterRemapToString:: 00059 get_return_expr(const string &expression) { 00060 return expression; 00061 } 00062 00063 //////////////////////////////////////////////////////////////////// 00064 // Function: ParameterRemapToString::new_type_is_atomic_string 00065 // Access: Public, Virtual 00066 // Description: Returns true if the type represented by the 00067 // conversion is now the atomic string type. We have to 00068 // have this crazy method for representing atomic 00069 // string, because there's no such type in C (and hence 00070 // no corresponding CPPType *). 00071 //////////////////////////////////////////////////////////////////// 00072 bool ParameterRemapToString:: 00073 new_type_is_atomic_string() { 00074 return true; 00075 }