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.

129 lines
4.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996.
  5. //
  6. // File: filtpars.hxx
  7. //
  8. // Contents: A parser which will read the contents of a data file and create
  9. // a list of CONFIG structions to be used by CFiltTest
  10. //
  11. // Classes:
  12. //
  13. // Functions:
  14. //
  15. // Coupling:
  16. //
  17. // Notes:
  18. //
  19. // History: 9-21-1996 ericne Created
  20. //
  21. //----------------------------------------------------------------------------
  22. #ifndef _CFILTPARS
  23. #define _CFILTPARS
  24. static const int MAX_LINE_SIZE = 1024;
  25. static const int MAX_TOKEN_SIZE = 128;
  26. static const int MAX_SECTION_NAMES_SIZE = 4096;
  27. static const int MAX_KEY_NAMES_SIZE = 4096;
  28. // Don't reorder this list!
  29. static const TCHAR *const strInitFlags[8] = {
  30. _T("IFILTER_INIT_CANON_PARAGRAPHS"),
  31. _T("IFILTER_INIT_HARD_LINE_BREAKS"),
  32. _T("IFILTER_INIT_CANON_HYPHENS"),
  33. _T("IFILTER_INIT_CANON_SPACES"),
  34. _T("IFILTER_INIT_APPLY_INDEX_ATTRIBUTES"),
  35. _T("IFILTER_INIT_APPLY_OTHER_ATTRIBUTES"),
  36. _T("IFILTER_INIT_INDEXING_ONLY"),
  37. _T("IFILTER_INIT_SEARCH_LINKS") };
  38. //+---------------------------------------------------------------------------
  39. //
  40. // Struct: CONFIG ()
  41. //
  42. // Purpose: Stores the parameters for IFilter::Init(), and some other
  43. // useful information
  44. //
  45. // Interface: grfFlags -- IFFILTER_INIT flags
  46. // cAttributes -- the size of the aAttributes array
  47. // aAttributes -- an array of FULLPROPSPECs
  48. // pdwFlags -- Flags returned by ::Init()
  49. // ulActNbrAttributes -- Actual number of elements in the
  50. // aAttribute array. Used internally.
  51. // pcSectionName -- Name of the section in the .ini file
  52. // from which these parameters were read.
  53. //
  54. // History: 10-03-1996 ericne Created
  55. //
  56. // Notes:
  57. //
  58. //----------------------------------------------------------------------------
  59. struct CONFIG
  60. {
  61. ULONG grfFlags;
  62. ULONG cAttributes;
  63. FULLPROPSPEC *aAttributes;
  64. DWORD *pdwFlags;
  65. ULONG ulActNbrAttributes;
  66. LPTSTR szSectionName;
  67. };
  68. static const TCHAR *const szDefaultSectionName = _T("default");
  69. //+---------------------------------------------------------------------------
  70. //
  71. // Class: CFiltParse ()
  72. //
  73. // Purpose: Parses the .ini file and creates a list of CONFIG structs
  74. //
  75. // Interface: CFiltParse -- Constructor. Default initialization
  76. // ~CFiltParse -- Destructor. Frees memory used by list
  77. // Init -- Parses the .ini file, creates the list
  78. // GetNextConfig -- Return the next config from the list
  79. // ParseFlags -- Parses a string containing the INIT flags
  80. // GetAttributes -- creates the array of FULLPROPSPECs
  81. // m_FirstListNode -- First node in the list
  82. // m_pNextListNode -- pointer to the next node to return
  83. //
  84. // History: 10-03-1996 ericne Created
  85. //
  86. // Notes:
  87. //
  88. //----------------------------------------------------------------------------
  89. class CFiltParse
  90. {
  91. public:
  92. CFiltParse( );
  93. ~CFiltParse( );
  94. BOOL Init( LPCTSTR ); // Data file name
  95. BOOL GetNextConfig( CONFIG * );
  96. private:
  97. struct ListNode
  98. {
  99. CONFIG Configuration;
  100. ListNode *next;
  101. };
  102. BOOL ParseFlags( LPTSTR, int * );
  103. BOOL GetAttributes( LPCTSTR, LPCTSTR,
  104. FULLPROPSPEC *&, ULONG & );
  105. ListNode m_FirstListNode;
  106. ListNode *m_pNextListNode;
  107. };
  108. #endif