本文整理汇总了C++中TChar函数的典型用法代码示例。如果您正苦于以下问题:C++ TChar函数的具体用法?C++ TChar怎么用?C++ TChar使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TChar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IgnoreSpaces
void CVBookmarkConverter::IgnoreSpaces( TPtrC8& aData )
{
TInt last = aData.Length() - 1;
TInt begin;
for ( begin = 0; begin <= last; begin++ )
{
if ( !TChar( aData[begin] ).IsSpace() )
{
break;
}
}
TInt end;
for ( end = last; end >= 0; end-- )
{
if ( !TChar( aData[end] ).IsSpace() )
{
break;
}
}
TInt length = end - begin + 1;
if ( ( begin != 0 || end != last ) && length > 0 )
{
TPtrC8 newData = aData.Mid( begin, length );
aData.Set( newData );
}
}
示例2: while
void CWordTest::ToggleCaseL(CEikRichTextEditor* aEditor)
{
TCursorSelection sel = aEditor->Selection();
int start = sel.LowerPos();
int end = start;
TBool to_upper = TRUE;
while (end < sel.HigherPos())
{
TPtrC text;
TCharFormat f;
aEditor->RichText()->GetChars(text,f,start);
int length = text.Length();
if (start + length > sel.HigherPos())
length = sel.HigherPos() - start;
end = start + length;
if (start == sel.LowerPos() && end > start)
{
if (TChar(text[0]).IsUpper())
to_upper = FALSE;
}
TText* p = (TText*)text.Ptr();
TText* q = p + length;
while (p < q)
{
if (to_upper)
*p = (TText)(TChar(*p).GetUpperCase());
else
*p = (TText)(TChar(*p).GetLowerCase());
p++;
}
start = end;
}
aEditor->TextView()->HandleRangeFormatChangeL(sel);
}
示例3: KillProcess
//This function is used in the test code to kill ECOMSERVER
//processes (or some other) when they leftover and may problem in ECOMSERVERTEST
static TInt KillProcess(const TDesC& aProcessName)
{
TFullName name;
RDebug::Print(_L("Find and kill \"%S\" process.\n"), &aProcessName);
TBuf<64> pattern(aProcessName);
TInt length = pattern.Length();
pattern += _L("*");
TFindProcess procFinder(pattern);
while(procFinder.Next(name) == KErrNone)
{
if(name.Length() > length)
{
//If found name is a string containing aProcessName string.
TChar c(name[length]);
if(c.IsAlphaDigit() || c == TChar('_') || c == TChar('-'))
{
//If the found name is other valid application name starting with aProcessName string.
RDebug::Print(_L(":: Process name: \"%S\".\n"), &name);
continue;
}
}
RProcess proc;
if(proc.Open(name) == KErrNone)
{
proc.Kill(0);
RDebug::Print(_L("\"%S\" process killed.\n"), &name);
}
proc.Close();
}
return KErrNone;
}
示例4: line
void CAreaSearchResult::ConstructL(const TDesC& aDes)
{
TLex line(aDes);
line.Mark();
TInt redefined=0;
if (line.Peek() != '#' && line.Peek() != '\t')
{
TInt index=0;
while (line.Peek() != '\n' && !(line.Peek()).Eos())
{
line.Inc();
if (line.Peek() == '\t')
{
TPtrC token = line.MarkedToken();
TLex val(token);
switch(index)
{
case ESouthLat:
val.Val(iSouthLat, TChar(','));
break;
case ENorthLat:
val.Val(iNorthLat, TChar(','));
break;
case EWestLong:
val.Val(iWestLong, TChar(','));
break;
case EEastLong:
val.Val(iEastLong, TChar(','));
break;
case EErrorCode:
val.Val(iErrorCode);
break;
case ESearchResult:
ParseSearchResult(token);
break;
case ERedefined:
val.Val(redefined);
if (redefined == 1)
{
iRedefined = ETrue;
}
break;
}
line.Inc();
while (line.Peek() == '\t') // Empty value
{
line.Inc();
++index;
}
line.Mark();
++index;
}
}
}
}
示例5: _LIT
void CSqlCmdAttach::OptionsL(RCommandOptionList& aOptions)
{
_LIT(KOptFile, "file");
_LIT(KOptFileDescription, "Specify additional database file.");
aOptions.AppendStringL(iOptFileName, TChar('f'), KOptFile, KOptFileDescription);
_LIT(KOptDB, "name");
_LIT(KOptDBDescription, "Specify additional database name.");
aOptions.AppendStringL(iOptDBName, TChar('n'), KOptDB, KOptDBDescription);
}
示例6: Externalize
TInt TEnvVar::Externalize(TDes16& aBuffer)
{
if (iName==0)
return 0;
aBuffer.Append(*iName);
aBuffer.Append(TChar(0));
aBuffer.Append(*iValue);
aBuffer.Append(TChar(0));
return 1;
}
示例7: IsProcessRunning
TBool IsProcessRunning(const TDesC& aProcessName)
{
TFullName name;
TBool IsProcessRunning(EFalse);
TBuf<64> pattern(aProcessName);
TInt length = pattern.Length();
pattern += _L("*");
TFindProcess procFinder(pattern);
while(procFinder.Next(name) == KErrNone)
{
if(name.Length() > length)
{//If found name is a string containing aProcessName string.
TChar c(name[length]);
if(c.IsAlphaDigit() || c == TChar('_') || c == TChar('-'))
{//If the found name is other valid application name starting with aProcessName string.
RDebug::Print(_L(":: Process name: \"%S\".\n"), &name);
continue;
}
}
RProcess proc;
if(proc.Open(name) == KErrNone)
{
if (EExitKill == proc.ExitType())
{
RDebug::Print(_L("\"%S\" process killed.\n"), &name);
proc.Close();
IsProcessRunning = EFalse;
}
else
{
IsProcessRunning = ETrue;
RDebug::Print(_L("\"%S\" process is running.\n"), &name);
}
if(IsProcessRunning)
{
RDebug::Print(_L("Waiting additional time...\n"), &name);
User::After(1000000);
if (EExitKill == proc.ExitType())
{
RDebug::Print(_L("\"%S\" process now killed.\n"), &name);
IsProcessRunning = EFalse;
}
proc.Close();
}
}
}
return IsProcessRunning;
}
示例8: epoc_gcvt
void epoc_gcvt( double x, int digits, unsigned char *buf) {
TRealFormat trel;
trel.iPlaces = digits;
trel.iPoint = TChar( '.');
TPtr result( buf, 80);
result.Num( x, trel);
result.Append( TChar( 0));
}
示例9: IsAdaptiveFindMatchClassic
inline TBool IsAdaptiveFindMatchClassic( const TDesC& aItemString, const TDesC& aSearchText )
{
TPtrC itemptr = aItemString;
TPtrC searchptr = aSearchText;
TBool match = EFalse;
for(;;)
{
// Loop invariant: itemptr is next character from ' ' or '-'
// Loop invariant: seachptr is at beginning of searched item
TInt val = MyFindC(itemptr,searchptr);
if (val == 0)
{
match = ETrue;
break;
}
if (val != KErrNotFound && IsFindWordSeparator(itemptr[val-1]))
{
match = ETrue;
break;
}
// find the word separator characters from list item
TInt spacepos = itemptr.LocateF(TChar(' '));
TInt minuspos = itemptr.LocateF(TChar('-'));
TInt tabpos = itemptr.LocateF(TChar('\t'));
if (spacepos != KErrNotFound)
{
itemptr.Set(itemptr.Mid(spacepos+1));
}
else if (minuspos != KErrNotFound)
{
itemptr.Set(itemptr.Mid(minuspos+1));
}
else if (tabpos != KErrNotFound)
{
itemptr.Set(itemptr.Mid(tabpos+1));
}
else
{
match = EFalse;
break;
}
if (itemptr.Length() == 0)
{
match = EFalse;
break;
}
}
return match;
}
示例10: epoc_atof
/* Workaround for defect atof(), see java defect list for epoc */
double epoc_atof( char* str) {
TReal64 aRes;
while (TChar( *str).IsSpace()) {
str++;
}
TLex lex( _L( str));
TInt err = lex.Val( aRes, TChar( '.'));
return aRes;
}
示例11: OstTraceFunctionEntry0
/*!
*/
void SettingsUtility::setDateSeparator(const QString &separator)
{
OstTraceFunctionEntry0( SETTINGSUTILITY_SETDATESEPARATOR_ENTRY );
TLocale locale;
locale.SetDateSeparator(
TChar(separator.unicode()->unicode()), 1);
locale.SetDateSeparator(
TChar(separator.unicode()->unicode()), 2);
locale.Set();
OstTraceFunctionExit0( SETTINGSUTILITY_SETDATESEPARATOR_EXIT );
}
示例12: DbTestL
/**
@SYMTestCaseID SYSLIB-DBMS-CT-0008
@SYMTestCaseDesc Database tests. Some of the calls must fail because the caller has no enough rights
for the requested operation.
@SYMTestPriority High
@SYMTestActions RDbNamedDatabase::Open()/RDbNamedDatabase::DatabaseNamesL()/RDbNamedDatabase::Create().
@SYMTestExpectedResults The test must not fail.
@SYMREQ REQ2429
DBMS shall provide an API to apply security policies to database tables.
*/
static void DbTestL()
{
TBuf<32> format;
TDBSCUtils::DeleteDatabase(TheDbs, KSecureDbUid, KDbName);
TheTest.Printf(_L("Create database\n"));
//The test must pass, because the test app has "SCHEMA" capability
format.Copy(KSecure);
format.Append(KSecureDbUid.Name());
TInt err = TheDb.Create(TheDbs, KDbName, format);
TEST2(err, KErrNone);
//The test must pass, because "DatabaseNamesL" is a DBMS operation available for everyone.
TheTest.Printf(_L("Database list\n"));
CDbDatabaseNames* dbNames = TheDbs.DatabaseNamesL(EDriveC, KSecureDbUid);
TEST(dbNames->Count() > 0);
TBool casePreserved = EFalse;
for(TInt i=0;i<dbNames->Count();++i)
{
const TDesC& dbName = (*dbNames)[i];
RDebug::Print(_L("--Database: %S\n"), &dbName);
TBuf<128> dbName2;
dbName2.Append(TChar('A' + EDriveC));
dbName2.Append(TChar(':'));
dbName2.Append(dbName);
if(dbName2 == KDbName())
{
casePreserved = ETrue;
}
}
//if casePreserved is non-zero that means the DBMS server does not change the database names to
//upper or lower case - that's what we want to check
TEST(casePreserved);
delete dbNames;
TheDb.Close();
TheTest.Printf(_L("An attempt to create database - existing, but protected UID\n"));
//The test must fail, because the test app does not have capabilities to satisfy
//KProtSecureDbUid "SCHEMA" policy.
format.Copy(KSecure);
format.Append(KProtSecureDbUid.Name());
err = TheDb.Create(TheDbs, KDbName, format);
TEST2(err, KErrPermissionDenied);
//The test must pass, because the test app has "SCHEMA" capability (it must have capabilities,
//satisfying at least one of the UID's R/W/S policies)
TheTest.Printf(_L("Open database\n"));
format.Copy(KSecure);
format.Append(KSecureDbUid.Name());
err = TheDb.Open(TheDbs, KDbName, format);
TEST2(err, KErrNone);
}
示例13: E32Main
GLDEF_C TInt E32Main()
{
test.Title();
TBuf<256> cmd;
TFullName fn;
User::CommandLine(cmd);
TLex lex(cmd);
TPtrC threadSpec(lex.NextToken());
TFindThread ft(threadSpec);
TExitType exitType=EExitKill;
TInt exitCode=0;
if (!lex.Eos())
{
TPtrC xtSpec(lex.NextToken());
TPtrC xc(xtSpec);
TChar xt0=xtSpec[0];
if (xt0.IsAlpha())
{
xt0.LowerCase();
if (xt0==TChar('t'))
exitType=EExitTerminate;
else if (xt0==TChar('p'))
exitType=EExitPanic;
new(&xc) TPtrC(lex.NextToken());
}
if (xc.Length())
{
TLex lex2(xc);
lex2.Val(exitCode);
}
}
while (ft.Next(fn)==KErrNone)
{
test.Printf(_L("Killing %S\n"),&fn);
RThread t;
TInt r=t.Open(ft);
if (r==KErrNone)
{
// FIXME: SHOULD REMOVE CRITICALNESS - WOULD NEED DEVICE DRIVER
switch (exitType)
{
case EExitKill: t.Kill(exitCode); break;
case EExitTerminate: t.Terminate(exitCode); break;
case EExitPanic: t.Panic(KPanicCat,exitCode); break;
default: break;
}
t.Close();
}
}
return 0;
}
示例14: RDEBUG
TInt CDMCertNotifier::GetCert( TCertInfo& aCertInfo )
{
RDEBUG("CDMUtilServer::GetCertFromCentRep");
#ifdef __TARM_SYMBIAN_CONVERGENCY
TPckg<TCertInfo> pcert( aCertInfo );
pcert.Fill( TChar( 0 ) );
return iCertificateProperty.Get( pcert );
#else
TPckg<TCertInfo> certp( aCertInfo );
certp.Fill( TChar( 0 ) );
return iRepository->Get( KSyncMLSessionCertificate, certp );
#endif
}
示例15: while
int WordBreakIteratorSymbian::previous() {
if (currentPos == 0) {
currentPos = -1;
return currentPos;
}
bool haveSpace = false;
while (currentPos > 0) {
if (haveSpace && !TChar(string[currentPos]).IsSpace())
break;
if (TChar(string[currentPos]).IsSpace())
haveSpace = true;
--currentPos;
}
return currentPos;
}