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.

175 lines
4.2 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////
  2. // analogtvtsimpl.h :
  3. // Copyright (c) Microsoft Corporation 1999.
  4. #ifndef ANALOGTVTSIMPL_H
  5. #define ANALOGTVTSIMPL_H
  6. #include "errsupp.h"
  7. #include "tuningspaceimpl.h"
  8. #include "ChannelTuneRequest.h"
  9. namespace BDATuningModel {
  10. template<class T,
  11. class TUNEREQUESTTYPE = CChannelTuneRequest,
  12. class MostDerived = IAnalogTVTuningSpace,
  13. LPCGUID iid = &__uuidof(MostDerived),
  14. LPCGUID LibID = &LIBID_TunerLib,
  15. WORD wMajor = 1,
  16. WORD wMinor = 0,
  17. class tihclass = CComTypeInfoHolder
  18. > class ATL_NO_VTABLE IAnalogTVTSImpl :
  19. public ITuningSpaceImpl<T, TUNEREQUESTTYPE, MostDerived, iid, LibID, wMajor, wMinor, tihclass>
  20. {
  21. public:
  22. IAnalogTVTSImpl() : m_MinChan(BDA_UNDEFINED_CHANNEL), m_MaxChan(BDA_UNDEFINED_CHANNEL), m_InputType(TunerInputCable), m_CountryCode(0) {}
  23. virtual ~IAnalogTVTSImpl() {}
  24. typedef ITuningSpaceImpl<T, TUNEREQUESTTYPE, MostDerived, iid, LibID, wMajor, wMinor, tihclass> basetype;
  25. BEGIN_PROP_MAP(IAnalogTVTSImpl)
  26. CHAIN_PROP_MAP(basetype)
  27. PROP_DATA_ENTRY("MinChannel", m_MinChan, VT_I4)
  28. PROP_DATA_ENTRY("MaxChannel", m_MaxChan, VT_I4)
  29. PROP_DATA_ENTRY("InputType", m_InputType, VT_UI4)
  30. PROP_DATA_ENTRY("CountryCode", m_CountryCode, VT_I4)
  31. END_PROPERTY_MAP()
  32. long m_MinChan;
  33. long m_MaxChan;
  34. TunerInputType m_InputType;
  35. long m_CountryCode;
  36. // IAnalogTVTS
  37. STDMETHOD(get_MinChannel)(long *pVal)
  38. {
  39. try {
  40. if (!pVal) {
  41. return E_POINTER;
  42. }
  43. ATL_LOCKT();
  44. *pVal = m_MinChan;
  45. } catch (...) {
  46. return E_POINTER;
  47. }
  48. return NOERROR;
  49. }
  50. STDMETHOD(put_MinChannel)(long newVal)
  51. {
  52. if (newVal > m_MaxChan) {
  53. return ImplReportError(__uuidof(T), IDS_E_INVALIDARG, __uuidof(IAnalogTVTuningSpace), E_INVALIDARG);
  54. }
  55. ATL_LOCKT();
  56. m_MinChan = newVal;
  57. MARK_DIRTY(T);
  58. return NOERROR;
  59. }
  60. STDMETHOD(get_MaxChannel)(long *pVal)
  61. {
  62. try {
  63. if (!pVal) {
  64. return E_POINTER;
  65. }
  66. ATL_LOCKT();
  67. *pVal = m_MaxChan;
  68. } catch (...) {
  69. return E_POINTER;
  70. }
  71. return NOERROR;
  72. }
  73. STDMETHOD(put_MaxChannel)(long newVal)
  74. {
  75. if (newVal < m_MinChan) {
  76. return ImplReportError(__uuidof(T), IDS_E_INVALIDARG, __uuidof(IAnalogTVTuningSpace), E_INVALIDARG);
  77. }
  78. ATL_LOCKT();
  79. m_MaxChan = newVal;
  80. MARK_DIRTY(T);
  81. return NOERROR;
  82. }
  83. STDMETHOD(get_InputType)(TunerInputType* pVal)
  84. {
  85. try {
  86. if (!pVal) {
  87. return E_POINTER;
  88. }
  89. ATL_LOCKT();
  90. *pVal = m_InputType;
  91. } catch (...) {
  92. return E_POINTER;
  93. }
  94. return NOERROR;
  95. }
  96. STDMETHOD(put_InputType)(TunerInputType newVal)
  97. {
  98. ATL_LOCKT();
  99. m_InputType = newVal;
  100. MARK_DIRTY(T);
  101. return NOERROR;
  102. }
  103. STDMETHOD(get_CountryCode)(long* pVal)
  104. {
  105. try {
  106. if (!pVal) {
  107. return E_POINTER;
  108. }
  109. ATL_LOCKT();
  110. *pVal = m_CountryCode;
  111. } catch (...) {
  112. return E_POINTER;
  113. }
  114. return NOERROR;
  115. }
  116. STDMETHOD(put_CountryCode)(long newVal)
  117. {
  118. ATL_LOCKT();
  119. m_CountryCode = newVal;
  120. MARK_DIRTY(T);
  121. return NOERROR;
  122. }
  123. STDMETHOD(Clone) (ITuningSpace **ppTS) {
  124. try {
  125. if (!ppTS) {
  126. return E_POINTER;
  127. }
  128. ATL_LOCKT();
  129. HRESULT hr = basetype::Clone(ppTS);
  130. if (FAILED(hr)) {
  131. return hr;
  132. }
  133. T* pt = static_cast<T*>(*ppTS);
  134. pt->m_MinChan = m_MinChan;
  135. pt->m_MaxChan = m_MaxChan;
  136. pt->m_InputType = m_InputType;
  137. pt->m_CountryCode = m_CountryCode;
  138. return NOERROR;
  139. } catch (HRESULT h) {
  140. return h;
  141. } catch (...) {
  142. return E_POINTER;
  143. }
  144. }
  145. };
  146. }; // namespace
  147. #endif // ANALOGTVTSIMPL_H
  148. // end of file -- analogtvtsimpl.h