Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.3 KiB

  1. /***
  2. *typeinfo.cpp - Implementation of type_info for RTTI.
  3. *
  4. * Copyright (c) 1994-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This module provides an implementation of the class type_info
  8. * for Run-Time Type Information (RTTI).
  9. *
  10. *Revision History:
  11. * 10-04-94 SB Module created
  12. * 10-07-94 JWM rewrote
  13. * 10-17-94 BWT Disable code for PPC.
  14. * 11-23-94 JWM Strip trailing spaces from type_info.name().
  15. * 02/15/95 JWM Class type_info no longer _CRTIMP, member functions are exported instead
  16. * 06-02-95 JWM unDName -> __unDName.
  17. * 06-19-95 JWM type_info.name() moved to typename.cpp for granularity.
  18. * 07-02-95 JWM return values from == & != cleaned up, locks added to destructor.
  19. * 09-07-00 PML Get rid of /lib:libcp directive in obj (vs7#159463)
  20. *
  21. ****/
  22. #define _USE_ANSI_CPP /* Don't emit /lib:libcp directive */
  23. #include <stdlib.h>
  24. #include <typeinfo.h>
  25. #include <mtdll.h>
  26. #include <string.h>
  27. #include <dbgint.h>
  28. #include <undname.h>
  29. _CRTIMP type_info::~type_info()
  30. {
  31. _mlock(_TYPEINFO_LOCK);
  32. if (_m_data != NULL) {
  33. #ifdef _DEBUG /* CRT debug lib build */
  34. _free_base (_m_data);
  35. #else
  36. free (_m_data);
  37. #endif
  38. }
  39. _munlock(_TYPEINFO_LOCK);
  40. }
  41. _CRTIMP int type_info::operator==(const type_info& rhs) const
  42. {
  43. return (strcmp((rhs._m_d_name)+1, (_m_d_name)+1)?0:1);
  44. }
  45. _CRTIMP int type_info::operator!=(const type_info& rhs) const
  46. {
  47. return (strcmp((rhs._m_d_name)+1, (_m_d_name)+1)?1:0);
  48. }
  49. _CRTIMP int type_info::before(const type_info& rhs) const
  50. {
  51. return (strcmp((rhs._m_d_name)+1,(_m_d_name)+1) > 0);
  52. }
  53. _CRTIMP const char* type_info::raw_name() const
  54. {
  55. return _m_d_name;
  56. }
  57. type_info::type_info(const type_info& rhs)
  58. {
  59. // *TBD*
  60. // "Since the copy constructor and assignment operator for
  61. // type_info are private to the class, objects of this type
  62. // cannot be copied." - 18.5.1
  63. //
  64. // _m_data = NULL;
  65. // _m_d_name = new char[strlen(rhs._m_d_name) + 1];
  66. // if (_m_d_name != NULL)
  67. // strcpy( (char*)_m_d_name, rhs._m_d_name );
  68. }
  69. type_info& type_info::operator=(const type_info& rhs)
  70. {
  71. // *TBD*
  72. //
  73. // if (this != &rhs) {
  74. // this->type_info::~type_info();
  75. // this->type_info::type_info(rhs);
  76. // }
  77. return *this;
  78. }