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.

155 lines
3.8 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. WMILFILE.H
  5. Abstract:
  6. Header file for CWmiLocFile, the MOF parser for Localization Studio
  7. History:
  8. --*/
  9. #ifndef WMILOCFIL_H
  10. #define WMILOCFIL_H
  11. #include <vector>
  12. const FileType ftWMIFileType = ftUnknown+1;
  13. class CWMILocFile : public ILocFile, public CLObject
  14. {
  15. public:
  16. CWMILocFile(ILocParser *);
  17. static void GetFileDescriptions(CEnumCallback &);
  18. typedef std::vector<_bstr_t> VectorString;
  19. protected:
  20. //
  21. // Standard IUnknown methods
  22. //
  23. STDMETHOD_(ULONG, AddRef)();
  24. STDMETHOD_(ULONG, Release)();
  25. STDMETHOD(QueryInterface)(REFIID iid, LPVOID* ppvObj);
  26. //
  27. // Standard Debugging interfaces
  28. //
  29. STDMETHOD_(void, AssertValidInterface)(THIS) CONST_METHOD;
  30. //
  31. // ILocFile methods.
  32. //
  33. STDMETHOD_(BOOL, OpenFile)(const CFileSpec REFERENCE,
  34. CReporter REFERENCE);
  35. STDMETHOD_(FileType, GetFileType)(void) const;
  36. STDMETHOD_(void, GetFileTypeDescription)(CLString REFERENCE) const;
  37. STDMETHOD_(BOOL, GetAssociatedFiles)(CStringList REFERENCE) const;
  38. STDMETHOD_(BOOL, EnumerateFile)(CLocItemHandler REFERENCE,
  39. const CLocLangId &, const DBID REFERENCE);
  40. STDMETHOD_(BOOL, GenerateFile)(const CPascalString REFERENCE,
  41. CLocItemHandler REFERENCE, const CLocLangId REFERENCE,
  42. const CLocLangId REFERENCE, const DBID REFERENCE);
  43. //
  44. // CLObect implementation
  45. //
  46. #ifdef _DEBUG
  47. void AssertValid(void) const;
  48. void Dump(CDumpContext &) const;
  49. #endif
  50. private:
  51. //
  52. // Private methods to prevent callers access.
  53. //
  54. ~CWMILocFile();
  55. CWMILocFile();
  56. const CWMILocFile &operator=(const CWMILocFile &);
  57. //
  58. // Private data for C.O.M. implementation
  59. ILocParser *m_pParentClass;
  60. ULONG m_ulRefCount;
  61. //
  62. // WMI specific private data.
  63. //
  64. enum WMIFileError
  65. {
  66. WMINoError,
  67. WMIOOM,
  68. WMICantOpenSourceFile,
  69. WMICantOpenTargetFile,
  70. WMINoOpenFile,
  71. WMINotWMIFile,
  72. WMICantWriteFile,
  73. WMISyntaxError,
  74. WMIFileError2,
  75. WMIHandlerError,
  76. WMIUnknownError,
  77. WMIIncompleteObj,
  78. WMINoMore
  79. };
  80. enum WMILineTypes
  81. {
  82. wltUnknown,
  83. wltNamespaceName,
  84. wltClassName,
  85. wltPropertyName
  86. };
  87. UINT m_uiLineNumber;
  88. DBID m_didFileId;
  89. _bstr_t m_pstrFileName;
  90. _bstr_t m_pstrTargetFile;
  91. FILE *m_pOpenSourceFile;
  92. FILE *m_pOpenTargetFile;
  93. CodePage m_cpSource;
  94. CodePage m_cpTarget;
  95. WORD m_wSourceId;
  96. WORD m_wTargetId;
  97. _bstr_t m_sCurrentNamespace;
  98. BOOL ReadLines(CLocItemHandler &, const DBID &, BOOL);
  99. WMIFileError GetNextItemSet(DWORD dwCurrPos,const _bstr_t &, CLocItemSet &,
  100. const DBID &, UINT &uiStartPos) ;
  101. BOOL GetNextQualifierPos(const wchar_t *, const wchar_t *, UINT &uiPos, UINT uiStartingPos = 0);
  102. BOOL EnumerateItem(CLocItemHandler &, CLocItemSet &);
  103. BOOL GenerateItem(CLocItemHandler &, CLocItemSet &, wchar_t **, UINT &uiStartingPos);
  104. void SetFlags(CLocItem *, CLocString &) const;
  105. void GetFullContext(CLString &) const;
  106. void ReportFileError(const _bstr_t &pstrFileName,
  107. const DBID &didFileId, CFileException *pFileException,
  108. CReporter &Reporter) const;
  109. void ReportUnicodeError(CUnicodeException *pUnicodeException,
  110. CReporter &Reporter, const CLocation &Location) const;
  111. void ReportException(CException *pException,
  112. CReporter &Reporter, const CLocation &) const;
  113. BOOL GetQualifierValue(wchar_t *, UINT &, _bstr_t &, UINT &);
  114. BOOL SetQualifierValue(wchar_t *, wchar_t **, UINT &, _bstr_t &, UINT &, BOOL bQuotes = TRUE);
  115. BOOL WriteNewFile(wchar_t *);
  116. wchar_t *FindPrevious(wchar_t *, const wchar_t *pTop, const wchar_t *);
  117. wchar_t *GetCurrentNamespace(wchar_t *, UINT uPos);
  118. wchar_t *FindTop(wchar_t *, wchar_t *, BOOL &);
  119. void ParseArray(wchar_t *, VectorString &);
  120. void WriteWaterMark();
  121. };
  122. CVC::ValidationCode ValidateString(const CLocTypeId &, const CLocString &clsOutputLine,
  123. CReporter &repReporter, const CLocation &loc, const CLString &strContext);
  124. #endif // WMILOCFIL_H