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.

153 lines
4.7 KiB

  1. //------------------------------------------------------------------------------
  2. //
  3. // File: impfile.h
  4. // Copyright (C) 1995-1997 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // Declaration of CLocImpFile, which provides the ILocFile interface for
  8. // the parser
  9. //
  10. // MAJOR IMPLEMENTATION FILE.
  11. //
  12. // Owner:
  13. //
  14. //------------------------------------------------------------------------------
  15. #ifndef IMPFILE_H
  16. #define IMPFILE_H
  17. const FileType ftMNCFileType = ftUnknown + 1;
  18. class CLocImpFile : public ILocFile, public CLObject
  19. {
  20. public:
  21. CLocImpFile(ILocParser *);
  22. protected:
  23. //
  24. // Standard IUnknown methods
  25. //
  26. STDMETHOD_(ULONG, AddRef)();
  27. STDMETHOD_(ULONG, Release)();
  28. STDMETHOD(QueryInterface)(REFIID iid, LPVOID* ppvObj);
  29. //
  30. // Standard Debugging interfaces
  31. //
  32. STDMETHOD_(void, AssertValidInterface)(THIS) CONST_METHOD;
  33. //
  34. // ILocFile methods.
  35. //
  36. STDMETHOD_(BOOL, OpenFile)(const CFileSpec REFERENCE,
  37. CReporter REFERENCE);
  38. STDMETHOD_(FileType, GetFileType)() const;
  39. STDMETHOD_(void, GetFileTypeDescription)(CLString REFERENCE) const;
  40. STDMETHOD_(BOOL, GetAssociatedFiles)(CStringList REFERENCE) const;
  41. STDMETHOD_(BOOL, EnumerateFile)(CLocItemHandler REFERENCE,
  42. const CLocLangId &, const DBID REFERENCE);
  43. STDMETHOD_(BOOL, GenerateFile)(const CPascalString REFERENCE,
  44. CLocItemHandler REFERENCE, const CLocLangId REFERENCE,
  45. const CLocLangId REFERENCE, const DBID REFERENCE);
  46. //
  47. // CLObect implementation
  48. //
  49. #ifdef LTASSERT_ACTIVE
  50. void AssertValid() const;
  51. #endif
  52. private:
  53. IStream * m_pstmTargetString;
  54. IStorage * m_pstgTargetStringTable;
  55. IStorage * m_pstgTargetParent;
  56. DWORD m_dwCountOfStringTables;
  57. IStream * m_pstmSourceString;
  58. IStorage * m_pstgSourceStringTable;
  59. IStorage * m_pstgSourceParent;
  60. DWORD m_dwCountOfStrings;
  61. CLSID m_clsidSnapIn;
  62. DWORD m_dwID,m_dwRefCount;
  63. bool m_bXMLBased;
  64. CComQIPtr<IXMLDOMNode> m_spStringTablesNode;
  65. CComQIPtr<IXMLDOMNode> m_spTargetStringTablesNode;
  66. private:
  67. BOOL GenerateStrings(CLocItemHandler & ihItemHandler,CLocItemSet &isItemSet);
  68. BOOL OpenStream(BOOL fGenerating);
  69. BOOL AddItemToSet(CLocItemSet & isItemSet,const DBID &dbidNodeId,DWORD dwID,LPCSTR szTemp);
  70. BOOL ProcessStrings(CLocItemHandler &ihItemHandler,const DBID &dbidFileId,BOOL fGenerating);
  71. BOOL ProcessXMLStrings(CLocItemHandler &ihItemHandler,const DBID &dbidFileId,BOOL fGenerating);
  72. BOOL EnumerateStrings(CLocItemHandler &ihItemHandler,const DBID &dbidFileId, BOOL fGenerating );
  73. BOOL CreateChildNode(CLocItemHandler & ihItemHandler,const DBID &dbidFileId, DBID & pNewParentId,const char *szNodeRes,const char *szNodeString);
  74. BOOL CreateParentNode(CLocItemHandler & ihItemHandler,const DBID &dbidFileId, DBID & pNewParentId,const char *szNodeRes,const char *szNodeString);
  75. //
  76. // Private methods to prevent callers access.
  77. //
  78. ~CLocImpFile();
  79. CLocImpFile();
  80. const CLocImpFile &operator=(const CLocImpFile &);
  81. //
  82. // Private data for C.O.M. implementation
  83. //
  84. ILocParser *m_pParentClass;
  85. ULONG m_ulRefCount;
  86. //
  87. // Framework data.
  88. //
  89. enum ImpFileError
  90. {
  91. ImpNoError,
  92. ImpSourceError,
  93. ImpTargetError,
  94. ImpEitherError,
  95. ImpNeitherError // For errors which aren't really in files.
  96. // TODO: Add more error types here if you need them.
  97. };
  98. CPascalString m_pstrFileName; // Filename of source file.
  99. DBID m_idFile;
  100. CPascalString m_pstrTargetFile; // Filename of target file, set
  101. // only when generating.
  102. CLFile *m_pOpenSourceFile; // File object for source file.
  103. CLFile *m_pOpenTargetFile; // File object for target file, set
  104. // only when generating.
  105. CReporter *m_pReporter; // Reporter object used to display messages.
  106. // THIS POINTER IS VALID ONLY DURING CALLS TO
  107. // OpenFile(), EnumerateFile(), GenerateFile(),
  108. // and anything called from them. If it is
  109. // not valid, it is guaranteed to be NULL.
  110. FileType m_FileType; // Type (ft* constant above) for this file.
  111. CodePage m_cpSource; // ANSI code page for source file.
  112. CodePage m_cpTarget; // ANSI code page for target file, set
  113. // only when generating.
  114. //
  115. // Parser-specific data.
  116. //
  117. //
  118. // Private implementation functions.
  119. //
  120. BOOL Verify();
  121. //
  122. // Handy utility functions. TODO: Except for ReportException(), they should
  123. // be removed if not used. Note ReportMessage() is used by other utility
  124. // functions.
  125. //
  126. void ReportException(CException *pException, // DO NOT EVER REMOVE!
  127. ImpFileError WhichFile = ImpSourceError) const;
  128. void ReportMessage(MessageSeverity sev, UINT nMsgId, // REMOVE CAREFULLY!
  129. ImpFileError WhichFile = ImpSourceError) const;
  130. };
  131. #endif // IMPFILE_H