functionWriter.cxx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // Filename: functionWriter.cxx
  2. // Created by: drose (14Sep01)
  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 "functionWriter.h"
  19. ////////////////////////////////////////////////////////////////////
  20. // Function: FunctionWriter::Constructor
  21. // Access: Public
  22. // Description:
  23. ////////////////////////////////////////////////////////////////////
  24. FunctionWriter::
  25. FunctionWriter() {
  26. }
  27. ////////////////////////////////////////////////////////////////////
  28. // Function: FunctionWriter::Destructor
  29. // Access: Public, Virtual
  30. // Description:
  31. ////////////////////////////////////////////////////////////////////
  32. FunctionWriter::
  33. ~FunctionWriter() {
  34. }
  35. ////////////////////////////////////////////////////////////////////
  36. // Function: FunctionWriter::get_name
  37. // Access: Public
  38. // Description:
  39. ////////////////////////////////////////////////////////////////////
  40. const string &FunctionWriter::
  41. get_name() const {
  42. return _name;
  43. }
  44. ////////////////////////////////////////////////////////////////////
  45. // Function: FunctionWriter::compare_to
  46. // Access: Public, Virtual
  47. // Description:
  48. ////////////////////////////////////////////////////////////////////
  49. int FunctionWriter::
  50. compare_to(const FunctionWriter &other) const {
  51. // Lexicographical string comparison.
  52. string::const_iterator n1, n2;
  53. n1 = _name.begin();
  54. n2 = other._name.begin();
  55. while (n1 != _name.end() && n2 != other._name.end()) {
  56. if (*n1 != *n2) {
  57. return *n1 - *n2;
  58. }
  59. ++n1;
  60. ++n2;
  61. }
  62. if (n1 != _name.end()) {
  63. return -1;
  64. }
  65. if (n2 != other._name.end()) {
  66. return 1;
  67. }
  68. return 0;
  69. }
  70. ////////////////////////////////////////////////////////////////////
  71. // Function: FunctionWriter::write_prototype
  72. // Access: Public, Virtual
  73. // Description: Outputs the prototype for the function.
  74. ////////////////////////////////////////////////////////////////////
  75. void FunctionWriter::
  76. write_prototype(ostream &) {
  77. }
  78. ////////////////////////////////////////////////////////////////////
  79. // Function: FunctionWriter::write_code
  80. // Access: Public, Virtual
  81. // Description: Outputs the code for the function.
  82. ////////////////////////////////////////////////////////////////////
  83. void FunctionWriter::
  84. write_code(ostream &) {
  85. }