Add Dirk Luetjen's ssphys libraries and command-line tool
[vss2svn.git] / ssphys / SSAPI / VSSItems.cpp
bloba7d94c6f77552fe41156a48743b7f097895f1ae7
1 // VSSItems.cpp : Implementation of CVSSItems
2 #include "stdafx.h"
3 #include "SSAPI.h"
4 #include "VSSItems.h"
5 #include "VSSItem.h"
7 /////////////////////////////////////////////////////////////////////////////
8 // CVSSItems
10 STDMETHODIMP CVSSItems::get_Count(LONG * piCount)
12 if (piCount == NULL)
13 return E_POINTER;
15 ATLASSERT (m_pSSItems);
16 *piCount = m_pSSItems->GetCount ();
18 return NO_ERROR;
20 STDMETHODIMP CVSSItems::get_Item(VARIANT sItem, IVSSItem * * ppIItem)
22 if (ppIItem == NULL)
23 return E_POINTER;
25 ATLASSERT (m_pSSItems);
26 // starts counting with 1
27 long count = _variant_t(sItem);
28 SSItem* pItem = m_pSSItems->GetItem (count - 1);
30 CComObject<CVSSItem>* pVssItem;
31 HRESULT hRes = CComObject<CVSSItem>::CreateInstance(&pVssItem);
32 if (FAILED(hRes))
33 return hRes;
35 pVssItem->AddRef();
36 pVssItem->Init (pItem);
38 *ppIItem = pVssItem;
40 return NO_ERROR;
42 STDMETHODIMP CVSSItems::_NewEnum(IUnknown * * ppIEnum)
44 if (ppIEnum == NULL)
45 return E_POINTER;
47 return E_NOTIMPL;