本文整理汇总了C++中TBuf16::Copy方法的典型用法代码示例。如果您正苦于以下问题:C++ TBuf16::Copy方法的具体用法?C++ TBuf16::Copy怎么用?C++ TBuf16::Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBuf16
的用法示例。
在下文中一共展示了TBuf16::Copy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModifyUriComponentsL
//Modify URI components
void CExampleInetProtUtil::ModifyUriComponentsL()
{
TUriParser8 parser1;
CUri8* aUri = CUri8::NewL(parser1);
_LIT(KText3, "\n\n\nAdding Uri components one by one....");
iConsole->Printf ( KText3 );
// Adding components to the Uri
//Setting and displaying SCHEME
_LIT8(KScheme, "http");
_LIT(KScheme1, "\nSCHEME : http");
iConsole->Printf ( KScheme1 );
aUri->SetComponentL(KScheme, EUriScheme);
//Setting and displaying HOST
_LIT8(KHost, "www.symbian.com");
_LIT(KHost1, "\nHOST : www.symbian.com");
iConsole->Printf ( KHost1 );
aUri->SetComponentL(KHost, EUriHost);
//Setting and displaying PORT
_LIT8(KPort, "80");
_LIT(KPort1, "\nPORT : 80");
iConsole->Printf ( KPort1 );
aUri->SetComponentL(KPort, EUriPort);
//Setting and displaying PATH
_LIT8(KPath, "/developer/techlib/turic8class.html");
_LIT(KPath1, "\nPATH : /developer/techlib/turic8class.html");
iConsole->Printf ( KPath1 );
aUri->SetComponentL(KPath, EUriPath);
//Display the constucted Uri
_LIT(KText4, "\nThe fully constructed Uri....");
iConsole->Printf ( KText4 );
const TDesC8& desUriDisplay = aUri->Uri().UriDes();
TBuf16<100> desFullUri;
desFullUri.Copy (desUriDisplay);
iConsole->Printf( KLeaveALine );
iConsole->Printf ( desFullUri );
// Removal of component from the Uri
iConsole->Getch ();
_LIT(KText5, "\n\nUri with the Port number removed....\n");
iConsole->Printf ( KText5 );
aUri->RemoveComponentL(EUriPort);
//Display the modified Uri
const TDesC8& desRemovedComponentDisplay =aUri->Uri().UriDes();
TBuf16<100> desRemovedComponent;
desRemovedComponent.Copy (desRemovedComponentDisplay);
iConsole->Printf ( desRemovedComponent );
delete aUri;
iConsole->Getch ();
}
示例2: ExecuteL
// From MTest:
void CTestCase::ExecuteL (TTestResult& aResult)
{
TInt error = ExecuteImplL();
aResult.iResult = error;
// add the possible failure or error to the result
if (error == KErrCppUnitAssertionFailed)
{
CAssertFailure* assertFailure = AssertFailureFromTlsL ();
CleanupStack::PushL(assertFailure);
TBuf16 <0x80> convertBuf;
TBuf16 <256> temporaryBuf;
convertBuf.Copy(assertFailure->What());
temporaryBuf.Append(convertBuf);
temporaryBuf.AppendFormat(_L(" at Line %i of "), assertFailure->LineNumber());
convertBuf.Copy(assertFailure->FileName());
if (convertBuf.Length() + temporaryBuf.Length() >= 0x80)
{
TBuf <0x80> printBuf;
printBuf = convertBuf.Right(0x80 - temporaryBuf.Length() - 1 -3 );
convertBuf = _L("...");
convertBuf.Append(printBuf);
}
temporaryBuf.Append(convertBuf);
aResult.iResultDes = temporaryBuf;
CleanupStack::PopAndDestroy(assertFailure);
}
}
示例3: EscapeEncodeDecodeL
//Encode and Decode the Uri
void CExampleInetProtUtil::EscapeEncodeDecodeL()
{
//Take an eg file to encode it and then decode it....
_LIT(KFullUriName,"K:\\ws\\direct\\direct.mmp");
TBuf<40> desFullUriName(KFullUriName);
//UTF-8 defines a mapping from sequences of octets to sequences of chars
HBufC8* convert = EscapeUtils::ConvertFromUnicodeToUtf8L(desFullUriName);
//Encode the eg Uri and display it
_LIT(KTextEncode, "\n\n\nThe Encoded Uri is....\n");
iConsole->Printf ( KTextEncode );
HBufC16* encode = EscapeUtils::EscapeEncodeL(desFullUriName,EscapeUtils::EEscapeNormal);
TPtr uriEncoded = encode->Des();
TBuf16<100> desEncodedUri;
desEncodedUri.Copy (uriEncoded);
iConsole->Printf ( _L("%S"), &desEncodedUri );
//Decode the eg Uri and display it
_LIT(KTextDecode, "\nThe Decoded Uri is....\n");
iConsole->Printf ( KTextDecode );
HBufC16* decode = EscapeUtils::EscapeDecodeL(desFullUriName);
TPtr uriDecoded = decode->Des();
TBuf16<100> desDecodedUri;
desDecodedUri.Copy (uriDecoded);
iConsole->Printf ( _L("%S"), &desDecodedUri );
delete decode;
delete encode;
delete convert;
iConsole->Getch();
iConsole->Printf ( KLeaveALine );
}
示例4: CreateUriL
//Create an URI
void CExampleInetProtUtil::CreateUriL()
{
//Set the physical path of the file
_LIT(KText1, "\n\n\nThe Physical location of the file is....");
iConsole->Printf ( KText1 );
_LIT(KFullUriName, "K:\\ws\\direct\\direct.mmp");
//display it
TBuf<40> desFullUriName(KFullUriName);
iConsole->Printf ( KLeaveALine );
iConsole->Printf ( KFullUriName );
//create the Uri for the path
CUri8* uri8 = CUri8::CreateFileUriL(desFullUriName);
const TDesC8& desUriDisplay = uri8->Uri().UriDes();
TBuf16<100> desCreateUri;
desCreateUri.Copy (desUriDisplay);
//display it
_LIT(KText2, "And its Uri is....");
iConsole->Printf ( KLeaveALine );
iConsole->Printf ( KText2 );
iConsole->Printf ( KLeaveALine );
iConsole->Printf ( desCreateUri );
delete uri8;
iConsole->Getch ();
}
示例5: roadmap_internet_open_browser
void roadmap_internet_open_browser (char *url) {
RApaLsSession apaLsSession;
const TUid KOSSBrowserUidValue = {0x10008D39}; // 0x1020724D for S60 3rd Ed
TUid id(KOSSBrowserUidValue);
TApaTaskList taskList(CEikonEnv::Static()->WsSession());
TApaTask task = taskList.FindApp(id);
if(task.Exists())
{
task.BringToForeground();
task.SendMessage(TUid::Uid(0), TPtrC8((TUint8 *)url,strlen(url))); // UID not used
}
else
{
if(!apaLsSession.Handle())
{
User::LeaveIfError(apaLsSession.Connect());
}
TThreadId thread;
TBuf16<128> buf;
buf.Copy(TPtrC8((TUint8 *)url,strlen(url)));
User::LeaveIfError(apaLsSession.StartDocument(buf, KOSSBrowserUidValue, thread));
apaLsSession.Close();
}
}
示例6: ParseUriTestsDeprecated
void ParseUriTestsDeprecated()
{
test.Next(_L("Parsing 16 bit URIs (deprecated)"));
gFullUri16.Copy(KUri0);
TUriParser16 parser16;
parser16.Parse(gFullUri16);
gUriComponent16.Copy(KScheme0);
TInt result = parser16.Extract(EUriScheme).Compare(gUriComponent16);
test(!result);
gUriComponent16.Copy(KUserInfo0);
result = parser16.Extract(EUriUserinfo).Compare(gUriComponent16);
test(!result);
gUriComponent16.Copy(KHost0);
result = parser16.Extract(EUriHost).Compare(gUriComponent16);
test(!result);
gUriComponent16.Copy(KPort0);
result = parser16.Extract(EUriPort).Compare(gUriComponent16);
test(!result);
gUriComponent16.Copy(KParams0);
result = parser16.Extract(EUriPath).Compare(gUriComponent16);
test(!result);
gUriComponent16.Copy(KHeaders0);
result = parser16.Extract(EUriQuery).Compare(gUriComponent16);
test(!result);
}
示例7: GenarateUriTestsL
void GenarateUriTestsL()
{
test.Next(_L("@SYMTestCaseID IWS-APPPROTOCOLS-INETURILIST-TESTUTILS-0002 Generating 8 bit URIs"));
CUri8* uri8 = CUri8::NewLC();
uri8->SetComponentL(KScheme0, EUriScheme);
uri8->SetComponentL(KHost0, EUriHost);
uri8->SetComponentL(KUserInfo0, EUriUserinfo);
uri8->SetComponentL(KPort0, EUriPort);
uri8->SetComponentL(KParams0, EUriPath);
uri8->SetComponentL(KHeaders0, EUriQuery);
const TDesC8& des8 = uri8->Uri().UriDes();
TInt result = des8.Compare(KUri0);
test(!result);
CleanupStack::PopAndDestroy(uri8);
test.Next(_L("Generating 16 bit URIs"));
CUri16* uri16 = CUri16::NewLC();
gUriComponent16.Copy(KScheme0);
uri16->SetComponentL(gUriComponent16, EUriScheme);
gUriComponent16.Copy(KHost0);
uri16->SetComponentL(gUriComponent16, EUriHost);
gUriComponent16.Copy(KUserInfo0);
uri16->SetComponentL(gUriComponent16, EUriUserinfo);
gUriComponent16.Copy(KPort0);
uri16->SetComponentL(gUriComponent16, EUriPort);
gUriComponent16.Copy(KParams0);
uri16->SetComponentL(gUriComponent16, EUriPath);
gUriComponent16.Copy(KHeaders0);
uri16->SetComponentL(gUriComponent16, EUriQuery);
const TDesC16& des16 = uri16->Uri().UriDes();
gFullUri16.Copy(KUri0);
result = des16.Compare(gFullUri16);
test(!result);
CleanupStack::PopAndDestroy(uri16);
}
示例8: EquivalenceTest
void EquivalenceTest(const TDesC8& aLhs, const TDesC8& aRhs, TInt aExpected)
{
TUriParser8 lhs8;
lhs8.Parse(aLhs);
TUriParser8 rhs8;
rhs8.Parse(aRhs);
TInt result = lhs8.Equivalent(rhs8);
test(result == aExpected);
TUriParser16 lhs16;
gFullUri16.Copy(aLhs);
lhs16.Parse(gFullUri16);
TUriParser16 rhs16;
gFullUriRhs16.Copy(aRhs);
rhs16.Parse(gFullUriRhs16);
result = lhs16.Equivalent(rhs16);
test(result == aExpected);
}
示例9: Draw
void CTextWindow::Draw()
//This function is virtual and so cannot have an 'L' at the end of it's name
{
iGc->Clear();
ResetPrintLine();
switch(iDrawMode)
{
case EDrawModeWordJust:
User::LeaveIfError(Client()->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)iTmpFont, TFontSpec(KTestFontTypefaceName,200)));
iGc->UseFont(iTmpFont);
DrawWordJustified(_L("Hello World"));
DrawWordJustified(_L("One Two Three Four Five Six Seven"));
DrawWordJustified(_L("AA B CC D"));
DrawWordJustified(_L("ONEWORD"));
iGc->DiscardFont();
Client()->iScreen->ReleaseFont(iTmpFont);
iTmpFont=NULL;
break;
case EDrawModeCharJust:
User::LeaveIfError(Client()->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)iTmpFont, TFontSpec(KTestFontTypefaceName,200)));
iGc->UseFont(iTmpFont);
DrawCharJustified(_L("Hello World"));
DrawCharJustified(_L("One Two Three Four Five Six Seven"));
DrawCharJustified(_L("AA B CC D"));
DrawCharJustified(_L("ONEWORD"));
iGc->DiscardFont();
Client()->iScreen->ReleaseFont(iTmpFont);
iTmpFont=NULL;
break;
case EDrawModeFonts:
{
TTypefaceSupport typefaceSupport;
Client()->iScreen->TypefaceSupport(typefaceSupport,iTypeFaceIndex);
TBuf<0x40> title;
TBuf16<KMaxTypefaceNameLength> tmpBuf;
tmpBuf.Copy(typefaceSupport.iTypeface.iName);
title.Append(tmpBuf);
title.AppendFormat(TRefByValue<const TDesC>(_L(", Heights (Min=%d, Max=%d, Num=%d)")),typefaceSupport.iMinHeightInTwips,typefaceSupport.iMaxHeightInTwips,typefaceSupport.iNumHeights);
PrintLine(iFont,title);
PrintDivider();
for (TInt tfHeight=0;tfHeight<typefaceSupport.iNumHeights;tfHeight++)
{
TFontSpec fspec(typefaceSupport.iTypeface.iName,Client()->iScreen->FontHeightInTwips(iTypeFaceIndex,tfHeight));
PrintStylesL(_L("Normal, "), fspec, TFontStyle());
PrintStylesL(_L("Bold, "), fspec, TFontStyle(EPostureUpright,EStrokeWeightBold,EPrintPosNormal));
PrintStylesL(_L("Italic, "), fspec, TFontStyle(EPostureItalic,EStrokeWeightNormal,EPrintPosNormal));
PrintStylesL(_L("Bold/italic, "), fspec, TFontStyle(EPostureItalic,EStrokeWeightBold,EPrintPosNormal));
if (iYpos>Size().iHeight)
break;
}
}
break;
}
}
示例10: ValidateUriComponentsL
//Validate URI components
void CExampleInetProtUtil::ValidateUriComponentsL()
{
TUriParser8 parser1;
CUri8* aUri = CUri8::NewL(parser1);
_LIT(KTextf, "\n\n\nValidating the Uri....\n");
iConsole->Printf ( KTextf );
// Adding components to the Uri
//Adding Scheme
_LIT8(KScheme, "http");
aUri->SetComponentL(KScheme,EUriScheme);
//Adding Host
_LIT8(KHost, "waterlang.org");
aUri->SetComponentL(KHost,EUriHost);
//Adding Port
_LIT8(KPort, "90");
aUri->SetComponentL(KPort,EUriPort);
//Adding Path
_LIT8(KPath, "/turic8class.html");
aUri->SetComponentL(KPath,EUriPath);
//Adding Query
_LIT8(KQuery, "bar=2&x=3");
aUri->SetComponentL(KQuery,EUriQuery);
//Adding Fragment
_LIT8(KFragment, "fragment");
aUri->SetComponentL(KFragment,EUriFragment);
//Display the constructed Uri
const TDesC8& desUriDisplays =aUri->Uri().UriDes();
TBuf16<100> desValidate;
desValidate.Copy (desUriDisplays);
iConsole->Printf ( desValidate );
// Validate() is not supported for HTTP, but only SIP and SIPS.
//The Parse() function itself validates the components and returns the
//appropriate result.
TInt res = parser1.Parse(desUriDisplays);
if (res==KErrNone)
{
_LIT(KText8, "\nThis Uri is VALID");
iConsole->Printf ( KText8 );
}
delete aUri;
iConsole->Getch();
}
示例11: ValidateTest
void ValidateTest(const TDesC8& aUri, TInt aErrorToAssert)
{
TUriParser8 parser8;
TUriParser16 parser16;
parser8.Parse(aUri);
TInt result = parser8.Validate();
test(result == aErrorToAssert);
gFullUri16.Copy(aUri);
parser16.Parse(gFullUri16);
result = parser16.Validate();
test(result == aErrorToAssert);
}
示例12: RetrieveFileNameL
//Extract URI components
void CExampleInetProtUtil::RetrieveFileNameL()
{
_LIT(KTextRet, "\n\n\nRetrieving filename from....\n");
iConsole->Printf ( KTextRet );
//Create a Uri
_LIT(KUriRetName, "K:\\ws\\direct\\direct.mmp");
TBuf<40> desUriRetName(KUriRetName);
CUri8* uriRetName = CUri8::CreateFileUriL(desUriRetName);
//Display the Uri
const TDesC8& uriDisp = uriRetName->Uri().UriDes();
TBuf16<100> desRetrieve;
desRetrieve.Copy (uriDisp);
iConsole->Printf ( desRetrieve );
//Parse the Uri
TUriParser8* uriComp = new(ELeave) TUriParser8();
uriComp->Parse(uriDisp);
//Get or Extract the Filename from the Uri
_LIT(KTextGetFilename, "\nGetting the filename....\n");
iConsole->Printf ( KTextGetFilename );
HBufC* fileName = uriComp->GetFileNameL();
TPtr uriFileNameDisplay = fileName->Des();
TBuf16<100> desFileName;
desFileName.Copy (uriFileNameDisplay);
iConsole->Printf ( desFileName );
delete fileName;
delete uriComp;
delete uriRetName;
iConsole->Getch();
}
示例13: ExtractUriComponentsL
//Extract URI components
void CExampleInetProtUtil::ExtractUriComponentsL()
{
_LIT(KTextExtract, "\n\n\nExtracting from....\n");
iConsole->Printf ( KTextExtract );
//Create a Uri
_LIT(KUriName, "K:\\ws\\direct\\direct.mmp");
TBuf<40> desUriName(KUriName);
CUri8* uriName = CUri8::CreateFileUriL(desUriName);
//Display the Uri
const TDesC8& uriDisplay = uriName->Uri().UriDes();
TBuf16<100> desExtract;
desExtract.Copy (uriDisplay);
iConsole->Printf ( desExtract );
//Parse the Uri
TUriParser8* uriComponent = new(ELeave) TUriParser8();
uriComponent->Parse(uriDisplay);
//Extract the Scheme component from this Uri
const TDesC8& host = uriComponent->Extract(EUriScheme);
TBuf16<100> desEx;
desEx.Copy (host);
//Display the Component extracted
_LIT(KTextEx, "\nThe extracted Scheme component is....\n");
iConsole->Printf ( KTextEx );
iConsole->Printf ( desEx );
//delete fileName;
delete uriComponent;
delete uriName;
iConsole->Getch();
}
示例14: ptr
void CDebugLogPrint::WriteToLog8L(const TDesC8 &aDes, const TDesC8 &aDes2)
{
TBuf16<256> buf;
TInt pos=aDes.LocateReverse(' ');
if (pos<0)
pos=0;
buf.Copy(aDes.Mid(pos));
buf.Append(' ');
TInt bufLen=buf.Length();
TPtr16 ptr(&buf[bufLen],buf.MaxLength()-bufLen);
ptr.Copy(aDes2);
buf.SetLength(bufLen+aDes2.Length());
_LIT(KDebugFormatString, "%S");
RDebug::Print(KDebugFormatString, &buf);
}
示例15: ReleaseDisk
// -----------------------------------------------------------------------------
// CSdDisk::ReleaseFiles
// This method deletes files created for filling the drive C
//
// -----------------------------------------------------------------------------
void CSdDisk::ReleaseDisk(RFs& aFs)
{
// RDebug::Print(_L("Shareddatatest ## ReleaseDisk"));
TInt i = 0;
TInt err = KErrNone;
do
{
TBuf16<35> str;
str.Copy(KFileName);
str.AppendNum(i,EDecimal);
err = aFs.Delete (str) ;
i++;
}
while ( err == KErrNone );
}