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.

182 lines
4.1 KiB

  1. // GuideStore2.h : Declaration of the CGuideStore
  2. #ifndef __GUIDESTORE2_H_
  3. #define __GUIDESTORE2_H_
  4. #include "resource.h" // main symbols
  5. #include "property.h"
  6. #include "Service.h"
  7. #include "Program.h"
  8. #include "ScheduleEntry.h"
  9. #include "GuideDataProvider.h"
  10. #include "object.h"
  11. #include "GuideDB.h"
  12. class CGuideStore;
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CGuideStore
  15. class ATL_NO_VTABLE CGuideStore :
  16. public CComObjectRootEx<CComObjectThreadModel>,
  17. public CComCoClass<CGuideStore, &CLSID_GuideStore>,
  18. public IConnectionPointContainerImpl<CGuideStore>,
  19. public IDispatchImpl<IGuideStore, &IID_IGuideStore, &LIBID_GUIDESTORELib>,
  20. public IGuideStoreInternal
  21. {
  22. public:
  23. CGuideStore()
  24. {
  25. #if defined(_ATL_FREE_THREADED)
  26. m_pUnkMarshaler = NULL;
  27. #endif
  28. m_pobjs = NULL;
  29. m_pdb = NULL;
  30. }
  31. DECLARE_REGISTRY_RESOURCEID(IDR_GUIDESTORE)
  32. DECLARE_GET_CONTROLLING_UNKNOWN()
  33. #if defined(_ATL_FREE_THREADED)
  34. DECLARE_PROTECT_FINAL_CONSTRUCT()
  35. #endif
  36. BEGIN_COM_MAP(CGuideStore)
  37. COM_INTERFACE_ENTRY(IGuideStore)
  38. COM_INTERFACE_ENTRY(IDispatch)
  39. COM_INTERFACE_ENTRY(IConnectionPointContainer)
  40. #if defined(_ATL_FREE_THREADED)
  41. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  42. #endif
  43. COM_INTERFACE_ENTRY(IGuideStoreInternal)
  44. END_COM_MAP()
  45. BEGIN_CONNECTION_POINT_MAP(CGuideStore)
  46. END_CONNECTION_POINT_MAP()
  47. #if defined(_ATL_FREE_THREADED)
  48. HRESULT FinalConstruct()
  49. {
  50. return CoCreateFreeThreadedMarshaler(
  51. GetControllingUnknown(), &m_pUnkMarshaler.p);
  52. }
  53. void FinalRelease()
  54. {
  55. m_pUnkMarshaler.Release();
  56. }
  57. CComPtr<IUnknown> m_pUnkMarshaler;
  58. #endif
  59. HRESULT OpenDB(const TCHAR *szDBName);
  60. // IGuideStoreInternal
  61. STDMETHOD(get_ObjectCount)(/*[out, retval] */ long *plCount)
  62. {
  63. ENTER_API
  64. {
  65. ValidateOut<long>(plCount);
  66. *plCount = m_pdb->ObjectCount();
  67. return S_OK;
  68. }
  69. LEAVE_API
  70. }
  71. STDMETHOD(get_Object)(/* [in] */ long iObject, /*[out, retval] */ IUnknown **ppunk)
  72. {
  73. ENTER_API
  74. {
  75. ValidateOutPtr<IUnknown>(ppunk);
  76. *ppunk = m_pdb->Object(iObject);
  77. return S_OK;
  78. }
  79. LEAVE_API
  80. }
  81. STDMETHOD(get_CachedObjectCount)(/*[out, retval] */ long *plCount)
  82. {
  83. ENTER_API
  84. {
  85. *plCount = m_pdb->CachedObjectCount();
  86. return S_OK;
  87. }
  88. LEAVE_API
  89. }
  90. STDMETHOD(PurgeCachedObjects)()
  91. {
  92. ENTER_API
  93. {
  94. return m_pdb->PurgeCachedObjects();
  95. }
  96. LEAVE_API
  97. }
  98. // IGuideStore
  99. public:
  100. STDMETHOD(BeginTrans)()
  101. {
  102. return m_pdb->BeginTrans();
  103. }
  104. STDMETHOD(CommitTrans)()
  105. {
  106. return m_pdb->CommitTrans();
  107. }
  108. STDMETHOD(RollbackTrans)()
  109. {
  110. return m_pdb->RollbackTrans();
  111. }
  112. STDMETHOD(get_UUID)(/* [out, retval] */ BSTR *pbstrUUID)
  113. {
  114. ENTER_API
  115. {
  116. ValidateOut(pbstrUUID);
  117. *pbstrUUID = m_pdb->get_UUID().copy();
  118. return S_OK;
  119. }
  120. LEAVE_API
  121. }
  122. STDMETHOD(get_IdOf)(/*[in]*/ IUnknown *punk, /*[out, retval]*/ long *pid)
  123. {
  124. ENTER_API
  125. {
  126. return m_pdb->get_IdOf(punk, pid);
  127. }
  128. LEAVE_API
  129. }
  130. STDMETHOD(get_MetaPropertiesOf)(/*[in]*/ IUnknown *punk, /*[out, retval]*/ IMetaProperties **ppprops)
  131. {
  132. ENTER_API
  133. {
  134. return m_pdb->get_MetaPropertiesOf(punk, ppprops);
  135. }
  136. LEAVE_API
  137. }
  138. STDMETHOD(get_ActiveGuideDataProvider)(/*[out, retval]*/ IGuideDataProvider * *pVal);
  139. STDMETHOD(putref_ActiveGuideDataProvider)(/*[in]*/ IGuideDataProvider * newVal);
  140. STDMETHOD(get_Channels)(/*[out, retval]*/ IChannels * *pVal);
  141. STDMETHOD(get_ChannelLineups)(/*[out, retval]*/ IChannelLineups * *pVal);
  142. STDMETHOD(get_Objects)(/*[out, retval]*/ IObjects * *pVal);
  143. STDMETHOD(Open)(BSTR bstrName);
  144. STDMETHOD(get_MetaPropertySets)(/*[out, retval]*/ IMetaPropertySets **pppropsets);
  145. STDMETHOD(get_ScheduleEntries)(/*[out, retval]*/ IScheduleEntries * *pVal);
  146. STDMETHOD(get_Programs)(/*[out, retval]*/ IPrograms * *pVal);
  147. STDMETHOD(get_Services)(/*[out, retval]*/ IServices * *pVal);
  148. STDMETHOD(get_GuideDataProviders)(/*[out, retval]*/ IGuideDataProviders * *pVal);
  149. protected:
  150. CComPtr<IObjects> m_pobjs;
  151. CComPtr<IGuideDataProviders> m_pdataproviders;
  152. CComPtr<IServices> m_pservices;
  153. CComPtr<IPrograms> m_pprograms;
  154. CComPtr<IChannels> m_pchans;
  155. CComPtr<IScheduleEntries> m_pschedentries;
  156. CComPtr<CMetaPropertySets> m_ppropsets;
  157. CComPtr<CGuideDB> m_pdb;
  158. };
  159. #endif //__GUIDESTORE2_H_