Source code of Windows XP (NT5)
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.

134 lines
4.2 KiB

  1. //***************************************************************************
  2. //
  3. // (c) 2000 by Microsoft Corp. All Rights Reserved.
  4. //
  5. // queryparse.h
  6. //
  7. // a-davcoo 02-Mar-00 Implements the query parser and analysis
  8. // interfaces.
  9. //
  10. //***************************************************************************
  11. #ifndef _QUERYPARSE_H_
  12. #define _QUERYPARSE_H_
  13. #include <wmiutils.h>
  14. #include <flexarry.h>
  15. #include "wqlnode.h"
  16. #include "genlex.h"
  17. #include "wql.h"
  18. #include "wbemint.h"
  19. class CWbemQNode : public IWbemQNode
  20. {
  21. public:
  22. CWbemQNode (IWbemQuery *query, const SWQLNode *node);
  23. virtual ~CWbemQNode (void);
  24. virtual HRESULT STDMETHODCALLTYPE QueryInterface (REFIID riid, void **ppv);
  25. virtual ULONG STDMETHODCALLTYPE AddRef (void);
  26. virtual ULONG STDMETHODCALLTYPE Release (void);
  27. virtual HRESULT STDMETHODCALLTYPE GetNodeType(
  28. /* [out] */ DWORD __RPC_FAR *pdwType);
  29. virtual HRESULT STDMETHODCALLTYPE GetNodeInfo(
  30. /* [in] */ LPCWSTR pszName,
  31. /* [in] */ DWORD dwFlags,
  32. /* [in] */ DWORD dwBufSize,
  33. /* [out] */ LPVOID pMem);
  34. virtual HRESULT STDMETHODCALLTYPE GetSubNode(
  35. /* [in] */ DWORD dwFlags,
  36. /* [out] */ IWbemQNode __RPC_FAR *__RPC_FAR *pSubnode);
  37. protected:
  38. long m_cRef;
  39. IWbemQuery *m_query;
  40. const SWQLNode *m_node;
  41. };
  42. class CWbemQuery : public IWbemQuery
  43. {
  44. public:
  45. CWbemQuery (void);
  46. virtual ~CWbemQuery (void);
  47. void InitEmpty (void); // Used by the CGenFactory<> class factory.
  48. virtual HRESULT STDMETHODCALLTYPE QueryInterface (REFIID riid, void **ppv);
  49. virtual ULONG STDMETHODCALLTYPE AddRef (void);
  50. virtual ULONG STDMETHODCALLTYPE Release (void);
  51. virtual HRESULT STDMETHODCALLTYPE Empty (void);
  52. virtual HRESULT STDMETHODCALLTYPE SetLanguageFeatures(
  53. /* [in] */ long lFlags,
  54. /* [in] */ ULONG uArraySize,
  55. /* [in] */ ULONG __RPC_FAR *puFeatures);
  56. virtual HRESULT STDMETHODCALLTYPE TestLanguageFeature(
  57. /* [in,out] */ ULONG *uArraySize,
  58. /* [out] */ ULONG *puFeatures);
  59. virtual HRESULT STDMETHODCALLTYPE Parse(
  60. /* [in] */ LPCWSTR pszLang,
  61. /* [in] */ LPCWSTR pszQuery,
  62. /* [in] */ ULONG uFlags);
  63. virtual HRESULT STDMETHODCALLTYPE GetAnalysis(
  64. /* [in] */ ULONG uFlags,
  65. /* [in] */ REFIID riid,
  66. /* [iid_is][out] */ LPVOID __RPC_FAR *pObj);
  67. virtual HRESULT STDMETHODCALLTYPE TestObject(
  68. /* [in] */ ULONG uFlags,
  69. /* [in] */ REFIID riid,
  70. /* [iid_is][in] */ LPVOID pObj);
  71. virtual HRESULT STDMETHODCALLTYPE GetQueryInfo(
  72. /* [in] */ ULONG uInfoId,
  73. /* [in] */ LPCWSTR pszParam,
  74. /* [out] */ VARIANT __RPC_FAR *pv);
  75. virtual HRESULT STDMETHODCALLTYPE AttachClassDef(
  76. /* [in] */ REFIID riid,
  77. /* [iid_is][in] */ LPVOID pClassDef);
  78. protected:
  79. long m_cRef;
  80. CWQLParser *m_parser;
  81. _IWmiObject *m_class;
  82. HRESULT TestObject (_IWmiObject *pObject);
  83. HRESULT TestObject (_IWmiObject *pObject, const SWQLNode_RelExpr *pExpr);
  84. HRESULT TestExpression (_IWmiObject *pObject, const SWQLTypedExpr *pExpr);
  85. HRESULT TargetClass (VARIANT *pv);
  86. HRESULT SelectedProps (VARIANT *pv);
  87. HRESULT TestConjunctive (void);
  88. HRESULT TestConjunctive (const SWQLNode_RelExpr *pExpr);
  89. HRESULT PropertyEqualityValue (LPCWSTR pszParam, VARIANT *pv);
  90. HRESULT PropertyEqualityValue (const SWQLNode_RelExpr *pExpr, LPCWSTR pszParam, VARIANT *pv);
  91. HRESULT TestLF1Unary (void);
  92. HRESULT GetAnalysis (IWbemQNode **ppObject);
  93. HRESULT GetAnalysis (IWbemClassObject **pObject);
  94. static HRESULT LookupParserError (int error);
  95. static __int64 GetNumeric (const SWQLTypedConst *pExpr);
  96. static LPWSTR GetString (const SWQLTypedConst *pExpr);
  97. static bool GetBoolean (const SWQLTypedConst *pExpr);
  98. HRESULT CompareNumeric (__int64 prop, __int64 value, DWORD relation);
  99. HRESULT CompareNumeric (unsigned __int64 prop, unsigned __int64 value, DWORD relation);
  100. HRESULT CompareBoolean (bool prop, bool value, DWORD relation);
  101. HRESULT CompareString (LPWSTR prop, LPWSTR value, DWORD relation);
  102. };
  103. #endif // _QUERYPARSE_H_