parameterRemapBasicStringPtrToString.cxx 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Filename: parameterRemapBasicStringPtrToString.cxx
  2. // Created by: drose (11Aug09)
  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. #include "parameterRemapBasicStringPtrToString.h"
  15. ////////////////////////////////////////////////////////////////////
  16. // Function: ParameterRemapBasicStringPtrToString::Constructor
  17. // Access: Public
  18. // Description:
  19. ////////////////////////////////////////////////////////////////////
  20. ParameterRemapBasicStringPtrToString::
  21. ParameterRemapBasicStringPtrToString(CPPType *orig_type) :
  22. ParameterRemapToString(orig_type)
  23. {
  24. }
  25. ////////////////////////////////////////////////////////////////////
  26. // Function: ParameterRemapBasicStringPtrToString::pass_parameter
  27. // Access: Public, Virtual
  28. // Description: Outputs an expression that converts the indicated
  29. // variable from the original type to the new type, for
  30. // passing into the actual C++ function.
  31. ////////////////////////////////////////////////////////////////////
  32. void ParameterRemapBasicStringPtrToString::
  33. pass_parameter(ostream &out, const string &variable_name) {
  34. out << "&" << variable_name;
  35. }
  36. ////////////////////////////////////////////////////////////////////
  37. // Function: ParameterRemapBasicStringPtrToString::get_return_expr
  38. // Access: Public, Virtual
  39. // Description: Returns an expression that evalutes to the
  40. // appropriate value type for returning from the
  41. // function, given an expression of the original type.
  42. ////////////////////////////////////////////////////////////////////
  43. string ParameterRemapBasicStringPtrToString::
  44. get_return_expr(const string &expression) {
  45. return "(" + expression + ")->c_str()";
  46. }
  47. ////////////////////////////////////////////////////////////////////
  48. // Function: ParameterRemapBasicWStringPtrToWString::Constructor
  49. // Access: Public
  50. // Description:
  51. ////////////////////////////////////////////////////////////////////
  52. ParameterRemapBasicWStringPtrToWString::
  53. ParameterRemapBasicWStringPtrToWString(CPPType *orig_type) :
  54. ParameterRemapToWString(orig_type)
  55. {
  56. }
  57. ////////////////////////////////////////////////////////////////////
  58. // Function: ParameterRemapBasicWStringPtrToWString::pass_parameter
  59. // Access: Public, Virtual
  60. // Description: Outputs an expression that converts the indicated
  61. // variable from the original type to the new type, for
  62. // passing into the actual C++ function.
  63. ////////////////////////////////////////////////////////////////////
  64. void ParameterRemapBasicWStringPtrToWString::
  65. pass_parameter(ostream &out, const string &variable_name) {
  66. out << "&" << variable_name;
  67. }
  68. ////////////////////////////////////////////////////////////////////
  69. // Function: ParameterRemapBasicWStringPtrToWString::get_return_expr
  70. // Access: Public, Virtual
  71. // Description: Returns an expression that evalutes to the
  72. // appropriate value type for returning from the
  73. // function, given an expression of the original type.
  74. ////////////////////////////////////////////////////////////////////
  75. string ParameterRemapBasicWStringPtrToWString::
  76. get_return_expr(const string &expression) {
  77. return "(" + expression + ")->c_str()";
  78. }