本文整理汇总了C++中ChkComOutPtr函数的典型用法代码示例。如果您正苦于以下问题:C++ ChkComOutPtr函数的具体用法?C++ ChkComOutPtr怎么用?C++ ChkComOutPtr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ChkComOutPtr函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChkComOutPtr
/*----------------------------------------------------------------------------------------------
Return a list of recognized values for the given feature. If cfvalMax is zero,
pcfval returns the total number of values. Otherwise, it returns the number entered into
the array.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP FwGrEngine::GetFeatureValues(int fid, int cfvalMax,
int * prgfval, int * pcfval, int * pfvalDefault)
{
BEGIN_COM_METHOD;
ChkComOutPtr(pcfval);
ChkComOutPtr(pfvalDefault);
ChkComArrayArg(prgfval, cfvalMax);
if (!m_pfont)
{
Assert(false);
return E_UNEXPECTED;
}
FeatureIterator fit = m_pfont->featureWithID(fid);
std::pair<FeatureSettingIterator, FeatureSettingIterator> pairIt
= m_pfont->getFeatureSettings(fit);
FeatureSettingIterator fsit = pairIt.first;
FeatureSettingIterator fsitEnd = pairIt.second;
int cfval = fsitEnd - fsit;
if (cfvalMax == 0)
{
*pcfval = cfval;
return S_OK;
}
*pcfval = min(cfvalMax, cfval);
for (int i = 0;
fsit != pairIt.second;
++fsit, i++)
{
if (i >= *pcfval)
break;
prgfval[i] = (*fsit);
}
FeatureSettingIterator fsitDefault = m_pfont->getDefaultFeatureValue(fit);
*pfvalDefault = *fsitDefault;
for (int ifeat = 0; ifeat < m_cfeatWDefaults; ifeat++)
{
if (m_rgfsetDefaults[ifeat].id == fid)
{
*pfvalDefault = m_rgfsetDefaults[ifeat].value;
break;
}
}
END_COM_METHOD(g_fact, IID_IRenderingFeatures);
}
示例2: ChkComOutPtr
/*----------------------------------------------------------------------------------------------
Return the support script directions. For the Roman renderer, this is simply horizontal
left-to-right.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP RomRenderEngine::get_ScriptDirection(int * pgrfsdc)
{
BEGIN_COM_METHOD
ChkComOutPtr(pgrfsdc);
*pgrfsdc = kfsdcHorizLtr;
END_COM_METHOD(g_fact, IID_IRenderEngine);
}
示例3: ChkComBstrArgN
/*----------------------------------------------------------------------------------------------
Do a direct string comparison.
Note that, contrary to what the contract implies, this routine is not more
efficient than the client just retrieving the keys and comparing them.
OPTIMIZE: would we benefit significantly by implementing this using CompareString?
Unfortunately, it is hard to avoid the need to do the WideCharToMultiByte conversion
for the whole of both strings...
----------------------------------------------------------------------------------------------*/
STDMETHODIMP LgIcuCollator::Compare(BSTR bstrValue1, BSTR bstrValue2,
LgCollatingOptions colopt, int * pnVal)
{
BEGIN_COM_METHOD
ChkComBstrArgN(bstrValue1);
ChkComBstrArgN(bstrValue2);
ChkComOutPtr(pnVal);
EnsureCollator();
int32_t cbKey1 = keySize;
byte rgbKey1[keySize+1];
Vector<byte> vbKey1;
byte * pbKey1 = GetSortKey(bstrValue1, rgbKey1, &cbKey1, vbKey1);
int32_t cbKey2 = keySize;
byte rgbKey2[keySize+1];
Vector<byte> vbKey2;
byte * pbKey2 = GetSortKey(bstrValue2, rgbKey2, &cbKey2, vbKey2);
*pnVal = strcmp((char *)pbKey1, (char *)pbKey2);
return S_OK;
END_COM_METHOD(g_fact, IID_ILgCollatingEngine);
}
示例4: ChkComBstrArg
/*----------------------------------------------------------------------------------------------
Generate the sort key as a BSTR
----------------------------------------------------------------------------------------------*/
STDMETHODIMP LgUnicodeCollater::get_SortKey(BSTR bstrValue, LgCollatingOptions colopt,
BSTR * pbstrKey)
{
BEGIN_COM_METHOD
ChkComBstrArg(bstrValue);
ChkComOutPtr(pbstrKey);
HRESULT hr;
int cchw;
*pbstrKey = NULL;
// Passing 0 and null just produces a length
IgnoreHr(hr = SortKeyRgch(bstrValue, BstrLen(bstrValue), colopt, 0, NULL, &cchw));
if (FAILED(hr))
return hr;
BSTR bstrOut;
bstrOut = SysAllocStringLen(NULL, cchw);
if (!bstrOut)
return E_OUTOFMEMORY;
IgnoreHr(hr = SortKeyRgch(bstrValue, BstrLen(bstrValue), colopt, cchw, bstrOut, &cchw));
if (FAILED(hr))
{
SysFreeString(bstrOut);
return hr;
}
*pbstrKey = bstrOut;
END_COM_METHOD(g_fact, IID_ILgCollatingEngine);
}
示例5: style
/*----------------------------------------------------------------------------------------------
Create a property with the given writing system, old writing system, and named style (ktptNamedStyle).
Note that ktptCharStyle (which this used to use) is effectively obsolete.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP TsPropsFact::MakePropsRgch(const OLECHAR * prgch, int cch, int ws, int ows,
ITsTextProps ** ppttp)
{
BEGIN_COM_METHOD;
ChkComArrayArg(prgch, cch);
ChkComOutPtr(ppttp);
if ((uint)ws > kwsLim)
ThrowInternalError(E_INVALIDARG, "Magic writing system invalid in string");
TsIntProp tip;
TsStrProp tsp;
int ctip = 0;
int ctsp = 0;
tip.m_nVal = ws;
tip.m_nVar = ows;
tip.m_tpt = ktptWs;
ctip = 1;
if (cch)
{
StrUni stu(prgch, cch);
TsStrHolder * ptsh = TsStrHolder::GetStrHolder();
tsp.m_hstuVal = ptsh->GetCookieFromString(stu);
tsp.m_tpt = ktptNamedStyle;
ctsp = 1;
}
TsTextProps::Create(ctip ? &tip : NULL, ctip, ctsp ? &tsp : NULL, ctsp, ppttp);
END_COM_METHOD(g_factPropsFact, IID_ITsPropsFactory);
}
示例6: ChkComOutPtr
/*----------------------------------------------------------------------------------------------
Return the number of outstanding Redoable sequences. This is the number of
times the user could issue the Redo command.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP ActionHandler::get_RedoableSequenceCount(int * pcAct)
{
BEGIN_COM_METHOD;
ChkComOutPtr(pcAct);
*pcAct = m_viSeqStart.Size() - m_iCurrSeq - 1;
END_COM_METHOD(g_factActh, IID_IActionHandler);
}
示例7: database
/*----------------------------------------------------------------------------------------------
Return the writing system factory for this database (or the registry, as the case may be).
@param ppwsf Address of the pointer for returning the writing system factory.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP FwGrEngine::get_WritingSystemFactory(ILgWritingSystemFactory ** ppwsf)
{
BEGIN_COM_METHOD
ChkComOutPtr(ppwsf);
*ppwsf = m_qwsf;
(*ppwsf)->AddRef();
END_COM_METHOD(g_fact, IID_IRenderEngine)
}
示例8: properties
/*----------------------------------------------------------------------------------------------
Read an array of ITsTextProps from a byte array and return it. If cpttpMax == 0, return
in cpttpRet the number of items present. Return S_FALSE if the array is not totally
consumed, but at least one ITsTextProps is successfully read.
For runs that have duplicate properties (ie, where the offsets into the properties stuff
are identical), returns duplicate pointers in rgpttp.
Also return the character counts for each run, so that we can reconstruct the
run information later on.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP TsPropsFact::DeserializeRgPropsRgb(int cpttpMax, const BYTE * prgb, int * pcb,
int * pcpttpRet, ITsTextProps ** rgpttp, int * rgich)
{
BEGIN_COM_METHOD;
ChkComArgPtr(pcb);
ChkComOutPtr(pcpttpRet);
ChkComArrayArg(prgb, *pcb);
ChkComArrayArg(rgpttp, cpttpMax);
ChkComArrayArg(rgich, cpttpMax);
DataReaderRgb drrHdr(prgb, *pcb);
int crun;
drrHdr.ReadInt(&crun);
if (cpttpMax == 0)
{
*pcpttpRet = crun;
}
else
{
Vector<int> vcbOffsets;
vcbOffsets.Resize(crun);
const byte * pbRun0 = prgb + isizeof(int) + (crun * isizeof(int) * 2);
for (int irun = 0; irun < min(cpttpMax, crun); irun++)
{
drrHdr.ReadInt(rgich + irun); // character min
int cbOffsetThisRun;
drrHdr.ReadInt(&cbOffsetThisRun);
vcbOffsets[irun] = cbOffsetThisRun;
// Check for a duplicate set of properties.
int irunDup;
for (irunDup = 0; irunDup < irun; irunDup++)
{
if (cbOffsetThisRun == vcbOffsets[irunDup])
{
// Duplicate offset: copy the previous ITsTextProps.
rgpttp[irun] = rgpttp[irunDup];
rgpttp[irun]->AddRef();
break;
}
}
if (irunDup >= irun) // didn't find duplicate
{
const byte * pbThisRun = pbRun0 + cbOffsetThisRun;
// Note that the buffer size is provided below simply as a sanity check. The
// data itself is structured so that the deserialize method knows how much
// to read for each run.
DataReaderRgb drr(pbThisRun, (*pcb - (pbThisRun - prgb)));
TsTextProps::DeserializeDataReader(&drr, rgpttp + irun);
}
}
*pcpttpRet = min(cpttpMax, crun);
}
END_COM_METHOD(g_factPropsFact, IID_ITsPropsFactory);
}