parameterRemapToString.cxx 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Filename: parameterRemapToString.cxx
  2. // Created by: drose (01Aug00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, 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://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #include "parameterRemapToString.h"
  19. #include "interrogate.h"
  20. ////////////////////////////////////////////////////////////////////
  21. // Function: ParameterRemapToString::Constructor
  22. // Access: Public
  23. // Description:
  24. ////////////////////////////////////////////////////////////////////
  25. ParameterRemapToString::
  26. ParameterRemapToString(CPPType *orig_type) :
  27. ParameterRemap(orig_type)
  28. {
  29. static CPPType *char_star_type = (CPPType *)NULL;
  30. if (char_star_type == (CPPType *)NULL) {
  31. char_star_type = parser.parse_type("const char *");
  32. }
  33. _new_type = char_star_type;
  34. }
  35. ////////////////////////////////////////////////////////////////////
  36. // Function: ParameterRemapToString::pass_parameter
  37. // Access: Public, Virtual
  38. // Description: Outputs an expression that converts the indicated
  39. // variable from the original type to the new type, for
  40. // passing into the actual C++ function.
  41. ////////////////////////////////////////////////////////////////////
  42. void ParameterRemapToString::
  43. pass_parameter(ostream &out, const string &variable_name) {
  44. out << variable_name;
  45. }
  46. ////////////////////////////////////////////////////////////////////
  47. // Function: ParameterRemapToString::get_return_expr
  48. // Access: Public, Virtual
  49. // Description: Returns an expression that evalutes to the
  50. // appropriate value type for returning from the
  51. // function, given an expression of the original type.
  52. ////////////////////////////////////////////////////////////////////
  53. string ParameterRemapToString::
  54. get_return_expr(const string &expression) {
  55. return expression;
  56. }
  57. ////////////////////////////////////////////////////////////////////
  58. // Function: ParameterRemapToString::new_type_is_atomic_string
  59. // Access: Public, Virtual
  60. // Description: Returns true if the type represented by the
  61. // conversion is now the atomic string type. We have to
  62. // have this crazy method for representing atomic
  63. // string, because there's no such type in C (and hence
  64. // no corresponding CPPType *).
  65. ////////////////////////////////////////////////////////////////////
  66. bool ParameterRemapToString::
  67. new_type_is_atomic_string() {
  68. return true;
  69. }