本文整理汇总了C++中RBuf8::AppendNum方法的典型用法代码示例。如果您正苦于以下问题:C++ RBuf8::AppendNum方法的具体用法?C++ RBuf8::AppendNum怎么用?C++ RBuf8::AppendNum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RBuf8
的用法示例。
在下文中一共展示了RBuf8::AppendNum方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FillReferenceBuffer
TInt CUptCsvGenerator::FillReferenceBuffer(RBuf8& aBufferName, const TInt& aAppendCount, const RArray<TInt64>& aData1Name, const TInt& aData1Count, const RArray<TInt64>& aData2Name, const TInt& aData2Count)
{
for(TInt i=0; i!=aAppendCount;i++)
{
// first line of data
for(TInt j=0;j!=aData1Count;j++)
{
aBufferName.AppendNum(aData1Name[j]);
//if(j!=aData1Count-1)
if(j!=aData1Count)
aBufferName.Append(KCsvComma);
}
// newline
aBufferName.Append(KCsvNewLine);
// second line of data with a potentially different number of elements
for(TInt j=0;j!=aData2Count;j++)
{
aBufferName.AppendNum(aData2Name[j]);
//if(j!=aData2Count-1)
if(j!=aData2Count)
aBufferName.Append(KCsvComma);
}
aBufferName.Append(KCsvNewLine);
}
return 0;
}
示例2: WriteL
/** This user-side method uses the RFile Session methods to find the end of the file described by iCSVFile.
It then appends performance data metrics by element from the passed array, with each element separated by a comma character.
@param aPerformanceData is the constant array of performance data stored as TInt32
@return KErrNone if command was prepared correctly and a system wide error code otherwise.
*/
void CUptCsvGenerator::WriteL(const RArray<TInt64>& aPerformanceData)
{
// find end of this file, and append the passed data from here.
TInt filesize;
iCsvFile.Size(filesize);
iCsvFile.Seek(ESeekStart, filesize);
RBuf8 buf;
CleanupClosePushL(buf);
//create a buf large enough to contain the passed data and comma separators
TInt numbytes = 2*aPerformanceData.Count()*sizeof(TInt64);
buf.CreateL(numbytes);
//for the number of elements in the passed array:- append each element, separated by a comma, to the buffer
for(TInt i=0; i!=aPerformanceData.Count(); i++) //could replace aPerformance.Count() with structure paramter Parameter.Count
{
buf.AppendNum(aPerformanceData[i]);
//may reimplement this
if(i!=aPerformanceData.Count())
buf.Append(KCsvComma);
}
//write the buffer to the given file
User::LeaveIfError(iCsvFile.Write(buf));
//close and cleanup the heap objects
buf.Close();
CleanupStack::PopAndDestroy(&buf);
}
示例3: StartL
// ---------------------------------------------------------------------------------
// CUpnpTmServerDeviceXmlParser::StartL
// Method which inputs xml formatted buffer content to the XML Parser
// and invokes parsing
// ---------------------------------------------------------------------------------
//
void CUpnpTmServerDeviceXmlParser::StartL()
{
OstTraceFunctionEntry0( CUPNPTMSERVERDEVICEXMLPARSER_STARTL_ENTRY );
TDriveNumber drive = RFs::GetSystemDrive(); //Find system's drive
TBuf<UpnpString::KMaxFilenameLength> privatePath;
TInt err = iFs.PrivatePath(privatePath); //Find the application's private path
// a) If the Private Path is not found (for whatever reasons),
// Create a private path in the System Drive
if( err == KErrNotFound )
{
User::LeaveIfError( iFs.CreatePrivatePath(drive) );
}
// b) If Private Path is found but is a read-only or non-persistent drive
// Create a private path in the system drive else use it
else if( err == KErrNone )
{
TDriveInfo driveInfo;
User::LeaveIfError( iFs.Drive(driveInfo));
TUint driveAttr = driveInfo.iDriveAtt;
if ( driveAttr == KDriveAttRom )
{
User::LeaveIfError( iFs.CreatePrivatePath(drive) );
}
}
else
{
OstTrace1( TRACE_ERROR, CUPNPTMSERVERDEVICEXMLPARSER_STARTL, "CUpnpTmServerDeviceXmlParser::StartL;err=%d", err );
User::Leave(err);
}
privatePath.Append(KPublicDevicePath());
err = iFs.MkDirAll(privatePath);
if( err && err != KErrAlreadyExists )
{
OstTrace1( TRACE_ERROR, DUP1_CUPNPTMSERVERDEVICEXMLPARSER_STARTL, "CUpnpTmServerDeviceXmlParser::StartL;err=%d", err );
User::LeaveIfError(err);
}
iDeviceDir.CreateL(privatePath);
RBuf8 rootDeviceBuf;
CleanupClosePushL(rootDeviceBuf);
rootDeviceBuf.CreateL(KBufSize);
rootDeviceBuf.Append(KRootDeviceXmlLead());
// Appends the device icon list to the device xml buffer
const RPointerArray<CUpnpTerminalModeIcon>& deviceList = iDeviceInfo.DeviceIconList();
TInt iconCount = deviceList.Count();
if ( iconCount > KErrNone )
{
privatePath.Append(KIconDirectory());
err = iFs.MkDir(privatePath); // Creates icon directory
if( err && err != KErrAlreadyExists )
{
OstTrace1( TRACE_ERROR, DUP2_CUPNPTMSERVERDEVICEXMLPARSER_STARTL, "CUpnpTmServerDeviceXmlParser::StartL;err=%d", err );
User::LeaveIfError(err);
}
iIconDirectory.CreateL(privatePath);
OstTrace1( TRACE_ERROR, DUP3_CUPNPTMSERVERDEVICEXMLPARSER_STARTL, "CUpnpTmServerDeviceXmlParser::StartL;iconCount=%d", iconCount );
rootDeviceBuf.Append(KStartIconList);
for ( TInt i(0); i < iconCount; i++ )
{
rootDeviceBuf.Append(KStartIcon);
rootDeviceBuf.Append(KStartMimeType);
rootDeviceBuf.Append(deviceList[i]->MimeType());
rootDeviceBuf.Append(KEndMimeType);
rootDeviceBuf.Append(KStartWidth);
rootDeviceBuf.AppendNum(deviceList[i]->Width());
rootDeviceBuf.Append(KEndWidth);
rootDeviceBuf.Append(KStartHeight);
rootDeviceBuf.AppendNum(deviceList[i]->Height());
rootDeviceBuf.Append(KEndHeight);
rootDeviceBuf.Append(KStartDepth);
rootDeviceBuf.AppendNum(deviceList[i]->Depth());
rootDeviceBuf.Append(KEndDepth);
rootDeviceBuf.Append(KStartUrl);
TBuf8<KMaxPath> iconBuf;
const TDesC& fileName = deviceList[i]->IconFilename();
iconBuf.Copy(fileName);
TBuf8<UpnpString::KDefaultStringLength> iconRelativeUrl(KScpdUrl());
// Extracts the actual input filepath and creates the relative url for the icon
// to be provided in the device xml file
iconRelativeUrl.Append(KIconPath());
// Extracts only filename and appends the same to url
iconRelativeUrl.Append(iconBuf.Mid((iconBuf.LocateReverse(KDirectorySeparator))+1));
rootDeviceBuf.Append(iconRelativeUrl);
delete iFileMan;
iFileMan = NULL;
iFileMan = CFileMan::NewL(iFs) ;
// copies icon files to the private device directory
User::LeaveIfError(iFileMan->Copy(fileName,iIconDirectory));
rootDeviceBuf.Append(KEndUrl);
rootDeviceBuf.Append(KEndIcon);
}
rootDeviceBuf.Append(KEndIconList);
}
rootDeviceBuf.Append( iDeviceInfo.DeviceInfo());
//.........这里部分代码省略.........
示例4: Print
void CMsvPreferredDriveList::Print()
{
_LIT8(KLtBracket, "[");
_LIT8(KRtBracket, "]: DRIVE-NUM: ");
_LIT8(KDriveId, " DRIVE-ID: ");
_LIT8(KStatus, " STATUS: ");
_LIT8(KAvailable, "EMsvMessageStoreAvailableStatus");
_LIT8(KUnavailable, "EMsvMessageStoreUnavailableStatus");
_LIT8(KNotSupported, "EMsvMessageStoreNotSupportedStatus");
_LIT8(KDiskNotAvailable, "EMsvDriveDiskNotAvailableStatus");
_LIT8(KCorruptStore, "EMsvMessageStoreCorruptStatus");
_LIT8(KInvalid, "EMsvInvalidDriveStatus");
RFileLogger logger;
if (logger.Connect() == KErrNone)
{
logger.CreateLog(_L("msgs"), _L("DriveList.txt"), EFileLoggingModeAppend);
logger.SetDateAndTime(EFalse, EFalse);
logger.Write(_L(" Preferred Drive List:"));
logger.Write(_L("--------------------------------"));
logger.Write(_L(""));
}
TInt count = Count();
for(TInt index = 0; index < count; ++index)
{
RBuf8 text;
text.CreateL(100);
text.Append(KLtBracket);
text.AppendNum(index);
text.Append(KRtBracket);
text.AppendNum((*iDrives)[index].driveNum);
text.Append(KDriveId);
text.AppendNum((*iDrives)[index].driveId);
text.Append(KStatus);
switch((*iDrives)[index].status)
{
case EMsvMessageStoreAvailableStatus:
text.Append(KAvailable);
break;
case EMsvMessageStoreUnavailableStatus:
text.Append(KUnavailable);
break;
case EMsvMessageStoreNotSupportedStatus:
text.Append(KNotSupported);
break;
case EMsvDriveDiskNotAvailableStatus:
text.Append(KDiskNotAvailable);
break;
case EMsvMessageStoreCorruptStatus:
text.Append(KCorruptStore);
break;
case EMsvInvalidDriveStatus:
text.Append(KInvalid);
break;
}
logger.Write(text);
text.Close();
logger.Write(_L(""));
}
logger.CloseLog();
logger.Close();
}