本文整理汇总了C++中SAFE_ADDREF函数的典型用法代码示例。如果您正苦于以下问题:C++ SAFE_ADDREF函数的具体用法?C++ SAFE_ADDREF怎么用?C++ SAFE_ADDREF使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SAFE_ADDREF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SAFE_ADDREF
/////////////////////////////////////////////////////////////////////////////
// CAggregate::QueryInterface
//
/////////////////////////////////////////////////////////////////////////////
HRESULT CAggregate::QueryInterface(REFIID riid, LPVOID *ppv)
{
HRESULT hr = S_OK;
//TEST_ NULL
if(ppv == NULL)
return E_INVALIDARG;
*ppv = NULL;
//Support IID_IUnknown
if(riid == IID_IUnknown)
{
*ppv = (IUnknown*)this;
SAFE_ADDREF((IUnknown*)*ppv);
}
else if(riid == IID_IAggregate)
{
*ppv = (IUnknown*)this;
SAFE_ADDREF((IUnknown*)*ppv);
}
else if(m_spUnkInner)
{
//Delegate the the Inner Object
//This is not "circular" since this interface is the IID_IUnknown
//interface only, which has its own non-delegating QI...
hr = m_spUnkInner->QueryInterface(riid, ppv);
}
else
{
return E_NOINTERFACE;
}
return hr;
}
示例2: SAFE_ADDREF
MgdCreateFileFeatureSource::MgdCreateFileFeatureSource(
MgResourceIdentifier* resource,
MgFileFeatureSourceParams* params)
{
m_resource = resource;
SAFE_ADDREF(resource);
m_params = params;
SAFE_ADDREF(params);
}
示例3: MgNullArgumentException
//////////////////////////////////////////////////////////////
// Create and initialize an MgdMapPlot instance.
MgdMapPlot::MgdMapPlot(MgdMap* map, MgdPlotSpecification* plotSpec, MgdLayout* layout)
{
if (NULL == map || NULL == plotSpec)
{
throw new MgNullArgumentException(L"MgdMapPlot.MgdMapPlot", __LINE__, __WFILE__, NULL, L"", NULL);
}
Initialize();
m_map = SAFE_ADDREF(map);
m_plotSpec = SAFE_ADDREF(plotSpec);
m_layout = SAFE_ADDREF(layout);
m_plotInstruction = MgdMapPlotInstruction::UseMapCenterAndScale;
}
示例4: SAFE_ADDREF
////////////////////////////////////////////////////////
// CBase::CBase
//
////////////////////////////////////////////////////////
CBase::CBase(CBase* pCBase, LPUNKNOWN pUnkOuter)
{
m_cRef = 0;
m_pCBase = pCBase;
SAFE_ADDREF(m_pCBase);
m_pUnkOuter = pUnkOuter ? pUnkOuter : this;
//AddRef the parent object...
//This is done since all Child objects in OLE DB have some way to
//get back to the parent, Session -> DataSource, Rowset -> Command.
//We need to addref the parent so its still active whenever needed to get back to
if(m_pCBase)
SAFE_ADDREF(m_pCBase->m_pUnkOuter);
}
示例5: SAFE_RELEASE
//////////////////////////////////////////////////////////////
// Set the extent and expand to fit flag.
void MgdMapPlot::SetExtent(MgEnvelope* extent, bool expandToFit)
{
SAFE_RELEASE(m_extent);
m_extent = SAFE_ADDREF(extent);
m_bExpandToFit = expandToFit;
m_plotInstruction = MgdMapPlotInstruction::UseOverriddenExtent;
}
示例6: m_extents
MgdFeatureInfoRenderer::MgdFeatureInfoRenderer(MgdSelection* selection, int maxFeatures, double mapScale, double* point, SE_Renderer* impRenderer)
: m_extents(0.0, 0.0, 1.0, 1.0),
m_numFeatures(0),
m_url(L""),
m_tooltip(L""),
m_props(NULL),
m_layerId(L""),
m_nMaxFeatures(maxFeatures),
m_mapScale(mapScale),
m_fcName(L""),
m_mapInfo(NULL),
m_layerInfo(NULL),
m_fcInfo(NULL),
m_pointTest(false),
m_impRenderer(impRenderer)
{
m_selection = SAFE_ADDREF(selection);
m_keyEncode = new KeyEncode();
if(point != NULL)
{
m_point[0] = point[0];
m_point[1] = point[1];
m_needPointTest = true;
}
else
m_needPointTest = false;
}
示例7: m_fLifespan
cParticleSystem::cParticleSystem(LPD3DXSPRITE pSprite)
: m_fLifespan(0.0f)
, m_fLifespanVar(0.0f)
, m_fStartSize(0.0f)
, m_fStartSizeVar(0.0f)
, m_fFinishSize(0.0f)
, m_fFinishSizeVar(0.0f)
, m_fEmitterAngle(0.0f)
, m_fEmitterAngleVar(0.0f)
, m_fStartRot(0.0f)
, m_fStartRotVar(0.0f)
, m_fEndRot(0.0f)
, m_fEndRotVar(0.0f)
, m_fXVar(0.0f)
, m_fYVar(0.0f)
, m_fSpeed(0.0f)
, m_fSpeedVar(0.0f)
, m_fGravityX(0.0f)
, m_fGravityY(0.0f)
, m_fTanAcc(0.0f)
, m_fTanAccVar(0.0f)
, m_fRadAcc(0.0f)
, m_fRadAccVar(0.0f)
, m_dwStartColor(0)
, m_dwStartColorVar(0)
, m_dwFinishColor(0)
, m_dwFinishColorVar(0)
{
SAFE_ADDREF(pSprite);
m_pSprite = pSprite;
}
示例8: assert
MgByteReader* MgResourceDefinitionManager::GetRepository(
MgResourceIdentifier* resource)
{
assert(NULL != resource && resource->IsRoot());
Ptr<MgByteReader> byteReader;
MG_RESOURCE_SERVICE_TRY()
// Get the resource.
XmlDocument xmlDoc = GetDocument(*resource);
// Create a byte reader.
string document;
xmlDoc.getContent(document); // TODO: Improve performance by using getContentAsXmlInputStream?
Ptr<MgByteSource> byteSource = new MgByteSource(
(unsigned char*)document.c_str(), (INT32)document.length());
byteSource->SetMimeType(MgMimeType::Xml);
byteReader = byteSource->GetReader();
MG_RESOURCE_CONTAINER_CATCH_AND_THROW(L"MgResourceDefinitionManager.GetRepository")
return SAFE_ADDREF((MgByteReader*)byteReader);
}
示例9: SAFE_ADDREF
//////////////////////////////////////////////////////////////////
///<summary>
/// Construct a MgProxyFeatureReader object from a byte source
///</summary>
///<param name="byteSource">Byte source object</param>
///
MgProxyFeatureReader::MgProxyFeatureReader(MgFeatureSet* featureSet)
{
m_currRecord = 0;
m_serverfeatReader = L"";
m_set = SAFE_ADDREF(featureSet);
m_service = NULL;
}
示例10: warning
// ----------------------------------------------------------------------------
// Function:
// CSwapPropPage::AddPages
//
// Description:
// Implementation of IShellPropSheetExt::AddPages. Adds one or more pages
// to a property sheet that the Shell displays for a file object.
//
// Parameters:
// lpfnAddPage - [in] Address of a function that the property sheet
// handler calls to add a page to the property sheet. The
// function takes a property sheet handle returned by the
// CreatePropertySheetPage function and the lParam parameter
// passed to the AddPages method.
// lParam - [in] Parameter to pass to the function specified by the
// lpfnAddPage method.
//
// Return values:
// Returns S_OK if successful. If the method fails, an OLE-defined error
// code is returned
// ----------------------------------------------------------------------------
_Use_decl_annotations_
HRESULT STDMETHODCALLTYPE CSwapPropPage::AddPages
(
LPFNADDPROPSHEETPAGE lpfnAddPage, // See PrSht.h
LPARAM lParam // Used by caller, don't modify
)
{
HRESULT hr = S_OK;
PROPSHEETPAGE psp;
HPROPSHEETPAGE hPage1 = NULL;
AudioFXExtensionParams* pAudioFXParams = (AudioFXExtensionParams*)lParam;
#pragma warning(push)
#pragma warning(disable: 28197)
AudioFXExtensionParams* pAudioFXParamsCopy = new AudioFXExtensionParams;
#pragma warning(pop)
if (pAudioFXParamsCopy == NULL)
{
return E_OUTOFMEMORY;
}
// Make a copy of the params
CopyMemory(pAudioFXParamsCopy, pAudioFXParams, sizeof(AudioFXExtensionParams));
SAFE_ADDREF(pAudioFXParamsCopy->pFxProperties);
// Initialize property page params and create page
psp.dwSize = sizeof(psp);
psp.dwFlags = PSP_USEREFPARENT | PSP_USECALLBACK;
psp.hInstance = _AtlBaseModule.GetModuleInstance();
psp.hIcon = 0;
psp.pcRefParent = (UINT*)&m_dwRef;
psp.lParam = (LPARAM)pAudioFXParamsCopy;
psp.pszTemplate = MAKEINTRESOURCE(IDD_SWAP_PROP_PAGE);
psp.pfnDlgProc = (DLGPROC)DialogProcPage1;
psp.pfnCallback = PropSheetPageProc;
// Create the property sheet page and add the page
hPage1 = CreatePropertySheetPage(&psp);
if (hPage1)
{
if (!lpfnAddPage(hPage1, pAudioFXParams->AddPageParam))
{
hr = E_FAIL;
delete pAudioFXParamsCopy;
DestroyPropertySheetPage(hPage1);
}
else
{
// Add ref for page
this->AddRef();
}
}
else
{
delete pAudioFXParamsCopy;
hr = E_OUTOFMEMORY;
}
return(hr);
}
示例11: MgInvalidArgumentException
/// <summary>
/// Constructor
/// </summary>
/// <param name="className">
/// Name of class from which data to be deleted
/// </param>
/// <param name="filterText">
/// Filter crieteria to be applied for deletion
/// </param>
/// <returns>
/// Nothing
/// </returns>
MgInsertFeatures::MgInsertFeatures(CREFSTRING className, MgBatchPropertyCollection* propertyValues)
{
if (className.empty())
{
MgStringCollection arguments;
arguments.Add(L"1");
arguments.Add(MgResources::BlankArgument);
throw new MgInvalidArgumentException(L"MgInsertFeatures.MgInsertFeatures",
__LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
}
if (propertyValues == NULL)
{
throw new MgNullArgumentException(L"MgInsertFeatures.MgInsertFeatures", __LINE__, __WFILE__, NULL, L"", NULL);
}
if (propertyValues->GetCount() == 0)
{
MgStringCollection arguments;
arguments.Add(L"2");
arguments.Add(L"0");
throw new MgInvalidArgumentException(L"MgInsertFeatures.MgInsertFeatures",
__LINE__, __WFILE__, &arguments, L"MgPropertyValuesEmpty", NULL);
}
m_className = className;
m_properties = SAFE_ADDREF(propertyValues);
}
示例12: m_pSprite
cSprite::cSprite(LPD3DXSPRITE pSprite)
: m_pSprite(NULL)
, m_pTexture(NULL)
{
SAFE_ADDREF(pSprite);
m_pSprite = pSprite;
m_dwColor = D3DCOLOR_ARGB(255, 255, 255, 255);
}
示例13: SAFE_ADDREF
// ----------------------------------------------------------------------------------------------
Texture::Texture(Texture* tex)
{
if(tex)
{
m_tex = tex->m_tex;
m_view = tex->m_view;
m_texType = tex->GetTextureType();
SAFE_ADDREF(m_tex);
SAFE_ADDREF(m_view);
}
else
{
m_tex = NULL;
m_view = NULL;
m_texType = TextureType::Unknown;
}
}
示例14: FDO_SAFE_ADDREF
MgdSqlDataReader::MgdSqlDataReader(MgdFeatureConnection* conn, FdoISQLDataReader* reader)
{
m_reader = FDO_SAFE_ADDREF(reader);
m_connection = SAFE_ADDREF(conn);
// The reader takes ownership of the FDO connection
m_connection->OwnReader();
}
示例15: CHECKNULL
void MgProxySqlDataReader::SetService(MgFeatureService* service)
{
CHECKNULL(service, L"MgProxySqlDataReader.SetService");
if (m_service == NULL)
{
m_service = SAFE_ADDREF(service);
}
}