windows-nt/Source/XPSP1/NT/inetsrv/iis/staxinc/pbag.cpp

45 lines
834 B
C++
Raw Normal View History

2020-09-26 03:20:57 -05:00
//
// pbag.cpp
//
#include "pbag.h"
/////////////////////////////////////////////////////////////////////////////
//
STDMETHODIMP CPropBag::Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog)
{
HRESULT hr = S_OK;
BAGMAP::iterator pFind;
pFind = m_map.find(pszPropName);
if (pFind != m_map.end())
VariantCopy(pVar, &(*pFind).second);
else
hr = E_FAIL;
return hr;
}
STDMETHODIMP CPropBag::Write( LPCOLESTR pszPropName, VARIANT* pVar )
{
HRESULT hr = S_OK;
try
{
pair<BAGMAP::iterator, bool> pr;
pr = m_map.insert(BAGMAP::value_type(pszPropName, *pVar));
if (!pr.second) // couldn't insert (someone's there)
VariantCopy(&(*pr.first).second, pVar);
}
catch(...)
{
return E_OUTOFMEMORY;
}
return hr;
}