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.

136 lines
3.6 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Microsoft WMIOLE DB Provider
  4. // (C) Copyright 1999 Microsoft Corporation. All Rights Reserved.
  5. //
  6. // UrlParser.h - CURLParer class header file,
  7. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  8. #ifndef _URLPARSER_H_
  9. #define _URLPARSER_H_
  10. #define URL_ROW 1
  11. #define URL_DATASOURCE 2
  12. #define URL_ROWSET 3
  13. #define URL_EMBEDEDCLASS 4
  14. #define WMIURL 1
  15. #define UMIURL 2
  16. #define RELATIVEURL 3
  17. #define NAMESPACE_MAXLENGTH 1024
  18. #define CLASSNAME_MAXLENGTH 255
  19. #define PATH_MAXLENGTH 2048
  20. #define KEYNAME_MAXLENGTH 255
  21. class IPathParser
  22. {
  23. public:
  24. virtual HRESULT GetNameSpace(BSTR &strNameSpace) = 0;
  25. virtual HRESULT GetClassName(BSTR &strClassName) = 0;
  26. virtual HRESULT SetPath(WCHAR * strPath) = 0;
  27. virtual HRESULT GetPath(BSTR &strPath) = 0;
  28. virtual LONG GetURLType() = 0;
  29. virtual HRESULT GetKeyValue(BSTR strKey, VARIANT &varValue) = 0;
  30. virtual HRESULT ParseNameSpace(BSTR & strParentNameSpace,BSTR &strNameSpace) = 0;
  31. virtual HRESULT Initialize() = 0;
  32. };
  33. class CURLParser
  34. {
  35. private:
  36. BSTR m_strURL; // Path of the URL
  37. BSTR m_strNameSpace;
  38. BSTR m_strClassName;
  39. BSTR m_strPath;
  40. BSTR m_strInitProps;
  41. BSTR m_strEmbededPropName;
  42. LONG m_nEmbededChildIndex;
  43. BOOL m_bAllPropsInSync;
  44. BOOL m_bURLInitialized; // flag which tells whether all the other properties are intialized from URL o
  45. // URL is constructed from the other properties
  46. LONG m_lURLType;
  47. IPathParser *m_pIPathParser;
  48. IWbemPath *m_pIWbemPath;
  49. void GetInitializationProps(WCHAR *pStr);
  50. // void GetNameSpaceFromURL(WCHAR * & pStrIn);
  51. // void GetClassNameFromURL(WCHAR *pStr);
  52. HRESULT GetURLString(BSTR &strUrl);
  53. void GetEmbededInstanceParameters(WCHAR * & pStrIn);
  54. HRESULT SetPathofParser(WCHAR * strPath);
  55. HRESULT Initialize(WCHAR * strPath);
  56. HRESULT InitializeParserForURL(BSTR strURL);
  57. // void GetPathFromURLString(WCHAR * & pStrIn);
  58. public:
  59. CURLParser();
  60. ~CURLParser();
  61. HRESULT SetPath(BSTR strPath);
  62. HRESULT GetPath(BSTR &strPath);
  63. HRESULT GetNameSpace(BSTR & strNameSpace);
  64. // void SetClassName(BSTR strClassName);
  65. HRESULT GetClassName(BSTR &strClassName);
  66. HRESULT SetURL(BSTR strURL);
  67. HRESULT GetURL(BSTR &strURL);
  68. void SetEmbededInstInfo(BSTR strProperty,int nIndex);
  69. void GetEmbededInstInfo(BSTR &strProperty,int &nIndex);
  70. HRESULT GetPathWithEmbededInstInfo(BSTR &strPath);
  71. LONG GetURLType();
  72. HRESULT GetKeyValue(BSTR strKey,VARIANT &varValue);
  73. void ClearParser();
  74. HRESULT ParseNameSpace(BSTR & strParentNameSpace,BSTR &strNameSpace);
  75. LONG IsValidURL(WCHAR *pStrUrl);
  76. };
  77. class CWBEMPathParser : public IPathParser
  78. {
  79. IWbemPath *m_pIWbemPath;
  80. public:
  81. CWBEMPathParser();
  82. ~CWBEMPathParser();
  83. virtual HRESULT Initialize();
  84. virtual HRESULT GetNameSpace(BSTR &strNameSpace);
  85. virtual HRESULT GetClassName(BSTR &strClassName);
  86. virtual HRESULT SetPath(WCHAR * pwcsath);
  87. virtual HRESULT GetPath(BSTR &strPath);
  88. virtual LONG GetURLType();
  89. virtual HRESULT GetKeyValue(BSTR strKey, VARIANT &varValue);
  90. virtual HRESULT ParseNameSpace(BSTR & strParentNameSpace,BSTR &strNameSpace);
  91. };
  92. class CUMIPathParser : public IPathParser
  93. {
  94. IUmiURL *m_pIUmiPath;
  95. public:
  96. CUMIPathParser();
  97. ~CUMIPathParser();
  98. virtual HRESULT Initialize() ;
  99. virtual HRESULT GetNameSpace(BSTR &strNameSpace);
  100. virtual HRESULT GetClassName(BSTR &strClassName);
  101. virtual HRESULT SetPath(WCHAR * strPath);
  102. virtual HRESULT GetPath(BSTR &strPath);
  103. virtual LONG GetURLType();
  104. virtual HRESULT GetKeyValue(BSTR strKey, VARIANT &varValue);
  105. virtual HRESULT ParseNameSpace(BSTR & strParentNameSpace,BSTR &strNameSpace);
  106. };
  107. #endif