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.

169 lines
3.7 KiB

  1. /*
  2. * X S E A R C H . H
  3. *
  4. * XML push-model parsing for METADATA
  5. *
  6. * Copyright 1986-1997 Microsoft Corporation, All Rights Reserved
  7. */
  8. #ifndef _XSEARCH_H_
  9. #define _XSEARCH_H_
  10. #include <xprs.h>
  11. // Debugging -----------------------------------------------------------------
  12. //
  13. DEFINE_TRACE(Search);
  14. #define SearchTrace DO_TRACE(Search)
  15. // Ranges --------------------------------------------------------------------
  16. //
  17. #include <ex\rgiter.h>
  18. // CSearchContext ------------------------------------------------------------
  19. //
  20. class CSearchContext
  21. {
  22. // non-implemented operators
  23. //
  24. CSearchContext( const CSearchContext& );
  25. CSearchContext& operator=( const CSearchContext& );
  26. public:
  27. virtual ~CSearchContext() {}
  28. CSearchContext ()
  29. {
  30. INIT_TRACE(Search);
  31. }
  32. // When the parser finds an item that applies to the search, a call is
  33. // made such that the context is informed of the desired search.
  34. //
  35. virtual SCODE ScSetSQL(CParseNmspcCache * pnsc, LPCWSTR pwszSQL) = 0;
  36. // REPL Search interface -------------------------------------------------
  37. //
  38. // Default implementation fails on these items. All impls that support
  39. // this type of search must implement....
  40. //
  41. virtual SCODE ScSetCollBlob (LPCWSTR pwszBlob)
  42. {
  43. return E_DAV_UNEXPECTED_TYPE;
  44. }
  45. virtual SCODE ScSetResTagAdds (LPCWSTR pwszResTagAdd)
  46. {
  47. return E_DAV_UNEXPECTED_TYPE;
  48. }
  49. virtual SCODE ScSetReplRequest (BOOL fReplRequest)
  50. {
  51. return E_DAV_UNEXPECTED_TYPE;
  52. }
  53. // Range Search interface ------------------------------------------------
  54. //
  55. // Default impl. fails for these items. All impls that support this type
  56. // of search must implement....
  57. //
  58. virtual SCODE ScAddRange (UINT uRT, LPCWSTR pwszRange, LONG lCount)
  59. {
  60. return E_DAV_UNEXPECTED_TYPE;
  61. }
  62. // 'GROUP BY' Expansion --------------------------------------------------
  63. //
  64. // Default impl. fails for these items. All impls that support this type
  65. // of search must implement....
  66. //
  67. virtual SCODE ScSetExpansion (DWORD dwExpansion)
  68. {
  69. return E_DAV_UNEXPECTED_TYPE;
  70. }
  71. };
  72. // class CNFSearch -------------------------------------------------------------
  73. //
  74. class CNFSearch : public CNodeFactory
  75. {
  76. // The search context
  77. //
  78. CSearchContext& m_csc;
  79. // State tracking
  80. //
  81. typedef enum {
  82. ST_NODOC,
  83. ST_SEARCH,
  84. ST_QUERY,
  85. ST_QUERYENTITY,
  86. // REPL (DAV Replication) XML nodes
  87. //
  88. ST_REPL,
  89. ST_REPLCOLLBLOB,
  90. ST_REPLRESTAGLIST,
  91. ST_REPLRESTAGADD,
  92. // Range XML nodes
  93. //
  94. ST_RANGE,
  95. ST_RANGE_TYPE,
  96. ST_RANGE_ROWS,
  97. // Group Expansion
  98. //
  99. ST_GROUP_EXPANSION,
  100. } SEARCH_PARSE_STATE;
  101. SEARCH_PARSE_STATE m_state;
  102. // Value buffer
  103. //
  104. StringBuffer<WCHAR> m_sb;
  105. // Range items
  106. //
  107. UINT m_uRT;
  108. LONG m_lcRows;
  109. // non-implemented
  110. //
  111. CNFSearch(const CNFSearch& p);
  112. CNFSearch& operator=(const CNFSearch& p);
  113. public:
  114. virtual ~CNFSearch() {};
  115. CNFSearch(CSearchContext& csc)
  116. : m_csc(csc),
  117. m_state(ST_NODOC),
  118. m_uRT(RANGE_UNKNOWN),
  119. m_lcRows(0)
  120. {
  121. }
  122. // CNodeFactory specific methods
  123. //
  124. virtual SCODE ScCompleteAttribute (void);
  125. virtual SCODE ScCompleteChildren (
  126. /* [in] */ BOOL fEmptyNode,
  127. /* [in] */ DWORD dwType,
  128. /* [in] */ const WCHAR __RPC_FAR *pwcText,
  129. /* [in] */ ULONG ulLen);
  130. virtual SCODE ScHandleNode (
  131. /* [in] */ DWORD dwType,
  132. /* [in] */ DWORD dwSubType,
  133. /* [in] */ BOOL fTerminal,
  134. /* [in] */ const WCHAR __RPC_FAR *pwcText,
  135. /* [in] */ ULONG ulLen,
  136. /* [in] */ ULONG ulNamespaceLen,
  137. /* [in] */ const WCHAR __RPC_FAR *pwcNamespace,
  138. /* [in] */ const ULONG ulNsPrefixLen);
  139. };
  140. #include <replpropshack.h>
  141. #endif // _XSEARCH_H_