当前位置: 首页>>代码示例>>C++>>正文


C++ TLex类代码示例

本文整理汇总了C++中TLex的典型用法代码示例。如果您正苦于以下问题:C++ TLex类的具体用法?C++ TLex怎么用?C++ TLex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TLex类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test8

LOCAL_C void test8()
//
// Some tests for calc to check that a number entered is printed to same significance when
// returned
// do dtor and rtod test
//
	{

	TLex l;
	TBuf<0x100> buf;
	TInt ret;
	TReal64 num;

	for (TInt jj=0;jj<TInt(size_calctest/sizeof(CALC_TEST));jj++)
		{
		// string to real
		const CALC_TEST tst=calctest[jj];
		l=tst.iLex;
		test(l.Val(num)==KErrNone);
		
		// real to string
 		ret=buf.Num(num,tst.iFormat);
		if (ret!=KErrGeneral)
			{
			buf.ZeroTerminate();
			test(buf.Compare(TPtrC(tst.iRes))==0);
			}
		test(ret>=0);    
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:30,代码来源:t_float.cpp

示例2: test5

LOCAL_C void test5()
//
// Test string to real conversion with selected numbers
// added by AnnW, December 1996
//
	{
	
	TLex l;
	TReal64 r64;
	TInt jj;
	
	for (jj=0; jj<TInt(size_testd2/sizeof(DtoR_TEST64)); jj++)
		{
		const DtoR_TEST64* tst64=&testd2[jj];
		l=tst64->iLex;
		test(l.Val(r64)==KErrNone);
		test(tst64->iRes==r64);
		}
	
	TReal32 r32;

	for (jj=0; jj<TInt(size_testd32/sizeof(DtoR_TEST32)); jj++)
		{
		const DtoR_TEST32* tst32=&testd32[jj];
		l=tst32->iLex;
		test(l.Val(r32)==KErrNone);
		test(tst32->iRes==r32);
		}
	}	
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:29,代码来源:t_float.cpp

示例3: NextWord

TPtrC NextWord(TLex& aLex)
	{
	aLex.SkipSpaceAndMark();
	aLex.SkipCharacters();
	TPtrC word(aLex.MarkedToken());
	return word;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:7,代码来源:command_info_file.cpp

示例4: TRAPD

/**
 * Reads the value present from the test steps ini file within the mentioned section name and key name
 * Copies the value to the TInt reference passed in. The value can optionally be prefixed with 0x
 * @param aSectName - Section within the test steps ini file
 * @param aKeyName - Name of a key within a section
 * @return aResult - The integer value of the Hex input
 * @return TBool - ETrue for found, EFalse for not found 
 */	
TBool CDataWrapperBase::GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult)
	{
	TPtrC	result;
	TBool	ret=EFalse;
	TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result));
	if ( err != KErrNone )
		{
		ret=EFalse;
		}
	if ( ret )
		{
		TLex	lex;
		if( result.FindC(KPrefixHex)==KErrNone )
			{
			lex=result.Mid(KPrefixHex().Length());
			}
		else
			{
			lex=result;
			}
		ret=(lex.Val((TUint &)aResult, EHex)==KErrNone);
		}

	return ret;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:33,代码来源:DataWrapperBase.cpp

示例5:

void CTap2MenuAppUi::ReadExceptions()
	{
	TInt err=KErrNone;
	iExceptions.Reset();
	if (BaflUtils::FileExists(CEikonEnv::Static()->FsSession(),KExceptionsPath)) //!!!!!!!!!!!!!!!!!!!!!!!!!!!
		{
		TBuf<255> val;
		TLex conv;
		TUint32 IntVal;
		RFile filesave;
		TBuf<255> t;
		TFileText ft;
		filesave.Open(CEikonEnv::Static()->FsSession(), KExceptionsPath, EFileRead);
		ft.Set(filesave);
		while (ft.Read(val)==KErrNone)
			{
			conv.Assign(val);
			conv.Val(IntVal,EHex);
			iExceptions.AppendL(TUid::Uid(IntVal));
			}
		filesave.Close();
		}
	else
		{
		TParse parse;
		CEikonEnv::Static()->FsSession().Parse(KExceptionsPath,parse);
		if (!BaflUtils::FolderExists(CEikonEnv::Static()->FsSession(),parse.DriveAndPath()))
			{
			CEikonEnv::Static()->FsSession().MkDirAll(parse.DriveAndPath());
			}
		}
	}
开发者ID:kolayuk,项目名称:Tap2Menu,代码行数:32,代码来源:Tap2MenuAppUi.cpp

示例6: FetchFloatL

// -----------------------------------------------------------------------------
// CLandmarksEditDialog::FetchFloatL
// 
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CLandmarksEditDialog::FetchFloatL(
    TRealX& aFloat, 
    TInt aEditorResourceId, 
    TInt aErrorResourceId)
    {
    const TChar KDecimalPoint = '.';
    TBuf<KPosLmMaxTextFieldLength> textFieldValue;
    TLex fieldLex;
    TInt result(KErrNone);
    CEikEdwin* editor = static_cast <CEikEdwin*> (Control(aEditorResourceId));

    editor->GetText(textFieldValue);
    if (textFieldValue == KNullDesC)
        {
        // User has indicated that he/she wants this value to be undefined.
        aFloat.SetNaN();
        }
    else 
        {
        // Try to extract value
        fieldLex = textFieldValue;
        TReal floatValue(0);
        result = fieldLex.Val(floatValue, KDecimalPoint);
        if (result != KErrNone)
            {
            NotifyErrorToUserL(aErrorResourceId);
            }

        // Update output parameter
        User::LeaveIfError(aFloat.Set(floatValue));
        }
    }
开发者ID:fedor4ever,项目名称:packaging,代码行数:38,代码来源:LandmarksEditDialog.cpp

示例7: GetEnumValuesL

void GetEnumValuesL(TLex& aLex, RBuf& aValues, RBuf& aDescriptions)
	{
	aValues.CreateL(0x100);
	aDescriptions.CreateL(0x100);

	while (!aLex.Eos())
		{
		TLexMark mark;
		aLex.Mark(mark);
		TPtrC command(NextCommand(aLex));
		if (command == KCmndEnumValue)
			{
			TPtrC value(NextWord(aLex));
			TPtrC description(TextToNextCommand(aLex));
			if (value.Length() == 0)
				{
				User::Leave(KErrArgument);
				}
			AppendL(aValues, value, EFalse);
			if (description.Length() > 0)
				{
				AppendL(aDescriptions, description, ETrue);
				}
			}
		else
			{
			aLex.UnGetToMark(mark);
			break;
			}
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:31,代码来源:command_info_file.cpp

示例8: ConstructL

void CSettings::ConstructL()
{
    RFs fs;
    RFile file;
    TFileText text;
    TLex lex;
    TBuf<256> buf;
    User::LeaveIfError(fs.Connect());
    if(file.Open(fs,_L("C:\\System\\Apps\\vcall\\times"),EFileRead) != KErrNone)
    {
        User::Panic(_L("Config file not open"),KErrNotFound);
    }
    text.Set(file);
    while(text.Read(buf) == KErrNone)
    {
        lex.Assign(buf);
        TInt val;
        lex.Val(val);//TODO: error handling
        iTimes.Append(val);
    }
    file.Close();
    //iTimes.SortSigned();//TODO: fix sort
    iTimer = CVTimer::NewL();
    iTimer->setTimes(iTimes);
}
开发者ID:Seikareikou,项目名称:symbian,代码行数:25,代码来源:settings.cpp

示例9: SaveFormDataL

TBool CEmTubeVideoUploadDialog::OkToExitL(TInt aButtonId)
	{
	if (aButtonId == EAknSoftkeyDone)
		{
		SaveFormDataL();

	    if( iQueueEntry->Title().Length() == 0 )
	    	{
			HBufC* message = StringLoader::LoadLC( R_DIALOG_TITLE_AND_DESCRIPTION_NEEDED_TXT );
            CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
            informationNote->ExecuteLD( *message );                    
			CleanupStack::PopAndDestroy( message );
    	    return EFalse;    	    
		    }
		
	    if( iQueueEntry->Description().Length() == 0 )
	    	{
			HBufC* message = StringLoader::LoadLC( R_DIALOG_TITLE_AND_DESCRIPTION_NEEDED_TXT );
            CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
            informationNote->ExecuteLD( *message );                    
			CleanupStack::PopAndDestroy( message );
    	    return EFalse;    	    
		    }

		TBool res = ETrue;

	    if( iQueueEntry->Tags().Length() == 0 )
	        res = EFalse;
    
	    TLex lex = TLex( iQueueEntry->Tags() );            
	    TPtrC16 ptr( lex.NextToken() );
	    TInt tokenCount = 0;
    
	    while( ptr.Length() && (tokenCount < 2) )
    	    {
        	tokenCount++;
	        ptr.Set( lex.NextToken() );
    	    }

		if( tokenCount < 2 )
			res = EFalse;
		
		if( !res )
			{
			HBufC* message = StringLoader::LoadLC( R_DIALOG_TWO_TAGS_NEEDED_TXT );
            CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
            informationNote->ExecuteLD( *message );                    
			CleanupStack::PopAndDestroy( message );
    	    return EFalse;    	    
			}

  		return ETrue;
		}
	else
		{
		return CAknForm::OkToExitL(aButtonId);
		}
	}
开发者ID:Yelinson,项目名称:OpenVideoHub,代码行数:58,代码来源:emTubeVideoUploadDialog.cpp

示例10: SkipToNextCommand

TInt SkipToNextCommand(TLex& aLex)
	{
	if ((aLex.Offset() == 0) && (aLex.Remainder().Find(KPartialCommandStart) == 0))
		{
		return KErrNone;
		}

	return SkipTo(aLex, KCommandStart);
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:9,代码来源:command_info_file.cpp

示例11: EatF

TBool TfrLex::EatF( TLex& aLex, const TDesC& aTerm )
{
aLex.SkipSpace();
TLexMark unget;
aLex.Mark(unget);
if ( ValF(aLex,aTerm) == KErrNone ) return ETrue;
aLex.UnGetToMark(unget);
return EFalse;
} 
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:9,代码来源:TfrLex.cpp

示例12: CheckIPv4Address

// ----------------------------------------------------
// CheckIPv4Address()
// IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT
// ----------------------------------------------------
//
LOCAL_C TBool CheckIPv4Address( TLex& aLex )
    {
    return CheckIPv4AddressPart( aLex ) 
        && aLex.Get() == '.'
        && CheckIPv4AddressPart( aLex ) 
        && aLex.Get() == '.'
        && CheckIPv4AddressPart( aLex ) 
        && aLex.Get() == '.'
        && CheckIPv4AddressPart( aLex ) && aLex.Get() == '\0' ;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:15,代码来源:WPAdapterUtil.cpp

示例13: SkipToEnd

TInt SkipToEnd(TLex& aLex, const TDesC& aDes)
	{
	TInt ret = aLex.Remainder().Find(aDes);
	if (ret >= 0)
		{
		aLex.Inc(ret + aDes.Length());
		return KErrNone;
		}
	return KErrNotFound;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:10,代码来源:command_info_file.cpp

示例14: LineRemainder

TPtrC LineRemainder(TLex& aLex)
	{
	aLex.Mark();
	if (SkipTo(aLex, KNewLine) == KErrNone)
		{
		return aLex.MarkedToken();
		}
	else
		{
		return aLex.Remainder();
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:12,代码来源:command_info_file.cpp

示例15: GetNextVersionPart

/**
 * Used for extracting the latter components of a TVersion from a string of the
 * form 1.2.3
 * Before reading checks that the end of the string has not yet been reached,
 * then steps past the first character (assumed to be '.' and attempts to read
 * an integer from the following character(s).
 * Any error in version length or missing components (e.g. if the version is "1")
 * reports 0 for thet missing part(s).
 */
TInt CTe_LbsIniFileReader::GetNextVersionPart(TLex& aLex) const
{
    TInt number = 0;
    if(!aLex.Eos())
    {
        aLex.Inc();
        if(!aLex.Eos())
        {
            aLex.Val(number);
        }
    }
    return(number);
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:22,代码来源:te_lbsinifilereader.cpp


注:本文中的TLex类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。