Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
CPropertyBag Class Reference

#include <PropertyBag.h>

Collaboration diagram for CPropertyBag:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CPropertyBag ()
virtual ~CPropertyBag ()
virtual HRESULT STDMETHODCALLTYPE Read (LPCOLESTR pszPropName, VARIANT __RPC_FAR *pVar, IErrorLog __RPC_FAR *pErrorLog)
virtual HRESULT STDMETHODCALLTYPE Write (LPCOLESTR pszPropName, VARIANT __RPC_FAR *pVar)

Private Attributes

PropertyList m_PropertyList

Detailed Description

Definition at line 46 of file PropertyBag.h.


Constructor & Destructor Documentation

Definition at line 43 of file PropertyBag.cpp.

{
}

Definition at line 48 of file PropertyBag.cpp.

{
}

Member Function Documentation

HRESULT STDMETHODCALLTYPE CPropertyBag::Read ( LPCOLESTR  pszPropName,
VARIANT __RPC_FAR *  pVar,
IErrorLog __RPC_FAR *  pErrorLog 
) [virtual]

Definition at line 56 of file PropertyBag.cpp.

{
    if (pszPropName == NULL)
    {
        return E_INVALIDARG;
    }
    if (pVar == NULL)
    {
        return E_INVALIDARG;
    }

    VARTYPE vt = pVar->vt;
    VariantInit(pVar);

    for (unsigned long i = 0; i < m_PropertyList.GetSize(); i++)
    {
        if (wcsicmp(m_PropertyList.GetNameOf(i), pszPropName) == 0)
        {
            const VARIANT *pvSrc = m_PropertyList.GetValueOf(i);
            if (!pvSrc)
            {
                return E_FAIL;
            }
            CComVariant vNew;
            HRESULT hr = (vt == VT_EMPTY) ?
                vNew.Copy(pvSrc) : vNew.ChangeType(vt, pvSrc);
            if (FAILED(hr))
            {
                return E_FAIL;
            }
            // Copy the new value
            vNew.Detach(pVar);
            return S_OK;
        }
    }

    // Property does not exist in the bag
    return E_FAIL;
}

Here is the call graph for this function:

HRESULT STDMETHODCALLTYPE CPropertyBag::Write ( LPCOLESTR  pszPropName,
VARIANT __RPC_FAR *  pVar 
) [virtual]

Definition at line 97 of file PropertyBag.cpp.

{
    if (pszPropName == NULL)
    {
        return E_INVALIDARG;
    }
    if (pVar == NULL)
    {
        return E_INVALIDARG;
    }

    CComBSTR bstrName(pszPropName);
    m_PropertyList.AddOrReplaceNamedProperty(bstrName, *pVar);

    return S_OK;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 50 of file PropertyBag.h.


The documentation for this class was generated from the following files: