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.

224 lines
4.9 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // File: IMPPARSE.CPP
  4. //
  5. // Implementation of the ILocParser class
  6. //
  7. // Copyright (c) 1995 - 1997, Microsoft Corporation. All rights reserved.
  8. //
  9. //-----------------------------------------------------------------------------
  10. #include "stdafx.h"
  11. #include "dllvars.h"
  12. #include "resource.h"
  13. #include "impresob.h"
  14. #include "misc.h"
  15. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  16. //
  17. // Constructor and member data init
  18. //
  19. //------------------------------------------------------------------------------
  20. CLocImpResObj::CLocImpParser::CLocImpParser()
  21. {
  22. m_pParent = NULL;
  23. }
  24. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  25. //
  26. // Destructor and member clean up
  27. //
  28. //------------------------------------------------------------------------------
  29. CLocImpResObj::CLocImpParser::~CLocImpParser()
  30. {
  31. DEBUGONLY(AssertValid());
  32. }
  33. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  34. //
  35. // Add to the object reference count
  36. //
  37. //------------------------------------------------------------------------------
  38. STDMETHODIMP_(ULONG)
  39. CLocImpResObj::CLocImpParser::AddRef(void)
  40. {
  41. DEBUGONLY(AssertValid());
  42. return m_pParent->AddRef();
  43. }
  44. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  45. //
  46. // Subtract from the object reference count
  47. //
  48. //------------------------------------------------------------------------------
  49. STDMETHODIMP_(ULONG)
  50. CLocImpResObj::CLocImpParser::Release(void)
  51. {
  52. DEBUGONLY(AssertValid());
  53. return m_pParent->Release();
  54. }
  55. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  56. //
  57. // Query for other IIDs on this object.
  58. //
  59. //------------------------------------------------------------------------------
  60. STDMETHODIMP
  61. CLocImpResObj::CLocImpParser::QueryInterface(
  62. REFIID iid,
  63. LPVOID *ppvObj)
  64. {
  65. DEBUGONLY(AssertValid());
  66. return m_pParent->QueryInterface(iid, ppvObj);
  67. }
  68. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  69. //
  70. // Assert that this interface is valid
  71. //
  72. //------------------------------------------------------------------------------
  73. STDMETHODIMP_(void)
  74. CLocImpResObj::CLocImpParser::AssertValidInterface(void)
  75. const
  76. {
  77. DEBUGONLY(AssertValid());
  78. }
  79. STDMETHODIMP
  80. CLocImpResObj::CLocImpParser::Init(
  81. IUnknown *)
  82. {
  83. return ERROR_SUCCESS;
  84. }
  85. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  86. //
  87. // Create a file instance. Sub parsers do not implement this function.
  88. //
  89. //------------------------------------------------------------------------------
  90. STDMETHODIMP
  91. CLocImpResObj::CLocImpParser::CreateFileInstance(
  92. ILocFile *&pLocFile,
  93. FileType ft)
  94. {
  95. DEBUGONLY(AssertValid());
  96. UNREFERENCED_PARAMETER(pLocFile);
  97. UNREFERENCED_PARAMETER(ft);
  98. return ResultFromScode(E_NOTIMPL);
  99. }
  100. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  101. //
  102. // Fill the ParserInfo object with data for this sub parser
  103. //
  104. //------------------------------------------------------------------------------
  105. STDMETHODIMP_(void)
  106. CLocImpResObj::CLocImpParser::GetParserInfo(
  107. ParserInfo &pi)
  108. const
  109. {
  110. DEBUGONLY(AssertValid());
  111. try
  112. {
  113. pi.aParserIds.SetSize(1);
  114. pi.aParserIds[0].m_pid = pidBMOF; //TODO: Change to real ID
  115. pi.aParserIds[0].m_pidParent = pidWin32;
  116. //TODO add any new extensions
  117. LTVERIFY(pi.strDescription.LoadString(g_hDll, IDS_IMP_PARSER_DESC));
  118. LTVERIFY(pi.strHelp.LoadString(g_hDll, IDS_IMP_PARSER_DESC));
  119. }
  120. catch (CException* pRE)
  121. {
  122. pi.aParserIds.SetSize(0);
  123. pi.strDescription.Empty();
  124. pRE->Delete();
  125. }
  126. catch (...)
  127. {
  128. pi.aParserIds.SetSize(0);
  129. pi.strDescription.Empty();
  130. //Unexpected. Can't return error condition.
  131. }
  132. }
  133. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  134. //
  135. // Return the descriptions of the files. Sub parsers don't implement this
  136. // Function
  137. //
  138. //------------------------------------------------------------------------------
  139. STDMETHODIMP_(void)
  140. CLocImpResObj::CLocImpParser::GetFileDescriptions(CEnumCallback &cb)
  141. CONST_METHOD
  142. {
  143. DEBUGONLY(AssertValid());
  144. UNREFERENCED_PARAMETER(cb);
  145. }
  146. #ifdef _DEBUG
  147. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  148. //
  149. // Assert that the object is valid
  150. //
  151. //------------------------------------------------------------------------------
  152. void
  153. CLocImpResObj::CLocImpParser::AssertValid(void)
  154. const
  155. {
  156. CLObject::AssertValid();
  157. LTASSERT(NULL != m_pParent);
  158. }
  159. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  160. //
  161. // Dump the contents of the object
  162. //
  163. //------------------------------------------------------------------------------
  164. void
  165. CLocImpResObj::CLocImpParser::Dump(
  166. CDumpContext &dc)
  167. const
  168. {
  169. CLObject::Dump(dc);
  170. dc << _T("CLocImpResObj::CLocImpParser\n");
  171. dc << _T("m_pParent=");
  172. dc << (void*)m_pParent;
  173. dc << _T("\n");
  174. }
  175. #endif // _DEBUG