本文整理汇总了C++中TFileName::ZeroTerminate方法的典型用法代码示例。如果您正苦于以下问题:C++ TFileName::ZeroTerminate方法的具体用法?C++ TFileName::ZeroTerminate怎么用?C++ TFileName::ZeroTerminate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFileName
的用法示例。
在下文中一共展示了TFileName::ZeroTerminate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: symbian_fopen
/*============================================================================
Description: See documentation for standard C library fopen
==========================================================================*/
ChEXPORT SYMBIAN_FILE* symbian_fopen( const char* in_name, const char* in_mode)
{
ChUINT4 i = 0;
TFileName* pName = ChNEW TFileName;
CleanupStack::PushL(pName);
TFileName* pMode = ChNEW TFileName;
CleanupStack::PushL(pMode);
SYMBIAN_FILE* result = NULL;
for (i = 0; i < strlen(in_name); i++)
{
pName->Append(in_name[i]);
}
pName->ZeroTerminate();
for (i = 0; i < strlen(in_mode); i++)
{
pMode->Append(in_mode[i]);
}
pMode->ZeroTerminate();
result = symbian_wfopen((wchar_t*)pName->Ptr(), (wchar_t*)pMode->Ptr());
CleanupStack::PopAndDestroy(pMode);
CleanupStack::PopAndDestroy(pName);
return result;
}
示例2: TestInfoL
void CBCTestPtiEngine::TestInfoL()
{
TBuf<16> msg;
msg.Format(_L("num of lan: %d"), iEngine->NumberOfLanguages());
msg.ZeroTerminate();
AssertTrueL(iEngine->NumberOfLanguages()>0, msg);
if (iEngine->InputMode() == EPtiEngineMultitapping)
{
AssertTrueL(ETrue, _L("input mode is Multitapping"));
}
else
{
AssertTrueL(ETrue, _L("input mode is Predictive"));
}
// localized language name
TFileName localName;
iEngine->GetLocalizedLanguageName(31, localName); //31 is chinese?
localName.ZeroTerminate();
AssertTrueL(ETrue, localName);
//observer
MPtiObserver* obs = iEngine->Observer();
AssertTrueL(ETrue, _L("observer got"));
iEngine->SetObserver(obs);
AssertTrueL(ETrue, _L("observer set"));
}
示例3: CreateFolder
void CFileEngine::CreateFolder(const TDesC& aPath)
{
if (aPath.Length() > 0)
{
TFileName newFolderPath;
newFolderPath.Append( *iParentFolderName );
newFolderPath.Append(aPath);
newFolderPath.Append( _L("\\") );
newFolderPath.ZeroTerminate();
RFs& fs = CEikonEnv::Static()->FsSession();
TInt aError = fs.MkDir( newFolderPath );
if ( KErrNone == aError )
{
if(iObserver)
{
iObserver->Update(0);
}
}
else //创建失败
{
iControlFactory.CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_CreateFolderFailed),*this,ECmdNull);
}
delete iParentFolderName;
iParentFolderName = NULL;
}
else
{
iControlFactory.CreateInputTextDialog(*this,iMainEngine.GetDesById(ETurkeyTextRes_InputFolderName),iMainEngine.GetDesById(ETurkeyTextRes_InputNull),ECmdCreateFolder);
}
}
示例4: TestSpellL
void CBCTestPtiEngine::TestSpellL()
{
TBuf<8> spell;
TInt err=iEngine->GetSpelling(0x7684, spell, EPtiPinyin);
if(err==KErrNotSupported)
{
AssertTrueL(ETrue, _L("get spelling not support"));
}
else if(err==KErrNone)
{
spell.ZeroTerminate();
AssertTrueL(ETrue, spell);
}
else
{
AssertTrueL(ETrue, _L("get spelling failuer"));
}
//phonetic
iEngine->ClearCurrentWord();
SimuInput(iEngine, _L("wei"));
TInt number = iEngine->PhoneticSpellingCount();
TFileName msg;
msg.Format(_L("phonetic spelling count: %d"), number);
msg.ZeroTerminate();
AssertTrueL(ETrue, msg);
spell=iEngine->GetPhoneticSpelling(0);
AssertTrueL(ETrue, _L("get phonetic spelling for 0"));
TBool result = iEngine->SelectPhoneticSpelling(0);
AssertTrueL(ETrue, _L("select phonetic spelling for 0"));
number = iEngine->SelectedPhoneticSpelling();
msg.Format(_L("selected phonetic spelling: %d"), number);
msg.ZeroTerminate();
AssertTrueL(ETrue, msg);
CDesCArray* array = new (ELeave) CDesCArrayFlat(16);
CleanupStack::PushL(array);
iEngine->GetPhoneticSpellingsL(*array);
AssertTrueL(ETrue, _L("phonetic spellings got"));
CleanupStack::PopAndDestroy(); //array
}
示例5: OpenFileL
// -----------------------------------------------------------------------------
// CMccFileSourceImpl::OpenFileL(TFileName aFileName)
//
// Opens a 3gp file for streaming and reads media descriptions into
// member variables
// -----------------------------------------------------------------------------
//
void CMccFileSourceImpl::OpenFileL( TFileName aFileName, TBool aFileChangeMode )
{
__FILESOURCE_CONTROLL( "CMccFileSourceImpl::OpenFileL" )
TCurrentState oldState = iCurrentState;
// Close old file (if exists)
CloseFileL( aFileChangeMode );
aFileName.ZeroTerminate();
TRAPD( err, OpenFileForStreamingL( aFileName ) );
if ( err )
{
if ( aFileChangeMode )
{
// Have to stop timers etc, since old file was closed
// and the new file is unusable
DoCleanupL( EFalse );
}
User::Leave( err );
}
this->SetFileName( aFileName );
if ( oldState == EPlaying )
{
// Continue playing with new file
iCurrentState = EPrimed;
SourcePlayL( ETrue, aFileChangeMode );
}
else
{
// Keep old state
iCurrentState = oldState;
}
__FILESOURCE_CONTROLL( "CMccFileSourceImpl::OpenFile, exit" )
}
示例6: TestChineseInputL
void CBCTestPtiEngine::TestChineseInputL()
{
TeardownL();
if((iEngine = CreateEngineL(ELangPrcChinese, EPtiEngineStroke))!=NULL)
{
AssertNotNullL(iEngine, _L("Chinese Pinyin activated"));
SimuInput(iEngine, _L("wei"));
int page=0;
iEngine->SetCandidatePageLength(20);
AssertTrueL(ETrue, _L("page length set to 20"));
for(TPtrC str=iEngine->CandidatePage();
iEngine->MoreCandidatePages();
iEngine->NextCandidatePage())
{
TFileName res;
res.Format(_L("page[%d]: "), page++);
for(int j=0; j<str.Length(); ++j)
{
res.Append(_L("<"));
res.AppendNumUC(str[j], EHex);
res.Append(_L(">"));
}
res.ZeroTerminate();
AssertTrueL(ETrue, res);
if(page>10)
{
break;
}
}//end of for
//predict
iEngine->PreviousCandidatePage();
TPtrC aChar=iEngine->CandidatePage();
iEngine->SetPredictiveChineseChar(aChar);
AssertTrueL(ETrue, _L("next chinese char predicted"));
//test next candidate list
iEngine->CommitCurrentWord();
CDesCArray* cands = new (ELeave) CDesCArrayFlat(16);
CleanupStack::PushL(cands);
TRAPD(err, iEngine->GetNextWordCandidateListL(*cands));
if(err == KErrNotSupported)
{
AssertTrueL(ETrue, _L("predict next candidate not supported"));
}
else{
TFileName msg=_L("candidates: ");
for (int i = 0; i < cands->Count(); ++i)
{
msg.Append(cands->MdcaPoint(i));
msg.Append(_L(", "));
}
msg.ZeroTerminate();
AssertTrueL(ETrue, msg);
}
CleanupStack::PopAndDestroy(); // cands
//test conversion
TInt convCap=iEngine->AvailableCharConversions();
if((convCap & EPtiSimplifiedToComplex)!=0)
{
AssertTrueL(ETrue, _L("can convert from simplified chinese to traditional"));
}
else
{
AssertIntL(0, convCap, _L("conv capability:"));
}
char inbuf[]={0x76, 0x84};
char outbuf[]={0,0};
iEngine->CharConversion(EPtiSimplifiedToComplex, inbuf, 2, outbuf);
AssertTrueL(ETrue, _L("tried char conversion"));
//Chinese Varient
RArray<TInt> modes;
iEngine->GetModeNameIndexL(EPtiChineseVariantPrc, modes);
AssertTrueL(ETrue, _L("Chinese varient index table got"));
modes.Close();
//phrase list
iEngine->ClearCurrentWord();
SimuInput(iEngine, _L("wei"));
cands = new (ELeave) CDesCArrayFlat(16);
CleanupStack::PushL(cands);
iEngine->GetChinesePhraseCandidatesL(*cands);
AssertTrueL(ETrue, _L("Chinese phrase candidate list got"));
CleanupStack::PopAndDestroy(); //cands
TestSpellL();
TestDictL();// test Pinyin dict.
}
else
{
AssertTrueL(ETrue, _L("unable to activate Chinese Pinyin"));
if ( iEngine == NULL )
{
SetupL();
//.........这里部分代码省略.........
示例7: TestDictL
void CBCTestPtiEngine::TestDictL()
{
CDesCArrayFlat* words = new (ELeave) CDesCArrayFlat(5);
CleanupStack::PushL( words );
words->AppendL(_L("lorem"));
words->AppendL(_L("ipsum"));
words->AppendL(_L("dolor"));
words->AppendL(_L("sit"));
words->AppendL(_L("amet"));
TBuf<50> filename(_L("C:\\BCTestLog\\TestUserDict.txt"));
AssertIntL(KErrNotSupported,
iEngine->CreateUserDictionaryL(filename, words, EPtiEngineWordCompletion),
_L("user dict created isn't supported"));
CleanupStack::PopAndDestroy(); //words
TInt err;
//attach
MPtiUserDictionary* dict = iEngine->AttachUserDictionaryL(filename);
if(dict)
{
AssertTrueL(ETrue, _L("user dict attached"));
}
else
{
AssertTrueL(ETrue, _L("user dict attached failure"));
}
//detach
if(iEngine->DetachUserDictionary(filename) == KErrNone)
{
AssertTrueL(ETrue, _L("user dict detach"));
}
else
{
AssertTrueL(ETrue, _L("User dict detach failure"));
}
if(iEngine->DetachUserDictionary(0) == KErrNone)
{
AssertTrueL(ETrue, _L("user dict detach by ID"));
}
else
{
AssertTrueL(ETrue, _L("User dict detach by ID failure"));
}
//entry
TFileName msg;
TPtiUserDictionaryEntry entry(_L("foobar"));
TInt number = iEngine->NumberOfEntriesInUserDictionary();
if(number == KErrNotSupported)
{
AssertTrueL(ETrue, _L("user dict doesn't support entry"));
}
else
{
msg.Format(_L("total %d entries"), number);
AssertTrueL(ETrue, msg);
}
err=iEngine->AddUserDictionaryEntry(entry);
msg.Format(_L("add entry returns: %d"), err);
msg.ZeroTerminate();
AssertTrueL(ETrue, msg);
err=iEngine->AddUserDictionaryEntry(entry, 0);
msg.Format(_L("add entry with ID 0 returns: %d"), err);
msg.ZeroTerminate();
AssertTrueL(ETrue, msg);
err=iEngine->RemoveEntryFromUserDictionary(entry);
msg.Format(_L("remove entry returns: %d"), err);
msg.ZeroTerminate();
AssertTrueL(ETrue, msg);
err=iEngine->RemoveEntryFromUserDictionary(entry, 0);
msg.Format(_L("remove entry with ID 0 returns: %d"), err);
msg.ZeroTerminate();
AssertTrueL(ETrue, msg);
err = iEngine->GetUserDictionaryEntry(0, entry);
msg.Format(_L("get first entry returns: %d"), err);
msg.ZeroTerminate();
AssertTrueL(ETrue, msg);
dict = iEngine->DefaultUserDictionary(EPtiEnginePinyin);
if(dict)
{
AssertNotNullL(dict, _L("dict for Pinyin found"));
}
else
{
AssertTrueL(ETrue, _L("dict for Pinyin not found"));
}
}
示例8: OpenFileByDefault
void CFileExecuter::OpenFileByDefault(TFileName aFileName)
{
if (::FileIsExist(aFileName)==1)
{
iFileName.Zero ();
iFileName.Append(aFileName);
TInt i = aFileName.LocateReverseF('.');
if(i<0)
{
iMainEngine.ControlFactory().CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_FileTypeNotSupport),*this,0);
return;
}
TFileName nFileExt = aFileName.Right( aFileName.Length() - i - 1 );
nFileExt.ZeroTerminate();
iMainEngine.WriteLog16(nFileExt);
TFileName nAssociatedApp;
TBool nIsFindApp = GetAssociatedApp( nFileExt, nAssociatedApp );
if ( nIsFindApp == true)
{
if (nAssociatedApp.Find(KDefaultAppPath)!=KErrNotFound)
{
OpenFileBySystemDefaultL(aFileName);
}
else if ( nAssociatedApp.FindF( KCoCoAppPath )!=KErrNotFound)
{
//使用内部模块打开
OpenFileByInternal(aFileName);
}
else
{
OpenFileByApp(nAssociatedApp,aFileName);
}
}
else
{
//如果没有默认的打开方式
TInt nType=ParseExPathNum(aFileName);
#ifdef __SERIES60_3X__
if(nType==0 || nType==1 || nType==2 || nType==3)
#else
if(nType==0 || nType==1 || nType==2 || nType==3 || nType==4)
#endif
{
//使用内部模块打开
OpenFileByInternal(aFileName);
}
else
{
//采用系统默认方式打开
OpenFileBySystemDefaultL(aFileName);
}
}
}
else
{
//提示用户文件不存在
iMainEngine.ControlFactory().CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_FileNotExist),*this,0);
}
}