本文整理汇总了C++中TLex8::Assign方法的典型用法代码示例。如果您正苦于以下问题:C++ TLex8::Assign方法的具体用法?C++ TLex8::Assign怎么用?C++ TLex8::Assign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLex8
的用法示例。
在下文中一共展示了TLex8::Assign方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindLocalProcessInfoL
// ----------------------------------------------------------------------------------------
// CTerminalControlServer::FindLocalProcessInfoL
// ----------------------------------------------------------------------------------------
CTerminalControlServer::TTcProcessInfo CTerminalControlServer::FindLocalProcessInfoL ( const TDesC8 &aProcessName )
{
RDEBUG("CTerminalControlServer::FindLocalProcessInfoL");
TInt processCount = iProcessInfoArray->Count();
if(processCount == 0)
{
User::Leave( KErrNotFound );
}
if(aProcessName.Length() < KFormatProcessNamePrefix().Length()+1)
{
User::Leave(KErrNotFound);
}
if(aProcessName.Left( KFormatProcessNamePrefix().Length() ).Compare(KFormatProcessNamePrefix) != KErrNone)
{
User::Leave(KErrNotFound);
}
//
// Get process index from the name
//
TInt index;
TLex8 lex;
lex.Assign( aProcessName );
lex.Inc( KFormatProcessNamePrefix().Length() );
User::LeaveIfError( lex.Val(index) );
index --;
if(index < 0 || index >= processCount)
{
User::Leave( KErrNotFound );
}
return iProcessInfoArray->At(index);
}
示例2: CleanupUnusedIdentityDBL
void CSenBaseIdentityManager::CleanupUnusedIdentityDBL()
{
TInt count(0);
RPointerArray<CSenElement> elemList;
CleanupClosePushL(elemList);
CSenElement& element = iIdentity->AsElement();
element.ElementsL(elemList, KIdentityProvider);
count = elemList.Count();
// There can be many Identity Provider elements within Identity element
for(TInt i = 0; i < count; i++)
{
CSenElement* elem = elemList[i];
const TDesC8* attrValue = elem->AttrValue(KTouch());
if(attrValue != NULL)
{
TUint32 current_tick(0);
TUint32 db_ticks(0);
TUint32 diff_ticks(0);
TLex8 lex;
lex.Assign(*attrValue);
lex.Val(db_ticks, EDecimal);
current_tick = User::NTickCount();
diff_ticks = current_tick - db_ticks;
if(KMaxTicks <= diff_ticks || current_tick < db_ticks)
{
TInt endpointCount(0);
_LIT8(KEndpoint, "Endpoint");
RPointerArray<CSenElement> endpointElemList;
CleanupClosePushL(endpointElemList);
elem->ElementsL(endpointElemList, KEndpoint);
endpointCount = endpointElemList.Count();
if(endpointCount > 0)
{
CSenIdentityProvider* pMatch = NULL;
CSenElement* endpointElem = endpointElemList[0];
TPtrC8 endpoint = endpointElem->Content();
pMatch = IdentityProviderL(endpoint);
if(pMatch != NULL)
{
// Ownership ?
UnregisterIdentityProviderL(*pMatch);
}
}
CleanupStack::PopAndDestroy(&endpointElemList);
}
}
}
CleanupStack::PopAndDestroy(&elemList);
}
示例3: StartProcessByUidL
// ----------------------------------------------------------------------------------------
// CTerminalControlServer::StartProcessByUidL
// ----------------------------------------------------------------------------------------
void CTerminalControlServer::StartProcessByUidL ( const TDesC8& aUID )
{
RDEBUG("CTerminalControlServer::StartProcessByUidL2");
TLex8 lex;
lex.Assign( aUID );
TInt64 uid_value;
User::LeaveIfError( lex.Val( uid_value) );
StartProcessByUidL( TUid::Uid( uid_value ) );
}
示例4: EncodeL
void CDomainNameCodec::EncodeL(TDomainNameArray& aNames, RBuf8& aBuf8)
{
TUint requiredLength = 0;
TUint8 nameIdx = 0;
for (nameIdx=0;nameIdx<aNames.Count();nameIdx++)
{
// The total length required for the labels that comprise an
// individual domain name needs to take into the length octet
// for the initial label and the null-termination character.
// Hence the '+ 2' below.
requiredLength += (aNames[nameIdx].Length() + 2);
// A further length check is performed on each domain name to
// ensure it does not exceed the maximum length permitted according
// to RFC 1035.
if(aNames[nameIdx].Length() > KMaxDomainNameLength)
{
User::Leave(KErrArgument);
}
}
aBuf8.Zero();
aBuf8.ReAllocL(requiredLength);
TLex8 domainName;
TPtrC8 currentLabel;
for (nameIdx=0;nameIdx<aNames.Count();nameIdx++)
{
domainName.Assign(aNames[nameIdx]);
domainName.Mark();
while (!domainName.Eos())
{
TChar ch;
do
{
ch = domainName.Get();
}
while ( ch != TChar('.') && !domainName.Eos() );
// if not the end of the string, unget the previous char to skip the trailing
// dot in our marked token
//
if( !domainName.Eos() )
{
domainName.UnGet();
}
currentLabel.Set(domainName.MarkedToken());
// move past the dot again, or do nothing in particular at EOS
//
domainName.Get();
User::LeaveIfError(currentLabel.Length() > KMaxDnsLabelLength ?
KErrArgument : KErrNone);
aBuf8.Append(TChar(currentLabel.Length()));
aBuf8.Append(currentLabel);
domainName.Mark();
}
aBuf8.Append(TChar(0));
}
}
示例5: ProcessFailureMessageL
inline void CPppMsChap::ProcessFailureMessageL(
const TDesC8& aFailureMessage,
TUint& aErrorCode,
TUint8& aRetryFlag,
TBool& aHasNewChallenge,
TDes8& aChallenge,
TUint8& aPasswordProtoVersion)
/**
Processes a MS-CHAP Failure Message.
@param aFailureMessage [in] A MS-CHAP Failure Message. The Failure
Message needs to be in the format specified in RFC 2433:
"E=eeeeeeeeee R=r C=cccccccccccccccc V=vvvvvvvvvv".
@param aErrorCode [out] The MS-CHAP Failure error code.
@param aRetryFlag [out] The retry flag. The flag will be set to
"1" if a retry is allowed, and "0" if not. When the authenticator
sets this flag to "1" it disables short timeouts, expecting the
peer to prompt the user for new credentials and resubmit the
response.
@param aHasNewChallenge [out] The flag that indicates if the
Failure Message contains a new Challenge Value.
@param aChallenge [out] The new Challenge Value, if the Failure
Message contains a one.
@param aPasswordProtoVersion [out] The password changing protocol
supported by the peer.
@internalComponent
*/
{
ASSERT(aChallenge.Length() == KPppMsChapChallengeSize);
TLex8 input(aFailureMessage);
if (input.Get() != 'E')
User::Leave(KErrGeneral);
if (input.Get() != '=')
User::Leave(KErrGeneral);
// RFC 2433: ""eeeeeeeeee" is the ASCII representation of a decimal
// error code (need not be 10 digits) corresponding to one of those
// listed below, though implementations should deal with codes not on
// this list gracefully."
TInt ret;
if ((ret = input.Val(aErrorCode)) != KErrNone)
if (ret != KErrOverflow)
User::Leave(KErrGeneral);
else
// Gracefully handle unusually large, yet valid, MS-CHAP specific
// error code values. This code only handles the MS-CHAP specific
// error code values specified in RFC 2433.
aErrorCode=0;
input.SkipSpace();
if (input.Get() != 'R')
User::Leave(KErrGeneral);
if (input.Get() != '=')
User::Leave(KErrGeneral);
if (input.Val(aRetryFlag, EDecimal)!=KErrNone)
User::Leave(KErrGeneral);
input.SkipSpace();
switch (input.Get())
{
case 'C':
{
if (input.Get() != '=')
User::Leave(KErrGeneral);
TPtrC8 token(input.NextToken());
// This field is 16 hexadecimal digits representing an ASCII
// representation of a new challenge value. Each octet is represented
// in 2 hexadecimal digits.
if (token.Length() != KPppMsChapChallengeSize*2)
User::Leave(KErrGeneral);
TLex8 lex;
TUint8 octet;
TUint8* pChallengeOctet =
const_cast<TUint8*>(aChallenge.Ptr());
TUint8 i = 0;
do
{
lex.Assign(token.Mid(i*2, 2));
if (lex.Val(octet, EHex) != KErrNone)
User::Leave(KErrGeneral);
*(pChallengeOctet + i) = octet;
}
while (++i < KPppMsChapChallengeSize);
aHasNewChallenge = ETrue;
input.SkipSpace();
//.........这里部分代码省略.........
示例6: ResponseHeaderReceived
// ---------------------------------------------------------------------------
// Received a response header
// ---------------------------------------------------------------------------
//
void CCatalogsHttpTransaction::ResponseHeaderReceived( const TDesC8& aHeader,
const TDesC8& aValue )
{
DLTRACEIN( ("") );
DASSERT( iObserver );
TRAPD( err, iResponseHeaders->AddHeaderL( aHeader, aValue ) );
if ( err != KErrNone )
{
HandleHttpError( ECatalogsHttpErrorGeneral, err );
return;
}
iState.iOperationState = ECatalogsHttpOpInProgress;
iState.iProgressState = ECatalogsHttpResponseHeaderReceived;
if ( aHeader.CompareF( KHttpContentRangeHeader ) == 0 )
{
//
// Content-Range, bytes x-y/z
// Extract 'z' and use it as the total content length
//
TPtrC8 ptr( aValue );
TInt offset = ptr.Locate( '/' );
if ( offset != KErrNotFound )
{
TLex8 val;
val.Assign( ptr.Mid( offset + 1 ) );
TInt value;
TInt err = val.Val( value );
if ( err == KErrNone )
{
iContentLength = value;
DLTRACE(( "Content length: %i", iContentLength ));
}
}
}
else if ( aHeader.CompareF( KHttpContentLengthHeader ) == 0 )
{
//
// If content length for this request has not been already set
// e.g. from a Content-Range header, extract from Content-Length header
//
if ( iContentLength == 0 )
{
TLex8 val;
val.Assign( aValue );
TInt value;
TInt err = val.Val( value );
if ( err == KErrNone )
{
iContentLength = value;
DLTRACE(( "Content length: %i", iContentLength ));
}
}
else
{
DLTRACE(( "-> ContentLength set, ignoring" ));
}
}
else if ( aHeader.CompareF( KHttpContentTypeHeader ) == 0 )
{
// Content type from the header
DLTRACE( ( "Content type received" ) );
TRAPD( err, SetContentTypeL( aValue ) );
if ( err != KErrNone )
{
DLTRACE( ( "Content type setting failed with err: %i",
err ) );
HandleHttpError( ECatalogsHttpErrorGeneral, err );
return;
}
else
{
iState.iProgressState = ECatalogsHttpContentTypeReceived;
}
}
// Report the observer that a header has been received
NotifyObserver();
}
示例7: ReadConfigFileL
// Function to read a line from a buffer
GLDEF_C void ReadConfigFileL(RFile& aConfigFile, TListeners& aListeners, RSocketServ& aSocketServ, RConnection& aConnect)
{
TInt fileLen;
User::LeaveIfError(aConfigFile.Size(fileLen));
HBufC8* readBuffer = HBufC8::NewL(fileLen);
CleanupStack::PushL(readBuffer);
TPtr8 buff = readBuffer->Des();
// Read File
// Here, we read the whole file as we know it's small
TRequestStatus status;
aConfigFile.Read(buff, status);
User::WaitForRequest(status);
if(status.Int() != KErrNone && status.Int() != KErrEof)
{
User::LeaveIfError(status.Int());
}
HBufC8* tempBuffer = HBufC8::NewL(KLineSize);
CleanupStack::PushL(tempBuffer);
TPtr8 lineBuff = tempBuffer->Des();
TLex8 lex;
lex.Assign(buff);
/* Parse whole stream in to split it in lines
We discard commented line with #
*/
TBool error = EFalse;
while(!lex.Eos() && !error)
{
TBool comment = EFalse;
if(lex.Peek() == '#')
{
// We've got a comment
comment = ETrue;
}
TInt nbCharRead = 0; // To count number of character per line. Used to avoid a buffer overflow
while(!error && !lex.Eos() && lex.Peek() != '\r' && lex.Peek() != '\n')
{
// We look if we are allowed to append character. Otherwise we stop loopping.
if(nbCharRead < KLineSize)
{
lineBuff.Append(lex.Get());
nbCharRead++;
}
else
{
error = ETrue;
}
}
if(!comment)
{
// We create a new listener
TInt nbListeners = aListeners.Count();
if(nbListeners < KNbListeners)
{
aListeners.Append(CListener::NewL(aSocketServ, aConnect, CListenerOptions::NewL(lineBuff)));
aListeners[nbListeners]->AcceptL();
}
}
lineBuff.Zero();
if(lex.Peek() == '\r')
{
lex.Get(); // Get rid of \r
}
lex.Get(); // Get rid of \n
}
// Delete buffers
CleanupStack::PopAndDestroy(tempBuffer);
CleanupStack::PopAndDestroy(readBuffer);
if(error)
{
// We have a bad line in our configuration file so we delete all listeners
aListeners.ResetAndDestroy();
}
}
示例8: input
inline void CPppMsChap2::ProcessFailureMessageL(
const TDesC8& aFailureMessage,
TUint& aErrorCode,
TUint8& aRetryFlag,
TDes8& aAuthChallenge,
TUint8& aPasswordProtoVersion,
TPtrC8& aMessage)
/**
Processes a MS-CHAP-V2 Failure Message.
@param aFailureMessage [in] A MS-CHAP-V2 Failure Message. The
Failure Message needs to be in the format specified in RFC 2759:
"E=eeeeeeeeee R=r C=cccccccccccccccccccccccccccccccc V=vvvvvvvvvv
M=<msg>".
@param aErrorCode [out] The MS-CHAP-V2 Failure error code.
@param aRetryFlag [out] The retry flag. The flag will be set to
"1" if a retry is allowed, and "0" if not. When the authenticator
sets this flag to "1" it disables short timeouts, expecting the
peer to prompt the user for new credentials and resubmit the
response.
@param aAuthChallenge [out] The new Authenticator Challenge Value.
@param aPasswordProtoVersion [out] The password changing protocol
supported by the peer.
@param aMessage [out] A failure text message.
@internalComponent
*/
{
ASSERT(aAuthChallenge.Length() ==
KPppMsChap2AuthenticatorChallengeSize);
TLex8 input(aFailureMessage);
if (input.Get() != 'E')
User::Leave(KErrGeneral);
if (input.Get() != '=')
User::Leave(KErrGeneral);
// RFC 2759: ""eeeeeeeeee" is the ASCII representation of a decimal
// error code (need not be 10 digits) corresponding to one of those
// listed below, though implementations should deal with codes not on
// this list gracefully."
TInt ret;
if ((ret = input.Val(aErrorCode))!=KErrNone)
if (ret!= KErrOverflow)
User::Leave(KErrGeneral);
else
// Gracefully handle unusually large, yet valid, MS-CHAP-V2 specific
// error code values. This code only handles the MS-CHAP-V2 specific
// error code values specified in RFC 2759.
aErrorCode=0;
input.SkipSpace();
if (input.Get() != 'R')
User::Leave(KErrGeneral);
if (input.Get() != '=')
User::Leave(KErrGeneral);
if (input.Val(aRetryFlag, EDecimal)!=KErrNone)
User::Leave(KErrGeneral);
input.SkipSpace();
if (input.Get() != 'C')
User::Leave(KErrGeneral);
if (input.Get() != '=')
User::Leave(KErrGeneral);
TPtrC8 token(input.NextToken());
// This field is 32 hexadecimal digits representing an ASCII
// representation of a new challenge value. Each octet is represented
// in 2 hexadecimal digits.
if (token.Length() != KPppMsChap2AuthenticatorChallengeSize*2)
User::Leave(KErrGeneral);
TLex8 lex;
TUint8 octet;
TUint8* pChallengeOctet =
const_cast<TUint8*>(aAuthChallenge.Ptr());
TUint8 i = 0;
do
{
lex.Assign(token.Mid(i*2, 2));
if (lex.Val(octet, EHex) != KErrNone)
User::Leave(KErrGeneral);
*(pChallengeOctet + i) = octet;
}
while (++i < KPppMsChap2AuthenticatorChallengeSize);
input.SkipSpace();
if (input.Get() != 'V')
User::Leave(KErrGeneral);
//.........这里部分代码省略.........
示例9: HandleNotifyL
// -----------------------------------------------------------------------------
// CSeiForwardPlugin::HandleNotifyL
//
// -----------------------------------------------------------------------------
//
void CSeiForwardPlugin::HandleNotifyL( const CEcmtMessageEvent& aEvent )
{
const TPtrC8 m = iMessaging->Message( aEvent );
TLex8 lexer( m );
TPtrC8 type = lexer.NextToken();
TPtrC8 channelStr = lexer.NextToken();
TLex8 num ( channelStr );
TInt channel;
// Check message type
if ( ( type != KConnect ) &&
( type != KListen ) &&
( type != KMsg ) )
{
RDebug::Print( _L( "EcmtSeiForwardPlugin: Invalid message" ) );
return;
}
// Get channel number
if ( num.Val( channel ) )
{
RDebug::Print( _L( "EcmtSeiForwardPlugin: Invalid channel" ) );
return;
}
// Process message
if ( type == KConnect )
{
TPtrC8 portStr = lexer.NextToken();
TInt port;
num.Assign ( portStr );
// Get port number
if ( num.Val( port ) )
{
RDebug::Print( _L( "EcmtSeiForwardPlugin: Invalid port" ) );
return;
}
ConnectL( channel, port );
}
else if ( type == KListen )
{
ListenL( channel );
}
else if ( type == KMsg )
{
// Now this just sends the message back to the Java plug-in.
// Instead, should cancel the appropriate socket read and write
// the message to the socket.
TPtrC8 msg = lexer.Remainder();
SendMessageL( channel, msg );
}
}
示例10: SendCurrentValuesL
// -----------------------------------------------------------------------------
// CEcmtPanPlugin::SendCurrentValues
//
// -----------------------------------------------------------------------------
//
void CEcmtPanPlugin::SendCurrentValuesL( )
{
#ifdef ECMT_RDEBUG
RDebug::Print( _L( "EcmtPanPlugin::SendCurrentValuesL" ) );
#endif
TBuf<KMaxWin32Path> buf;
TBuf8<KMaxPanMsgLen> msg;
TPtrC8 line;
TLex8 lexer;
/*
* Handle bt.esk
*/
GetBtEskFilename( buf );
REcmtFile btFile( buf );
btFile.Read();
if ( !btFile.IsGood() )
{
return;
}
line.Set( btFile.FindLine( KBtPort ) );
if ( line.Length() == 0 )
{
return;
}
msg.Append( KBtCom );
msg.Append( ' ' );
lexer.Assign( line );
lexer.SkipCharacters();
msg.Append( lexer.NextToken() );
msg.Append( ' ' );
line.Set( btFile.FindLine( KHciDll ) );
if ( line.Length() == 0 )
{
return;
}
msg.Append( KHci );
msg.Append( ' ' );
lexer.Assign( line );
lexer.SkipCharacters();
TPtrC8 dll( lexer.NextToken() );
if ( dll.CompareF( KHciDllBcsp ) == 0 )
{
msg.Append( '0' );
}
else if ( dll.CompareF( KHciDllH4 ) == 0 )
{
msg.Append( '1' );
}
else if ( dll.CompareF( KHciDllUsb ) == 0 )
{
msg.Append( '2' );
}
else
{
msg.Append( '-1' );
}
/*
* Handle irda.esk
*/
GetIrdaEskFilename( buf );
REcmtFile irdaFile( buf );
irdaFile.Read();
if ( !irdaFile.IsGood() )
{
return;
}
line.Set( irdaFile.FindLine( KIrdaPort ) );
if ( line.Length() == 0 )
{
return;
}
msg.Append( ' ' );
msg.Append( KIrdaCom );
msg.Append( ' ' );
lexer.Assign( line );
lexer.SkipCharacters();
msg.Append( lexer.NextToken() );
/*
* Send values
*/
CEcmtMessageEvent* m = iMessaging->NewMessageEvent( iTargetUid, msg );
if ( m )
//.........这里部分代码省略.........
示例11: ReceiveNextRole
/**
* After the player has received the update after the last iteration of the game.
* We want to display the current game status, if there is only one player remaining then
* the game has finished.
*/
void CScabbyQueenPlayer::ReceiveNextRole()
{
if (iPlayerUpdate == iGameOverBuffer)
{
iConsole.Printf(_L("\nDealer Says: GAME OVER"));
}
else
{
// Break down the update descriptor and display the result
TBufC<20> buffer;
buffer.Des().Copy(iPlayerUpdate);
iConsole.Printf(_L("\n\nUpdate from the dealer...%S\n"), &buffer);
TInt position;
TPtrC8 ptr(iPlayerUpdate);
TLex8 lex;
TInt player;
TBool stillIn = EFalse;
iConsole.Printf(_L("\n Number of players: %d\n"), iPlayerUpdate.Length()-1);
TInt stillInCount = 0;
for (TInt i=0; i<iPlayerUpdate.Length();i++)
{
TChar inspect = ptr[i];
if (inspect != 'F')
{
TBuf8<2> buff;
buff.Append(inspect);
lex.Assign(buff);
lex.Val(player);
if (stillIn)
{
TBufC16<2> buff;
buff.Des().Append(inspect);
iConsole.Printf(_L("\n Player %S still in play"), &buff);
stillInCount++;
}
else
{
position = i+1;
if (i == 0)
{
iConsole.Printf(_L("\n The winner is player %d"), player);
}
else
{
iConsole.Printf(_L("\n In position %d is player %d"), position, player);
}
}
}
else
{
stillIn = ETrue;
}
}
if (stillInCount == 1)
{
// If there is only one player left the game is over.
iGameOver = ETrue;
iConsole.Printf(_L("\nThe loser is player %d, give them a smack"), player);
iConsole.Printf(_L("\n\nDealer Says: GAME OVER"));
}
iGameStatus = EReadyForToken;
iSendMode = ESendReadyForToken;
BaseSendTo(iGameStatus, KDealerIpAddr);
}
}