parameterRemapBasicStringToString.cxx 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Filename: parameterRemapBasicStringToString.cxx
  2. // Created by: drose (09Aug00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #include "parameterRemapBasicStringToString.h"
  19. #include "interfaceMaker.h"
  20. ////////////////////////////////////////////////////////////////////
  21. // Function: ParameterRemapBasicStringToString::Constructor
  22. // Access: Public
  23. // Description:
  24. ////////////////////////////////////////////////////////////////////
  25. ParameterRemapBasicStringToString::
  26. ParameterRemapBasicStringToString(CPPType *orig_type) :
  27. ParameterRemapToString(orig_type)
  28. {
  29. }
  30. ////////////////////////////////////////////////////////////////////
  31. // Function: ParameterRemapBasicStringToString::pass_parameter
  32. // Access: Public, Virtual
  33. // Description: Outputs an expression that converts the indicated
  34. // variable from the original type to the new type, for
  35. // passing into the actual C++ function.
  36. ////////////////////////////////////////////////////////////////////
  37. void ParameterRemapBasicStringToString::
  38. pass_parameter(ostream &out, const string &variable_name) {
  39. out << variable_name;
  40. }
  41. ////////////////////////////////////////////////////////////////////
  42. // Function: ParameterRemapBasicStringToString::prepare_return_expr
  43. // Access: Public, Virtual
  44. // Description: This will be called immediately before
  45. // get_return_expr(). It outputs whatever lines the
  46. // remapper needs to the function to set up its return
  47. // value, e.g. to declare a temporary variable or
  48. // something. It should return the modified expression.
  49. ////////////////////////////////////////////////////////////////////
  50. string ParameterRemapBasicStringToString::
  51. prepare_return_expr(ostream &out, int indent_level, const string &expression) {
  52. InterfaceMaker::indent(out, indent_level)
  53. << "static basic_string<char> string_holder = " << expression << ";\n";
  54. return "string_holder";
  55. }
  56. ////////////////////////////////////////////////////////////////////
  57. // Function: ParameterRemapBasicStringToString::get_return_expr
  58. // Access: Public, Virtual
  59. // Description: Returns an expression that evalutes to the
  60. // appropriate value type for returning from the
  61. // function, given an expression of the original type.
  62. ////////////////////////////////////////////////////////////////////
  63. string ParameterRemapBasicStringToString::
  64. get_return_expr(const string &expression) {
  65. return "string_holder.c_str()";
  66. }