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.

128 lines
3.5 KiB

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1993-1999 Microsoft Corporation
  3. Module Name:
  4. frmtreg.hxx
  5. Abstract:
  6. Registry for format string reuse.
  7. Notes:
  8. This file defines reuse registry for format string fragments which may
  9. be reused later.
  10. History:
  11. Mar-14-1993 GregJen Created.
  12. ----------------------------------------------------------------------------*/
  13. /****************************************************************************
  14. * include files
  15. ***************************************************************************/
  16. #ifndef __FRMTREG_HXX__
  17. #define __FRMTREG_HXX__
  18. #include "nulldefs.h"
  19. extern "C"
  20. {
  21. #include <stdio.h>
  22. }
  23. #include "dict.hxx"
  24. #include "listhndl.hxx"
  25. #include "nodeskl.hxx"
  26. #include "frmtstr.hxx"
  27. /****************************************************************************
  28. * externs
  29. ***************************************************************************/
  30. /****************************************************************************
  31. * class definitions
  32. ***************************************************************************/
  33. class FRMTREG_DICT;
  34. class FRMTREG_ENTRY
  35. {
  36. private:
  37. long StartOffset;
  38. long EndOffset;
  39. long UseCount;
  40. // The class is friend as the Compare method accesses the format string buffers.
  41. friend class FRMTREG_DICT;
  42. public:
  43. FRMTREG_ENTRY( long StOff, long EndOff )
  44. {
  45. StartOffset = StOff;
  46. EndOffset = EndOff;
  47. UseCount = 1;
  48. }
  49. long GetStartOffset()
  50. {
  51. return StartOffset;
  52. }
  53. long GetEndOffset()
  54. {
  55. return StartOffset;
  56. }
  57. void * operator new ( size_t size )
  58. {
  59. return AllocateOnceNew( size );
  60. }
  61. void operator delete( void * ptr )
  62. {
  63. AllocateOnceDelete( ptr );
  64. }
  65. };
  66. class FRMTREG_DICT : public Dictionary
  67. {
  68. public:
  69. FORMAT_STRING * pOurFormatString;
  70. // The constructor and destructors.
  71. FRMTREG_DICT( FORMAT_STRING * );
  72. ~FRMTREG_DICT()
  73. {
  74. }
  75. //
  76. // Register a type.
  77. //
  78. FRMTREG_ENTRY * Register( FRMTREG_ENTRY * pNode );
  79. // Search for a type.
  80. FRMTREG_ENTRY * IsRegistered( FRMTREG_ENTRY * pNode );
  81. // Given a fragment, add it to the dictionary or return existing entry
  82. // true signifies "found"
  83. BOOL GetReUseEntry( FRMTREG_ENTRY * & pOut, FRMTREG_ENTRY * pIn );
  84. SSIZE_T Compare( pUserType pL, pUserType pR );
  85. void Print( pUserType )
  86. {
  87. }
  88. };
  89. #endif // __FRMTREG_HXX__