mirror of https://github.com/tongzx/nt5src
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.
44 lines
834 B
44 lines
834 B
//
|
|
// 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;
|
|
}
|