For future reference:
(1) It's a bad idea to move something to a different file and edit it
at the same time
(2) Those constructor parameters really should be optional.
The interface was trivial before, and it's a good idea to keep it
that way. (I'm really only saying this because it broke the
additional tests I had in my working copy :D)
On 2015-06-08 13:05, [email protected] wrote:
> Added: trunk/rostests/apitests/include/unknownbase.h
> URL:
> http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/include/unknownbase.h?rev=68069
> ==============================================================================
> --- trunk/rostests/apitests/include/unknownbase.h (added)
> +++ trunk/rostests/apitests/include/unknownbase.h [iso-8859-1] Mon Jun 8
> 11:05:35 2015
> @@ -0,0 +1,47 @@
> +#ifndef APITESTS_UNKNOWNBASE_H
> +#define APITESTS_UNKNOWNBASE_H
> +
> +template<typename Interface>
> +class CUnknownBase : public Interface
> +{
> + LONG m_lRef;
> + bool m_AutoDelete;
> +protected:
> + virtual const QITAB* GetQITab() = 0;
> +public:
> +
> + CUnknownBase(bool autoDelete, LONG initialRef)
> + : m_lRef(initialRef),
> + m_AutoDelete(autoDelete)
> + {
> + }
> +
> + ULONG STDMETHODCALLTYPE AddRef ()
> + {
> + return InterlockedIncrement( &m_lRef );
> + }
> +
> + ULONG STDMETHODCALLTYPE Release()
> + {
> + long newref = InterlockedDecrement( &m_lRef );
> + if (m_AutoDelete && newref<=0)
> + {
> + delete this;
> + }
> + return newref;
> + }
> +
> + HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppv)
> + {
> + return QISearch(this, GetQITab(), riid, ppv);
> + }
> +
> + virtual ~CUnknownBase() {}
> +
> + LONG GetRef() const
> + {
> + return m_lRef;
> + }
> +};
> +
> +#endif // APITESTS_UNKNOWNBASE_H
_______________________________________________
Ros-dev mailing list
[email protected]
http://www.reactos.org/mailman/listinfo/ros-dev