diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-06-13 13:05:30 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-06-13 13:05:30 +0400 |
commit | 0b9ec9a361f62ce15fc58763ca8b533afe405973 (patch) | |
tree | 02fb318875748db7e28f0b303d9907e58d69ca8c /src/DSUtil/DSMPropertyBag.h | |
parent | d3b052fb035d8b242e4b328722f4ed7ac84ee20c (diff) |
apply the new astyle command; use 4 spaces for indentation and k&r style
Note: if you have any local patches just run astyle.bat
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@5110 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/DSUtil/DSMPropertyBag.h')
-rw-r--r-- | src/DSUtil/DSMPropertyBag.h | 228 |
1 files changed, 114 insertions, 114 deletions
diff --git a/src/DSUtil/DSMPropertyBag.h b/src/DSUtil/DSMPropertyBag.h index 3a6e5c825..61f97a37f 100644 --- a/src/DSUtil/DSMPropertyBag.h +++ b/src/DSUtil/DSMPropertyBag.h @@ -30,46 +30,46 @@ interface __declspec(uuid("232FD5D2-4954-41E7-BF9B-09E1257B1A95"))
IDSMPropertyBag :
public IPropertyBag2 {
- STDMETHOD(SetProperty) (LPCWSTR key, LPCWSTR value) = 0;
- STDMETHOD(SetProperty) (LPCWSTR key, VARIANT* var) = 0;
- STDMETHOD(GetProperty) (LPCWSTR key, BSTR* value) = 0;
- STDMETHOD(DelAllProperties) () = 0;
- STDMETHOD(DelProperty) (LPCWSTR key) = 0;
+ STDMETHOD(SetProperty)(LPCWSTR key, LPCWSTR value) = 0;
+ STDMETHOD(SetProperty)(LPCWSTR key, VARIANT * var) = 0;
+ STDMETHOD(GetProperty)(LPCWSTR key, BSTR * value) = 0;
+ STDMETHOD(DelAllProperties)() = 0;
+ STDMETHOD(DelProperty)(LPCWSTR key) = 0;
};
class IDSMPropertyBagImpl : public ATL::CSimpleMap<CStringW, CStringW>, public IDSMPropertyBag, public IPropertyBag
{
- BOOL Add(const CStringW& key, const CStringW& val) {
- return __super::Add(key, val);
- }
- BOOL SetAt(const CStringW& key, const CStringW& val) {
- return __super::SetAt(key, val);
- }
+ BOOL Add(const CStringW& key, const CStringW& val) {
+ return __super::Add(key, val);
+ }
+ BOOL SetAt(const CStringW& key, const CStringW& val) {
+ return __super::SetAt(key, val);
+ }
public:
- IDSMPropertyBagImpl();
- virtual ~IDSMPropertyBagImpl();
+ IDSMPropertyBagImpl();
+ virtual ~IDSMPropertyBagImpl();
- // IPropertyBag
+ // IPropertyBag
- STDMETHODIMP Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog);
- STDMETHODIMP Write(LPCOLESTR pszPropName, VARIANT* pVar);
+ STDMETHODIMP Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog);
+ STDMETHODIMP Write(LPCOLESTR pszPropName, VARIANT* pVar);
- // IPropertyBag2
+ // IPropertyBag2
- STDMETHODIMP Read(ULONG cProperties, PROPBAG2* pPropBag, IErrorLog* pErrLog, VARIANT* pvarValue, HRESULT* phrError);
- STDMETHODIMP Write(ULONG cProperties, PROPBAG2* pPropBag, VARIANT* pvarValue);
- STDMETHODIMP CountProperties(ULONG* pcProperties);
- STDMETHODIMP GetPropertyInfo(ULONG iProperty, ULONG cProperties, PROPBAG2* pPropBag, ULONG* pcProperties);
- STDMETHODIMP LoadObject(LPCOLESTR pstrName, DWORD dwHint, IUnknown* pUnkObject, IErrorLog* pErrLog);
+ STDMETHODIMP Read(ULONG cProperties, PROPBAG2* pPropBag, IErrorLog* pErrLog, VARIANT* pvarValue, HRESULT* phrError);
+ STDMETHODIMP Write(ULONG cProperties, PROPBAG2* pPropBag, VARIANT* pvarValue);
+ STDMETHODIMP CountProperties(ULONG* pcProperties);
+ STDMETHODIMP GetPropertyInfo(ULONG iProperty, ULONG cProperties, PROPBAG2* pPropBag, ULONG* pcProperties);
+ STDMETHODIMP LoadObject(LPCOLESTR pstrName, DWORD dwHint, IUnknown* pUnkObject, IErrorLog* pErrLog);
- // IDSMPropertyBag
+ // IDSMPropertyBag
- STDMETHODIMP SetProperty(LPCWSTR key, LPCWSTR value);
- STDMETHODIMP SetProperty(LPCWSTR key, VARIANT* var);
- STDMETHODIMP GetProperty(LPCWSTR key, BSTR* value);
- STDMETHODIMP DelAllProperties();
- STDMETHODIMP DelProperty(LPCWSTR key);
+ STDMETHODIMP SetProperty(LPCWSTR key, LPCWSTR value);
+ STDMETHODIMP SetProperty(LPCWSTR key, VARIANT* var);
+ STDMETHODIMP GetProperty(LPCWSTR key, BSTR* value);
+ STDMETHODIMP DelAllProperties();
+ STDMETHODIMP DelProperty(LPCWSTR key);
};
// IDSMResourceBag
@@ -77,49 +77,49 @@ public: interface __declspec(uuid("EBAFBCBE-BDE0-489A-9789-05D5692E3A93"))
IDSMResourceBag :
public IUnknown {
- STDMETHOD_(DWORD, ResGetCount) () = 0;
- STDMETHOD(ResGet) (DWORD iIndex, BSTR* ppName, BSTR* ppDesc, BSTR* ppMime, BYTE** ppData, DWORD* pDataLen, DWORD_PTR* pTag) = 0;
- STDMETHOD(ResSet) (DWORD iIndex, LPCWSTR pName, LPCWSTR pDesc, LPCWSTR pMime, BYTE* pData, DWORD len, DWORD_PTR tag) = 0;
- STDMETHOD(ResAppend) (LPCWSTR pName, LPCWSTR pDesc, LPCWSTR pMime, BYTE* pData, DWORD len, DWORD_PTR tag) = 0;
- STDMETHOD(ResRemoveAt) (DWORD iIndex) = 0;
- STDMETHOD(ResRemoveAll) (DWORD_PTR tag) = 0;
+ STDMETHOD_(DWORD, ResGetCount)() = 0;
+ STDMETHOD(ResGet)(DWORD iIndex, BSTR * ppName, BSTR * ppDesc, BSTR * ppMime, BYTE** ppData, DWORD * pDataLen, DWORD_PTR * pTag) = 0;
+ STDMETHOD(ResSet)(DWORD iIndex, LPCWSTR pName, LPCWSTR pDesc, LPCWSTR pMime, BYTE * pData, DWORD len, DWORD_PTR tag) = 0;
+ STDMETHOD(ResAppend)(LPCWSTR pName, LPCWSTR pDesc, LPCWSTR pMime, BYTE * pData, DWORD len, DWORD_PTR tag) = 0;
+ STDMETHOD(ResRemoveAt)(DWORD iIndex) = 0;
+ STDMETHOD(ResRemoveAll)(DWORD_PTR tag) = 0;
};
class CDSMResource
{
public:
- DWORD_PTR tag;
- CStringW name, desc, mime;
- CAtlArray<BYTE> data;
- CDSMResource();
- CDSMResource(const CDSMResource& r);
- CDSMResource(LPCWSTR name, LPCWSTR desc, LPCWSTR mime, BYTE* pData, int len, DWORD_PTR tag = 0);
- virtual ~CDSMResource();
- CDSMResource& operator = (const CDSMResource& r);
-
- // global access to all resources
- static CCritSec m_csResources;
- static CAtlMap<uintptr_t, CDSMResource*> m_resources;
+ DWORD_PTR tag;
+ CStringW name, desc, mime;
+ CAtlArray<BYTE> data;
+ CDSMResource();
+ CDSMResource(const CDSMResource& r);
+ CDSMResource(LPCWSTR name, LPCWSTR desc, LPCWSTR mime, BYTE* pData, int len, DWORD_PTR tag = 0);
+ virtual ~CDSMResource();
+ CDSMResource& operator = (const CDSMResource& r);
+
+ // global access to all resources
+ static CCritSec m_csResources;
+ static CAtlMap<uintptr_t, CDSMResource*> m_resources;
};
class IDSMResourceBagImpl : public IDSMResourceBag
{
protected:
- CAtlArray<CDSMResource> m_resources;
+ CAtlArray<CDSMResource> m_resources;
public:
- IDSMResourceBagImpl();
+ IDSMResourceBagImpl();
- void operator += (const CDSMResource& r) { m_resources.Add(r); }
+ void operator += (const CDSMResource& r) { m_resources.Add(r); }
- // IDSMResourceBag
+ // IDSMResourceBag
- STDMETHODIMP_(DWORD) ResGetCount();
- STDMETHODIMP ResGet(DWORD iIndex, BSTR* ppName, BSTR* ppDesc, BSTR* ppMime, BYTE** ppData, DWORD* pDataLen, DWORD_PTR* pTag = NULL);
- STDMETHODIMP ResSet(DWORD iIndex, LPCWSTR pName, LPCWSTR pDesc, LPCWSTR pMime, BYTE* pData, DWORD len, DWORD_PTR tag = 0);
- STDMETHODIMP ResAppend(LPCWSTR pName, LPCWSTR pDesc, LPCWSTR pMime, BYTE* pData, DWORD len, DWORD_PTR tag = 0);
- STDMETHODIMP ResRemoveAt(DWORD iIndex);
- STDMETHODIMP ResRemoveAll(DWORD_PTR tag = 0);
+ STDMETHODIMP_(DWORD) ResGetCount();
+ STDMETHODIMP ResGet(DWORD iIndex, BSTR* ppName, BSTR* ppDesc, BSTR* ppMime, BYTE** ppData, DWORD* pDataLen, DWORD_PTR* pTag = NULL);
+ STDMETHODIMP ResSet(DWORD iIndex, LPCWSTR pName, LPCWSTR pDesc, LPCWSTR pMime, BYTE* pData, DWORD len, DWORD_PTR tag = 0);
+ STDMETHODIMP ResAppend(LPCWSTR pName, LPCWSTR pDesc, LPCWSTR pMime, BYTE* pData, DWORD len, DWORD_PTR tag = 0);
+ STDMETHODIMP ResRemoveAt(DWORD iIndex);
+ STDMETHODIMP ResRemoveAll(DWORD_PTR tag = 0);
};
// IDSMChapterBag
@@ -127,88 +127,88 @@ public: interface __declspec(uuid("2D0EBE73-BA82-4E90-859B-C7C48ED3650F"))
IDSMChapterBag :
public IUnknown {
- STDMETHOD_(DWORD, ChapGetCount) () = 0;
- STDMETHOD(ChapGet) (DWORD iIndex, REFERENCE_TIME* prt, BSTR* ppName) = 0;
- STDMETHOD(ChapSet) (DWORD iIndex, REFERENCE_TIME rt, LPCWSTR pName) = 0;
- STDMETHOD(ChapAppend) (REFERENCE_TIME rt, LPCWSTR pName) = 0;
- STDMETHOD(ChapRemoveAt) (DWORD iIndex) = 0;
- STDMETHOD(ChapRemoveAll) () = 0;
- STDMETHOD_(long, ChapLookup) (REFERENCE_TIME* prt, BSTR* ppName) = 0;
- STDMETHOD(ChapSort) () = 0;
+ STDMETHOD_(DWORD, ChapGetCount)() = 0;
+ STDMETHOD(ChapGet)(DWORD iIndex, REFERENCE_TIME * prt, BSTR * ppName) = 0;
+ STDMETHOD(ChapSet)(DWORD iIndex, REFERENCE_TIME rt, LPCWSTR pName) = 0;
+ STDMETHOD(ChapAppend)(REFERENCE_TIME rt, LPCWSTR pName) = 0;
+ STDMETHOD(ChapRemoveAt)(DWORD iIndex) = 0;
+ STDMETHOD(ChapRemoveAll)() = 0;
+ STDMETHOD_(long, ChapLookup)(REFERENCE_TIME * prt, BSTR * ppName) = 0;
+ STDMETHOD(ChapSort)() = 0;
};
class CDSMChapter
{
- static int counter;
- int order;
+ static int counter;
+ int order;
public:
- REFERENCE_TIME rt;
- CStringW name;
- CDSMChapter();
- CDSMChapter(REFERENCE_TIME rt, LPCWSTR name);
- CDSMChapter& operator = (const CDSMChapter& c);
- static int Compare(const void* a, const void* b);
+ REFERENCE_TIME rt;
+ CStringW name;
+ CDSMChapter();
+ CDSMChapter(REFERENCE_TIME rt, LPCWSTR name);
+ CDSMChapter& operator = (const CDSMChapter& c);
+ static int Compare(const void* a, const void* b);
};
class IDSMChapterBagImpl : public IDSMChapterBag
{
protected:
- CAtlArray<CDSMChapter> m_chapters;
- bool m_fSorted;
+ CAtlArray<CDSMChapter> m_chapters;
+ bool m_fSorted;
public:
- IDSMChapterBagImpl();
+ IDSMChapterBagImpl();
- void operator += (const CDSMChapter& c) { m_chapters.Add(c); m_fSorted = false; }
+ void operator += (const CDSMChapter& c) { m_chapters.Add(c); m_fSorted = false; }
- // IDSMChapterBag
+ // IDSMChapterBag
- STDMETHODIMP_(DWORD) ChapGetCount();
- STDMETHODIMP ChapGet(DWORD iIndex, REFERENCE_TIME* prt, BSTR* ppName = NULL);
- STDMETHODIMP ChapSet(DWORD iIndex, REFERENCE_TIME rt, LPCWSTR pName);
- STDMETHODIMP ChapAppend(REFERENCE_TIME rt, LPCWSTR pName);
- STDMETHODIMP ChapRemoveAt(DWORD iIndex);
- STDMETHODIMP ChapRemoveAll();
- STDMETHODIMP_(long) ChapLookup(REFERENCE_TIME* prt, BSTR* ppName = NULL);
- STDMETHODIMP ChapSort();
+ STDMETHODIMP_(DWORD) ChapGetCount();
+ STDMETHODIMP ChapGet(DWORD iIndex, REFERENCE_TIME* prt, BSTR* ppName = NULL);
+ STDMETHODIMP ChapSet(DWORD iIndex, REFERENCE_TIME rt, LPCWSTR pName);
+ STDMETHODIMP ChapAppend(REFERENCE_TIME rt, LPCWSTR pName);
+ STDMETHODIMP ChapRemoveAt(DWORD iIndex);
+ STDMETHODIMP ChapRemoveAll();
+ STDMETHODIMP_(long) ChapLookup(REFERENCE_TIME* prt, BSTR* ppName = NULL);
+ STDMETHODIMP ChapSort();
};
class CDSMChapterBag : public CUnknown, public IDSMChapterBagImpl
{
public:
- CDSMChapterBag(LPUNKNOWN pUnk, HRESULT* phr);
+ CDSMChapterBag(LPUNKNOWN pUnk, HRESULT* phr);
- DECLARE_IUNKNOWN;
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
};
template<class T>
-ptrdiff_t range_bsearch(CAtlArray<T> const &tArray, REFERENCE_TIME rt)
+ptrdiff_t range_bsearch(CAtlArray<T> const& tArray, REFERENCE_TIME rt)
{
- ptrdiff_t i = 0, j = tArray.GetCount() - 1, ret = -1;
- if (j >= 0 && rt >= tArray[j].rt) {
- return j;
- }
- while (i < j) {
- size_t mid = static_cast<size_t>(i + j) >> 1;
- REFERENCE_TIME midrt = tArray[mid].rt;
- if (rt == midrt) {
- ret = mid;
- break;
- } else if (rt < midrt) {
- ret = -1;
- if (j == mid) {
- --mid;
- }
- j = mid;
- } else if (rt > midrt) {
- ret = mid;
- if (i == mid) {
- ++mid;
- }
- i = mid;
- }
- }
- return ret;// in general, the return is unsigned, only when tArray is empty, the return will be -1 for status invalid
+ ptrdiff_t i = 0, j = tArray.GetCount() - 1, ret = -1;
+ if (j >= 0 && rt >= tArray[j].rt) {
+ return j;
+ }
+ while (i < j) {
+ size_t mid = static_cast<size_t>(i + j) >> 1;
+ REFERENCE_TIME midrt = tArray[mid].rt;
+ if (rt == midrt) {
+ ret = mid;
+ break;
+ } else if (rt < midrt) {
+ ret = -1;
+ if (j == mid) {
+ --mid;
+ }
+ j = mid;
+ } else if (rt > midrt) {
+ ret = mid;
+ if (i == mid) {
+ ++mid;
+ }
+ i = mid;
+ }
+ }
+ return ret;// in general, the return is unsigned, only when tArray is empty, the return will be -1 for status invalid
}
|