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.

107 lines
2.6 KiB

  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Filename : GTable.h
  4. // Purpose : True Global tables class defilitions
  5. //
  6. // Project : PQS
  7. // Component: FILTER
  8. //
  9. // Author : dovh
  10. //
  11. // Log : Nov-11-1998 dovh - Creation
  12. //
  13. // Dec-01-1998 dovh - Add tags.cxx functionality
  14. // replace read tags file.
  15. // Jan-18-1999 dovh - Add CFE_BitseTables.
  16. // Jan-26-1999 dovh - Add CFE_GlobalConstTable fields.
  17. // Feb-02-1999 dovh - Move AddSectionTags: Gtable ==> FEGlobal
  18. // May-16-1999 urib - Move separator map : Gtable ==> FEGlobal
  19. // Dec-11-2000 dovh - MapToUpper: Assert the argument is in the
  20. // correct range
  21. //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. #ifndef __G_TABLE_H__
  24. #define __G_TABLE_H__
  25. #include "excption.h"
  26. //
  27. // G L O B A L C O N S T A N T M A C R O S :
  28. //
  29. #define PQS_HASH_SEQ_LEN 3
  30. #define XML_HASH_SEQ_LEN 2
  31. /*//////////////////////////////////////////////////////////////////////////////
  32. //
  33. // Name : CCToUpper Class Definition
  34. // Purpose : Encapsulate True Immutable Globals.
  35. //
  36. // Log : Nov-11-1998 dovh - Creation
  37. //
  38. //////////////////////////////////////////////////////////////////////////////*/
  39. class CToUpper
  40. {
  41. public:
  42. CToUpper();
  43. //
  44. // SOME ACCESS FUNCTIONS:
  45. //
  46. __forceinline
  47. static
  48. WCHAR
  49. MapToUpper(
  50. IN WCHAR wc
  51. )
  52. {
  53. extern CToUpper g_ToUpper;
  54. Assert(wc < 0X10000);
  55. return g_ToUpper.m_pwcsCaseMapTable[wc];
  56. }
  57. public:
  58. WCHAR m_pwcsCaseMapTable[0X10000];
  59. }; // CFE_CToUpper
  60. extern CToUpper g_ToUpper;
  61. inline CToUpper::CToUpper( )
  62. {
  63. for (WCHAR wch = 0; wch < 0XFFFF; wch++)
  64. {
  65. WCHAR wchOut;
  66. LCMapString(
  67. LOCALE_NEUTRAL,
  68. LCMAP_UPPERCASE,
  69. &wch,
  70. 1,
  71. &wchOut,
  72. 1 );
  73. //
  74. // Run the full fledged accent removal technique!
  75. //
  76. WCHAR pwcsFold[5];
  77. int iResult = FoldString(
  78. MAP_COMPOSITE,
  79. &wchOut,
  80. 1,
  81. pwcsFold,
  82. 5);
  83. Assert(iResult);
  84. Assert(iResult < 5);
  85. m_pwcsCaseMapTable[wch] = pwcsFold[0];
  86. }
  87. m_pwcsCaseMapTable[0XFFFF] = 0XFFFF; // can't put that in the loop since wch is WCHAR (will result in infinit loop)
  88. }
  89. #endif // __G_TABLE_H__