// @pymethod |PyIPersistPropertyBag|Save|Called by the container to save the object's properties.
PyObject *PyIPersistPropertyBag::Save(PyObject *self, PyObject *args)
{
	PyObject *obBag; // @pyparm <o PyIPropertyBag>|bag||the caller's property bag.
	int clearDirty; // @pyparm int|clearDirty||Specifies whether to clear the dirty flag.
	int saveAllProperties; // @pyparm int|saveProperties||Specifies whether to save all properties or just those that have changed
	if ( !PyArg_ParseTuple(args, "Oii:Save", &obBag, &clearDirty, &saveAllProperties) )
		return NULL;

	IPersistPropertyBag *pIPPB = GetI(self);
	if ( pIPPB == NULL )
		return NULL;

	IPropertyBag *pIPB;
	if ( !PyCom_InterfaceFromPyObject(obBag, IID_IPropertyBag, (LPVOID*)&pIPB, FALSE) )
		return NULL;

	PY_INTERFACE_PRECALL;
	HRESULT hr = pIPPB->Save(pIPB, clearDirty, saveAllProperties);
	pIPB->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIPPB, IID_IPersistPropertyBag);

	Py_INCREF(Py_None);
	return Py_None;
}
Ejemplo n.º 2
0
bool CTSProcessor::SaveProperties(IPropertyBag *pPropBag)
{
	IPersistPropertyBag *pPersistPropBag;

	if (FAILED(m_pTSProcessor->QueryInterface(IID_PPV_ARGS(&pPersistPropBag))))
		return false;

	HRESULT hr = pPersistPropBag->Save(pPropBag, FALSE, TRUE);

	pPersistPropBag->Release();

	return SUCCEEDED(hr);
}