本文整理汇总了C++中STATIC_CAST函数的典型用法代码示例。如果您正苦于以下问题:C++ STATIC_CAST函数的具体用法?C++ STATIC_CAST怎么用?C++ STATIC_CAST使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了STATIC_CAST函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InstanceObjectFactory_Constructor
HRESULT InstanceObjectFactory_Constructor(REFCLSID rclsid, IPropertyBag *pPropertyBag, REFIID riid,
LPVOID *ppvObject)
{
InstanceObjectFactory *pInstanceObjectFactory;
HRESULT hr = E_FAIL;
TRACE("(RegistryPropertyBag=%p, riid=%s, ppvObject=%p)\n", pPropertyBag,
debugstr_guid(riid), ppvObject);
pInstanceObjectFactory = shdocvw_alloc(sizeof(InstanceObjectFactory));
if (pInstanceObjectFactory) {
pInstanceObjectFactory->lpIClassFactoryVtbl = &InstanceObjectFactory_IClassFactoryVtbl;
pInstanceObjectFactory->m_cRef = 0;
memcpy(&pInstanceObjectFactory->m_clsidInstance, rclsid, sizeof(CLSID));
pInstanceObjectFactory->m_pPropertyBag = pPropertyBag;
IPropertyBag_AddRef(pPropertyBag);
IClassFactory_AddRef(STATIC_CAST(IClassFactory, pInstanceObjectFactory));
hr = IClassFactory_QueryInterface(STATIC_CAST(IClassFactory, pInstanceObjectFactory),
riid, ppvObject);
IClassFactory_Release(STATIC_CAST(IClassFactory, pInstanceObjectFactory));
}
return hr;
}
示例2: STATIC_CAST
void TAknNoteResData::ReadFromResource(TResourceReader& aResReader)
{
iResId = aResReader.ReadInt32();
iTimeout = STATIC_CAST(CAknNoteDialog::TTimeout, aResReader.ReadInt32());
iTone = STATIC_CAST(CAknNoteDialog::TTone, aResReader.ReadInt16());
iText = aResReader.ReadTPtrC();
}
示例3: __ASSERT_ALWAYS
// Writes entire DER encoding of this object into the given buffer
EXPORT_C void CASN1EncBase::WriteDERL(TDes8& aBuf, TUint& aPos) const
{
__ASSERT_ALWAYS(aBuf.Length() - STATIC_CAST(TInt, aPos) >= STATIC_CAST(TInt, LengthDER()),
Panic(KErrDescriptorTooShort));
WriteHelperL(aBuf, aPos, iTagLengthDER, &CASN1EncBase::WriteTagDERL);
WriteHelperL(aBuf, aPos, iLengthLengthDER, &CASN1EncBase::WriteLengthDER);
WriteHelperL(aBuf, aPos, iContentsLengthDER, &CASN1EncBase::WriteContentsDERL);
}
示例4: SUPLLOG
void CSecureSocketReader::SuplMessageLength()
{
SUPLLOG(ELogP1, "CSecureSocketReader::SuplMessageLength() Begin\n");
// Get the first two bytes of iBuffer as a TInt and put it in iSuplMessageLength
iCurrentMessageSize = STATIC_CAST(TUint8,iBuffer[0]);
iCurrentMessageSize = iCurrentMessageSize << 8;
iCurrentMessageSize |= STATIC_CAST(TUint8,iBuffer[1]);
SUPLLOG(ELogP1, "CSecureSocketReader::SuplMessageLength() End\n");
}
示例5: RandomCharCode
//------------------------------------------------------------------------------------------------------------
TText CPerfDbCreator::RandomCharCode(TText aLowerBound,TText aUpperBound)
{
TText charCode=STATIC_CAST(TText,(Math::Rand(iSeed)%(aUpperBound-aLowerBound))+aLowerBound);
ASSERT(charCode>=aLowerBound && charCode<=aUpperBound);
iTextSeed.NumFixedWidthUC((TUint) iSeed, EHex,8);
return charCode;
}
示例6: ModifiersChangedEvent
LOCAL_C TInt ModifiersChangedEvent(const TWsEvent& aWsEvent)
{
TModifiersChangedEvent* modEvent = aWsEvent.ModifiersChanged();
TUint modstate = KMOD_NONE;
if (modEvent->iModifiers & EModifierLeftShift)
modstate |= KMOD_LSHIFT;
if (modEvent->iModifiers & EModifierRightShift)
modstate |= KMOD_RSHIFT;
if (modEvent->iModifiers & EModifierLeftCtrl)
modstate |= KMOD_LCTRL;
if (modEvent->iModifiers & EModifierRightCtrl)
modstate |= KMOD_RCTRL;
if (modEvent->iModifiers & EModifierLeftAlt)
modstate |= KMOD_LALT;
if (modEvent->iModifiers & EModifierRightAlt)
modstate |= KMOD_RALT;
if (modEvent->iModifiers & EModifierLeftFunc)
modstate |= KMOD_LMETA;
if (modEvent->iModifiers & EModifierRightFunc)
modstate |= KMOD_RMETA;
if (modEvent->iModifiers & EModifierCapsLock)
modstate |= KMOD_CAPS;
SDL_SetModState(STATIC_CAST(SDLMod,(modstate | KMOD_LSHIFT)));
return 0;
}
示例7: ALflangerState_Destruct
static ALvoid ALflangerState_Destruct(ALflangerState *state)
{
al_free(state->SampleBuffer[0]);
state->SampleBuffer[0] = NULL;
state->SampleBuffer[1] = NULL;
ALeffectState_Destruct(STATIC_CAST(ALeffectState,state));
}
示例8: CAknNoteDialog
EXPORT_C CAknNoteWrapper::CAknNoteWrapper(CAknNoteWrapper** aSelfPtr)
: CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,aSelfPtr))
{
iTimeoutInMicroseconds = -1;
iTone = STATIC_CAST(TTone,-1);
AKNTASHOOK_ADD( this, "CAknNoteWrapper" );
}
示例9: ALCnullBackend_Construct
static void ALCnullBackend_Construct(ALCnullBackend *self, ALCdevice *device)
{
ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device);
SET_VTABLE2(ALCnullBackend, ALCbackend, self);
ATOMIC_INIT(&self->killNow, AL_TRUE);
}
示例10: lex
// ---------------------------------------------------------
// CDdEng::CheckVersionL()
// ---------------------------------------------------------
//
void CDdEng::CheckVersionL( const TDesC& aVersion ) const
{
TUint32 majorVer = 1; // If version is not specified, it defaults to 1.0.
if( aVersion.Length() )
{
// Version is specified, parse it to get get major version.
TLex lex( aVersion );
TReal realVer;
TInt32 intVer;
if( lex.Val( realVer ) != KErrNone )
{
// Could not parse version as a real number, this indicates that
// the DD-Version is some rubbish string.
User::Leave( KErrCodInvalidDescriptor );
}
User::LeaveIfError( Math::Int( intVer, realVer ) );
if( intVer < 0 )
{
// Negative DD-Version?
User::Leave( KErrCodInvalidDescriptor );
}
majorVer = STATIC_CAST( TUint32, intVer );
}
// For code clarity, we always check major version (even if not given and
// defaults to supported 1.0).
if( majorVer > KDdSupportedMajorVersion )
{
User::Leave( KErrCodUnsupportedVersion );
}
}
示例11: ALCwinmmCapture_Destruct
static void ALCwinmmCapture_Destruct(ALCwinmmCapture *self)
{
void *buffer = NULL;
int i;
/* Tell the processing thread to quit and wait for it to do so. */
if(!ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel))
{
PostThreadMessage(self->thread, WM_QUIT, 0, 0);
althrd_join(self->thread, &i);
/* Make sure capture is stopped and all pending buffers are flushed. */
waveInReset(self->InHdl);
// Release the wave buffers
for(i = 0;i < 4;i++)
{
waveInUnprepareHeader(self->InHdl, &self->WaveBuffer[i], sizeof(WAVEHDR));
if(i == 0) buffer = self->WaveBuffer[i].lpData;
self->WaveBuffer[i].lpData = NULL;
}
free(buffer);
}
ll_ringbuffer_free(self->Ring);
self->Ring = NULL;
// Close the Wave device
if(self->InHdl)
waveInClose(self->InHdl);
self->InHdl = 0;
ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
}
示例12: ALCwinmmPlayback_start
static ALCboolean ALCwinmmPlayback_start(ALCwinmmPlayback *self)
{
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
ALbyte *BufferData;
ALint BufferSize;
ALuint i;
ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release);
if(althrd_create(&self->thread, ALCwinmmPlayback_mixerProc, self) != althrd_success)
return ALC_FALSE;
InitRef(&self->WaveBuffersCommitted, 0);
// Create 4 Buffers
BufferSize = device->UpdateSize*device->NumUpdates / 4;
BufferSize *= FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder);
BufferData = calloc(4, BufferSize);
for(i = 0;i < 4;i++)
{
memset(&self->WaveBuffer[i], 0, sizeof(WAVEHDR));
self->WaveBuffer[i].dwBufferLength = BufferSize;
self->WaveBuffer[i].lpData = ((i==0) ? (CHAR*)BufferData :
(self->WaveBuffer[i-1].lpData +
self->WaveBuffer[i-1].dwBufferLength));
waveOutPrepareHeader(self->OutHdl, &self->WaveBuffer[i], sizeof(WAVEHDR));
waveOutWrite(self->OutHdl, &self->WaveBuffer[i], sizeof(WAVEHDR));
IncrementRef(&self->WaveBuffersCommitted);
}
return ALC_TRUE;
}
示例13: ASSERT
void CProtocolKey::BindToL(CProtocolBase* aProtocol)
/**
* Bind requests protocols "below".
*
* The PFKEY allows here only cryptographic libraries, which are
* recognized from their protocol number #KProtocolCrypto .
*
* @param aProtocol The Cryptographic library.
*/
{
ASSERT(this != aProtocol);
// Find out the ID of given protocol object
TUint id;
{
TServerProtocolDesc info;
aProtocol->Identify(&info);
id = info.iProtocol;
}
if (id == STATIC_CAST(TUint, KProtocolCrypto))
iCrypto->AddLibraryL((CProtocolCrypto *)aProtocol);
else
User::Leave(KErrGeneral); // Only Crypto libraries can be bound to PFKEY!
}
示例14: lexValue
void CIntTestParameter::Construct(TDes& aValue)
{
TLex lexValue(aValue);
if(aValue.Left(2) == _L("0x"))
{
// its a hex number
TUint hexValue;
TLex hexLex(aValue.Mid(2));
if(hexLex.Val(hexValue, EHex)!=KErrNone)
return;
// checks if hexLex is at end of string, if not there was garbage in the string
// so throw it out
else if(!hexLex.Eos())
return;
iValue = STATIC_CAST(TInt,hexValue);
}
else if(lexValue.Val(iValue)!=KErrNone)
return;
// checks if lexValue is at end of string, if not there was garbage in the string
// so throw it out
else if(!lexValue.Eos())
return;
iValid = ETrue;
}
示例15: ALCwinmmPlayback_mixerProc
FORCE_ALIGN static int ALCwinmmPlayback_mixerProc(void *arg)
{
ALCwinmmPlayback *self = arg;
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
WAVEHDR *WaveHdr;
MSG msg;
SetRTPriority();
althrd_setname(althrd_current(), MIXER_THREAD_NAME);
while(GetMessage(&msg, NULL, 0, 0))
{
if(msg.message != WOM_DONE)
continue;
if(ATOMIC_LOAD(&self->killNow, almemory_order_acquire))
{
if(ReadRef(&self->WaveBuffersCommitted) == 0)
break;
continue;
}
WaveHdr = ((WAVEHDR*)msg.lParam);
ALCwinmmPlayback_lock(self);
aluMixData(device, WaveHdr->lpData, WaveHdr->dwBufferLength /
self->Format.nBlockAlign);
ALCwinmmPlayback_unlock(self);
// Send buffer back to play more data
waveOutWrite(self->OutHdl, WaveHdr, sizeof(WAVEHDR));
IncrementRef(&self->WaveBuffersCommitted);
}
return 0;
}