本文整理汇总了C++中TDes::Zero方法的典型用法代码示例。如果您正苦于以下问题:C++ TDes::Zero方法的具体用法?C++ TDes::Zero怎么用?C++ TDes::Zero使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDes
的用法示例。
在下文中一共展示了TDes::Zero方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateHashAndReturnInHexFormatL
/**
Auxilary function should be called only when we need to generate hash values from the screen and returns its hex format.
@param aHexString the output MD5 hash hex string obtained from iBitmapDevice
*/
EXPORT_C void CTHashReferenceImages::GenerateHashAndReturnInHexFormatL(TDes &aHexString)
{
TInt bufLen = CFbsBitmap::ScanLineLength(iBitmapDevice->SizeInPixels().iWidth, iBitmapDevice->DisplayMode());
RBuf8 buff;
buff.CreateL(bufLen);
CleanupClosePushL(buff);
CMD5 *md = CMD5::NewL();
CleanupStack::PushL(md);
for (TPoint pos(0, 0); pos.iY < iBitmapDevice->SizeInPixels().iHeight; pos.iY++)
{
iBitmapDevice->GetScanLine(buff,pos,iBitmapDevice->SizeInPixels().iWidth,iBitmapDevice->DisplayMode());
md->Update(buff);
}
TBuf8<KLengthOfHashValue> hashString;
//md will be reset after calling CMD5::Final() as Final will call Reset.
hashString.Copy(md->Final());
aHexString.Zero();
for(TInt icount=0; icount < hashString.Length(); icount++)
{
aHexString.AppendNumFixedWidth(hashString[icount], EHex, 4);
}
CleanupStack::PopAndDestroy(2, &buff);
}
示例2: SkinDirectoryOnDrive
// -----------------------------------------------------------------------------
// Gets skin directory as descriptor based on drive type and array loc.
// -----------------------------------------------------------------------------
//
void CAknsSrvDriveMaster::SkinDirectoryOnDrive(
TAknsSrvSkinDriveList aDriveType,
TInt aLocation,
TDes& aPath ) const
{
AKNS_TRACE_INFO("CAknsSrvDriveMaster::SkinDirectoryOnDrive");
TInt driveNumber = KErrNotFound;
aPath.Zero();
if ( aDriveType == EAknsSrvStaticDrive )
{
if ( iStaticDriveArray.Count() == 0 )
{
return;
}
if ( aLocation >= 0 && aLocation <= iStaticDriveArray.Count() )
{
driveNumber = iStaticDriveArray[ aLocation ];
AppendDriveLetterToDes( driveNumber, aPath );
aPath.Append( KAknSkinSrvPrivateSkinPath );
}
}
else if ( aDriveType == EAknsSrvRemovableDrive )
{
if ( iRemovableDriveArray.Count() == 0 )
{
return;
}
if ( aLocation >= 0 && aLocation <= iRemovableDriveArray.Count() )
{
driveNumber = iRemovableDriveArray[ aLocation ];
AppendDriveLetterToDes( driveNumber, aPath );
aPath.Append( KAknSkinSrvPrivateSkinPath );
}
}
}
示例3: GetEventInformation
// ----------------------------------------------------
// CAlfExCalendarEngine::NumberOfEvents
// ----------------------------------------------------
void CAlfExCalendarEngine::GetEventInformation(
const TTime& aDate,
TInt aIndex,
TDes& aTextBuffer)
{
aTextBuffer.Zero();
TInt count = KErrNotFound;
TDateTime requestedDate = aDate.DateTime();
const TInt arrayCount = iCalendarEventArray.Count();
for(TInt loop = 0; loop < arrayCount; loop++ )
{
TDateTime eventDate = iCalendarEventArray[loop].iItemDay.DateTime();
if(eventDate.Day() == requestedDate.Day() &&
eventDate.Month() == requestedDate.Month() &&
eventDate.Year() == requestedDate.Year())
{
count++;
}
if(aIndex == count)
{
aTextBuffer.Copy(iCalendarEventArray[loop].iItemText);
loop = arrayCount;
}
}
}
示例4: LoadSettingsL
/**
Loads the database system settings from the settings table.
If the settings table does not exist then it is created with the default settings
(the stored collation dll name will be empty and the stored database configuration
file version will be 0).
@param aDbName Logical database name: "main" for the main database or attached database name,
@param aCollationDllName Output parameter, will contain the stored collation dll name,
@param aDbConfigFileVersion Output parameter, will contain the stored database config file version.
@param aCompactionMode Output parameter. Database compaction mode (one of TSqlCompactionMode enum item values except ESqlCompactionNotSet).
Note that the input value of this parameter might be ESqlCompactionManual if the this is a legacy database,
created not by the SQL server.
@see TSqlCompactionMode
@leave KErrNoMemory, an out of memory condition has occurred.
Note that the function may also leave with some other database specific
errors categorised as ESqlDbError, and other system-wide error codes..
@panic SqlDb 2 In _DEBUG mode if iDbHandle is NULL (uninitialized TSqlDbSysSettings object).
@panic SqlDb 7 In _DEBUG mode if the stored compaction mode is invalid.
*/
void TSqlDbSysSettings::LoadSettingsL(const TDesC& aDbName, TDes& aCollationDllName, TInt& aDbConfigFileVersion, TSqlCompactionMode& aCompactionMode)
{
__ASSERT_DEBUG(iDbHandle != NULL, __SQLPANIC(ESqlPanicInvalidObj));
aCollationDllName.Zero();
aDbConfigFileVersion = KSqlNullDbConfigFileVersion;
if(aCompactionMode == ESqlCompactionNotSet)
{
aCompactionMode = KSqlDefaultCompactionMode;
}
//If the system settings table does not exist then create it now.
//For a database created by the SQL Server this will only occur
//when the database is being created in an application's private data cage -
//as part of this create call it is now being opened by the server.
//An externally created database is likely to not contain the settings table
//and adding it here makes the database 'SQL Server-compatible'
if(!SettingsTableExistsL(aDbName))
{
StoreSettingsL(aDbName, aCollationDllName, KSqlNullDbConfigFileVersion, aCompactionMode); // store empty collation dll name, then reindexing will occur
}
else
{
//Get the settings from the existing table
TInt settingsVersion = 0;
GetSettingsL(aDbName, aCollationDllName, aDbConfigFileVersion, settingsVersion, aCompactionMode);
if(settingsVersion < KSqlSystemVersion)
{
//Recreate the settings table using the last version number format (this is what the old code did during reindexing)
StoreSettingsL(aDbName, aCollationDllName, aDbConfigFileVersion, aCompactionMode); // store empty collation dll name, then reindexing will occur
}
}
__ASSERT_DEBUG(aCompactionMode == ESqlCompactionManual || aCompactionMode == ESqlCompactionBackground || aCompactionMode == ESqlCompactionAuto, __SQLPANIC(ESqlPanicInternalError));
}
示例5: ConvertStringToUnicode
/* if no length is specified, the whole string is converted */
int ConvertStringToUnicode(const unsigned char* aText, TDes& aDesc,
int aLength)
{
if( aText != NULL ) {
/* initialize variables */
aDesc.Zero();
int textlen;
/* check the length of the string */
if( aLength == -1 ) {
textlen = strlen((char*)aText);
} else {
textlen = aLength;
}
/* start copying the string if it's not zero-length */
if( textlen > 0 ) {
/* compensate for longer text than descriptor */
if( textlen >= aDesc.MaxLength() ){
textlen = aDesc.MaxLength()-1;
}
/* copy the data */
for( TInt j=0; j < textlen; j++ )
{
aDesc.Append( aText[j] );
}
aDesc.PtrZ();
}
}else{
return(0);
}
return(aDesc.Length());
}
示例6: GetDscDescriptionL
void CDscDatabase::GetDscDescriptionL(const TUid &aDscId, TDes& aDescription) const
{
RDbView view;
CleanupClosePushL(view);
RBuf sqlCmd;
CleanupClosePushL(sqlCmd);
sqlCmd.CreateL(KSqlSelectDscDescriptionLength);
sqlCmd.Format(KSqlSelectDscDescription, &KDescriptionCol, &KDscTable, &KDscIdCol, aDscId);
DebugPrint(sqlCmd);
User::LeaveIfError(view.Prepare(iDatabase, sqlCmd));
User::LeaveIfError(view.EvaluateAll());
CleanupStack::PopAndDestroy(&sqlCmd);
if(view.IsEmptyL())
{
User::Leave(KErrNotFound);
}
view.FirstL();
view.GetL();
//Check the length of aDescription
TPtrC description(view.ColDes(1));
if (description.Length() > aDescription.MaxLength())
{
User::Leave(KErrOverflow);
}
aDescription.Zero();
aDescription=description;
CleanupStack::PopAndDestroy(&view);
}
示例7: FillRandomData
void FillRandomData(TDes& aData, TInt64 aSeed)
{
aData.Zero();
for (TInt i=0; i<aData.MaxLength(); ++i)
{
// add next character (we stick to lowercase alphabet for now)
aData.Append(TChar(Math::FRand(aSeed)*25 + 'a'));
}
}
示例8: GetFullNameAndPath
void CHlpFileEntry::GetFullNameAndPath(TDes& aName) const
{
TChar driveLetter = '?';
RFs::DriveToChar(Drive(), driveLetter);
aName.Zero();
aName.Append(driveLetter);
aName.Append(':');
aName.Append(KHlpFileSearchPath);
aName.Append(FileName());
}
示例9: GetFileNameForSwpL
/**
Construct a descriptor containing the composite file name from the DLL to load
@param aSwp The swp to create the file name for
@param aLibraryFilename reference to object in which file name is returned
@leave KErrNotFound If the swp is not registered
*/
void CSsmSwpPolicyResolver::GetFileNameForSwpL(const TSsmSwp& aSwp, TDes& aLibraryFilename) const
{
aLibraryFilename.Zero();
aLibraryFilename.Append(KRomDriveLetter);
aLibraryFilename.Append(iSwpPolicyMap->FilenameL(aSwp.Key()));
const TInt postfixLength = KDllFilenamePostfix().Length();
if(KDllFilenamePostfix().CompareF(aLibraryFilename.Right(postfixLength)))
{
aLibraryFilename.Append(KDllFilenamePostfix);
}
}
示例10: GetServerEventData
// ---------------------------------------------------------------------------
// RPeninputServerImpl::GetServerEventData
// Retrieve server event data
// ---------------------------------------------------------------------------
//
TInt RPeninputServerImpl::GetServerEventData(TDes& aBuf)
{
if(iServerExit) // ???
return -1;
TIpcArgs arg;
aBuf.Zero();
arg.Set(KMsgSlot0,aBuf.MaxLength());
arg.Set(KMsgSlot1,&aBuf);
return SendReceive(EPeninputRequestGetServerEventData,arg);
}
示例11: DefaultSkinDirectoryOnMemoryCard
// -----------------------------------------------------------------------------
// Finds and appends skin server's private mass memory drive directory to a string.
// -----------------------------------------------------------------------------
//
void CAknsSrvDriveMaster::DefaultSkinDirectoryOnMemoryCard( TDes& aPath )
{
AKNS_TRACE_INFO("CAknsSrvDriveMaster::DefaultSkinDirectoryOnMemoryCard");
aPath.Zero();
TInt drive = KErrNotFound;
DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive );
AppendDriveLetterToDes( drive, aPath );
if ( aPath.Length() )
{
aPath.Append( KAknSkinSrvPrivateSkinPath );
}
}
示例12: GetCountryName
EXPORT_C void GetCountryName(TInt aMcc, TDes& aInto)
{
TMccItem i= { aMcc, _S("") };
TMccKey k;
k.SetPtr(&i);
TInt pos;
if ( User::BinarySearch(MCC_COUNT, k, pos)==0 ) {
aInto = (TText16*)KMccItems[pos].iCountryName;
} else {
aInto.Zero();
}
}
示例13: ConvertFromPythonString
void CLocaLogicImpl::ConvertFromPythonString(TDes& aBuf, PyObject* aString)
{
aBuf.Zero();
if (PyString_Check(aString)) {
TInt state=CCnvCharacterSetConverter::KStateDefault;
TInt len=PyString_Size(aString);
if (len > aBuf.MaxLength()) len=aBuf.MaxLength();
iCC->ConvertToUnicode(aBuf, TPtrC8((TUint8*)PyString_AsString(aString),
len), state);
} else if (PyUnicode_Check(aString)) {
TInt len=PyUnicode_GetSize(aString)/2;
if (len > aBuf.MaxLength()) len=aBuf.MaxLength();
aBuf=TPtrC((TUint16*)PyUnicode_AsUnicode(aString), len);
}
}
示例14: CompleteWithDllPath
// -----------------------------------------------------------------------------
// Compelete file name with file path of the dll
// -----------------------------------------------------------------------------
//
EXPORT_C TInt MPXUser::CompleteWithDllPath(const TDesC& aDllName, TDes& aFileName)
{
MPX_DEBUG2("==>MPXUser::CompleteWithDllPath aFileName %S", &aFileName);
TInt error(KErrNotSupported);
MPX_DEBUG2("MPX Dll file path: %S", &aDllName);
TPtrC driveAndPath = TParsePtrC(aDllName).DriveAndPath();
TParse parse;
error = parse.Set(aFileName, &driveAndPath, NULL);
if (!error)
{
aFileName.Zero();
aFileName.Append(parse.FullName());
}
MPX_DEBUG2("<==MPXUser::CompleteWithDllPath aFileName %S", &aFileName);
return error;
}
示例15: GetMessageContents
// -----------------------------------------------------------------------------
// RCbsTopicMessages::GetMessageContents
// Returns the message contents.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt RCbsTopicMessages::GetMessageContents(
const TCbsMessageHandle& aHandle,
TDes& aBuffer )
{
// Send request to get the message contents
TPckgBuf< TCbsMessageHandle > pckgHandle( aHandle );
TInt length = aBuffer.MaxLength();
const TIpcArgs args( &pckgHandle, length, &aBuffer );
TInt result( SendReceive( ECbsGetMessageContents, args ) );
if ( result != KErrNone )
{
aBuffer.Zero();
}
return result;
}