本文整理汇总了C++中TDesC8::Left方法的典型用法代码示例。如果您正苦于以下问题:C++ TDesC8::Left方法的具体用法?C++ TDesC8::Left怎么用?C++ TDesC8::Left使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDesC8
的用法示例。
在下文中一共展示了TDesC8::Left方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveSettingToAttributes
/**
* Method for setting a specific descriptor (from settings file) to attribute structure
*
* @param aSetting
* @param aName
*/
void CPwrPlugin::SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex)
{
// find the equal mark from the setting line
TInt sepPos = aSetting.Find(KSettingItemSeparator);
// check that '=' is found
if (sepPos > 0)
{
// check that the element matches
if (aSetting.Left(sepPos).CompareF(KEnabled) == 0)
{
TBool en;
CSamplerPluginInterface::Str2Bool(aSetting.Right(aSetting.Length()-sepPos-1), en);
if(en != iSamplerAttributes->At(aIndex).iEnabled)
{
iSamplerAttributes->At(aIndex).iEnabled = en;
}
}
else if (aSetting.Left(sepPos).CompareF(KSamplingPeriodMs) == 0)
{
TInt sr;
CSamplerPluginInterface::Str2Int(aSetting.Right(aSetting.Length()-sepPos-1), sr);
if(sr != iSamplerAttributes->At(aIndex).iSampleRate)
{
iSamplerAttributes->At(aIndex).iSampleRate = sr;
}
}
}
}
示例2: WRITE_VALUES
void WRITE_VALUES(const TDesC8& lhs, const TDesC8& rhs) {
TBuf<100> b;
b.Copy(lhs.Left(100));
output->Write(b);
output->Write(_L(" "));
b.Copy(rhs.Left(100));
output->Write(b);
}
示例3: Set
void CSenPropertiesElement::Set( const TDesC8& aNamespaceURI,
const TDesC8& aLocalName,
const TDesC8& aQName )
{
if ( !ipStringPool )
{
CSenXmlElement::Set(aNamespaceURI, aLocalName, aQName);
}
else
{
RString localName;
TInt leaveCode(KErrNone);
TRAP( leaveCode, localName = ipStringPool->OpenStringL(aLocalName); )
if( !leaveCode )
{
iLocalName.Close();
iLocalName = localName;
TPtrC8 prefix(KNullDesC8);
if(aQName != KNullDesC8)
{
TInt colon(KErrNotFound);
colon = aQName.Locate(':');
if(colon!=KErrNotFound)
{
prefix.Set(aQName.Left(colon));
}
}
TRAP( leaveCode, SetNamespaceL(prefix, aNamespaceURI); )
示例4: httpCreateConnectionLC
//returns >0 or CONNERR.
int Syscall::httpCreateConnectionLC(const TDesC8& parturl, CHttpConnection*& conn,
int method, SocketType socketType)
{
int port_m1_index = parturl.Locate(':');
int path_index = parturl.Locate('/');
if(path_index == KErrNotFound) {
return CONNERR_URL;
}
if(port_m1_index > path_index) {
port_m1_index = KErrNotFound;
}
TPtrC8 path(parturl.Mid(path_index));
int hostname_length;
TUint16 port;
if(port_m1_index == KErrNotFound) {
port = (socketType == SSL) ? 443 : 80;
hostname_length = path_index;
} else {
TLex8 portLex(parturl.Mid(port_m1_index + 1, path_index - (port_m1_index + 1)));
hostname_length = port_m1_index;
if(portLex.Val(port, EDecimal) != KErrNone) {
return CONNERR_URL;
}
}
TPtrC8 hostname(parturl.Left(hostname_length));
conn = new (ELeave) CHttpConnection(createSocket(socketType), method, port, gHttpStringPool);
CleanupStack::PushL(conn);
conn->ConstructL(hostname, path);
return 1;
}
示例5: MakeListboxL
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CImeiSettings::MakeListboxL(const TDesC8& aType,const TDesC8& aData,const TDesC& aExtension)
{
iListBox = new (ELeave) CImeiSettingsListListbox();
iListBox->ConstructFromResourceL(R_MYTYPE_SETTING);
iListBox->MakeVisible(ETrue);
iListBox->SetRect(CEikonEnv::Static()->EikAppUi()->ClientRect());
iListBox->ActivateL();
TInt i =0;
for(i = 0; i < aType.Length(); i++)
{
if(aType[i] == 47)
break;
}
if(i < aType.Length())
{
iListBox->iType.Copy(aType.Left(i));
iListBox->iTypeId.Copy(aType.Right(aType.Length() - (i+1)));
}
else
{
iListBox->iType.Copy(aType);
}
iListBox->iExtension.Copy(aExtension);
iListBox->LoadSettingsL();
iListBox->DrawNow();
}
示例6: generatedFirstPartOfEucJpPacked
/**
@SYMTestCaseID SYSLIB-CHARCONV-CT-0536
@SYMTestCaseDesc Splitting and converting from Unicode to EucJpPacked test
@SYMTestPriority Medium
@SYMTestActions Tests for conversion after splitting, from Unicode to EucJpPacked and back to Unicode
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
void CT_EUCJP_PACKED_2::TestSplittingConvertingFromUnicodeToEucJpPacked(CCnvCharacterSetConverter& aCharacterSetConverter, TInt aMaximumLengthLowerLimit, TInt aMaximumLengthUpperLimit, TInt aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit, TInt aExpectedLengthOfFirstPartOfEucJpPacked, const TDesC8& aExpectedEucJpPacked, const TDesC16& aOriginalUnicode)
{
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0536 "));
test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
test(aMaximumLengthUpperLimit<=KBufferLength);
TUint8 eucJpPackedBuffer[KBufferLength];
for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
{
TPtr8 generatedFirstPartOfEucJpPacked(eucJpPackedBuffer, i);
test(aCharacterSetConverter.ConvertFromUnicode(generatedFirstPartOfEucJpPacked, aOriginalUnicode)==aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit);
test(generatedFirstPartOfEucJpPacked==aExpectedEucJpPacked.Left(aExpectedLengthOfFirstPartOfEucJpPacked));
TBuf8<KBufferLength> generatedSecondPartOfEucJpPacked;
test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfEucJpPacked, aOriginalUnicode.Right(aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit))==0);
test(generatedSecondPartOfEucJpPacked==aExpectedEucJpPacked.Mid(aExpectedLengthOfFirstPartOfEucJpPacked));
TInt state=CCnvCharacterSetConverter::KStateDefault;
TBuf16<KBufferLength> generatedUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedUnicode, generatedFirstPartOfEucJpPacked, state)==0);
test(state==CCnvCharacterSetConverter::KStateDefault);
TBuf16<KBufferLength> generatedSecondPartOfUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, generatedSecondPartOfEucJpPacked, state)==0);
test(state==CCnvCharacterSetConverter::KStateDefault);
generatedUnicode.Append(generatedSecondPartOfUnicode);
test(generatedUnicode==aOriginalUnicode);
}
}
示例7: 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);
}
示例8: TATParam
EXPORT_C TATParam::TATParam(const TDesC8& aValue, TATParamType aType)
: iValueInt(0), iType(aType)
{
iValue.Copy(aValue.Left(iValue.MaxLength())); // to prevent panic for exceeding iValue length
iValue.Trim();
if (EATDQStringParam == aType)
AddDQ();
TRACE_INFO((_L8("param type %d, '%S'"), iType, &iValue))
}
示例9: RemoveProp
// ------------------------------------------------------------------------------------------------
// TPtrC8 NSmlDmURI::RemoveProp(const TDesC8& aURI)
// removes property from the uri
// ------------------------------------------------------------------------------------------------
TPtrC8 NSmlDmURI::RemoveProp(const TDesC8& aURI)
{
TInt offset = aURI.Find(KNSmlDmQuestionMark);
if(offset!=KErrNotFound)
{
return aURI.Left(offset);
}
return aURI;
}
示例10: Match
TBool CExampleResolver::Match(const TDesC8& aImplementationType,
const TDesC8& aMatchType,
TBool aUseWildcards) const
{
TInt matchPos = KErrNotFound;
_LIT8(dataSeparator, "||");
const TInt separatorLength = dataSeparator().Length();
// Look for the section separator marker '||'
TInt separatorPos = aImplementationType.Find(dataSeparator);
if(separatorPos == KErrNotFound)
{
// Match against the whole string
if(aUseWildcards)
matchPos = aImplementationType.Match(aMatchType);
else
matchPos = aImplementationType.Compare(aMatchType);
}
else
{
// Find the first section, up to the separator
TPtrC8 dataSection = aImplementationType.Left(separatorPos);
TPtrC8 remainingData = aImplementationType.Mid(separatorPos + separatorLength);
// Match against each section in turn
while(separatorPos != KErrNotFound)
{
// Search this section
if(aUseWildcards)
matchPos = dataSection.Match(aMatchType);
else
matchPos = dataSection.Compare(aMatchType);
// If we found it then no need to continue, so return
if(matchPos != KErrNotFound)
return ETrue;
// Move on to the next section
separatorPos = remainingData.Find(dataSeparator);
if(separatorPos != KErrNotFound)
{
dataSection.Set(remainingData.Left(separatorPos));
remainingData.Set(remainingData.Mid(separatorPos + separatorLength));
}
else
dataSection.Set(remainingData);
}
// Check the final part
if(aUseWildcards)
matchPos = dataSection.Match(aMatchType);
else
matchPos = dataSection.Compare(aMatchType);
}
return matchPos != KErrNotFound;
}
示例11: DoRecognizeL
void CConfigRecognizer::DoRecognizeL(const TDesC & /*aName*/,
const TDesC8 &aBuffer) {
if ( aBuffer.Length() < KIdLength ) {
return;
}
if ( aBuffer.Left(KIdLength).Compare(KSettingsId) ) {
return;
}
iConfidence = ECertain;
iDataType = TDataType(KMIMEType);
}
示例12: value
// -----------------------------------------------------------------------------
// CSdpOriginField::Get63Msbs
// Returns a maximum of 63 bits of information from the descriptor containing a
// decimal number.
// -----------------------------------------------------------------------------
//
TInt64 CSdpOriginField::Get63Msbs( const TDesC8& aDecimalValue ) const
{
// The maximum amount of digits in a decimal number, that is guaranteed to
// fit into 63 bits, is 18. Even if all the 18 digits are 9, the decimal
// number is 999999999999999999.
const TInt64 KMaxAmountOfDecimalDigits = 18;
TInt64 value( 0 );
TPtrC8 msbPart = aDecimalValue.Left( KMaxAmountOfDecimalDigits );
TLex8( msbPart ).Val( value );
return value;
}
示例13:
DMAD_EXPORT_C TPtrC8 TDmAdUtil::RemoveLastUriSeg(const TDesC8& aUri)
{
TInt i;
for (i=aUri.Length()-1; i>=0; i--)
{
if (aUri[i] == '/')
{
break;
}
}
return aUri.Left(i);
}
示例14: GetSHttpConnStatus
TBool CSocketEngine::GetSHttpConnStatus(const TDesC8& aDesc){
if(aDesc.Length()>0){
TPtrC8 tmp;
tmp.Set(aDesc.Left(30));
if(tmp.FindF(_L8("200"))!=KErrNotFound||tmp.FindF(_L8("206"))!=KErrNotFound||tmp.FindF(_L8("301"))!=KErrNotFound||tmp.FindF(_L8("302"))!=KErrNotFound){
return ETrue;
}else{
return EFalse;
}
}else{
return EFalse;
}
}
示例15: MatchServiceCmd
TBool CAiwResolver::MatchServiceCmd(const TDesC8& aOpaqueData, const TDesC8& aServiceCmd) const
{
_LIT8(dataSeparator, "||");
const TInt separatorLength = dataSeparator().Length();
// Look for the section separator marker '||'
TInt separatorPos = aOpaqueData.Find(dataSeparator);
if (separatorPos == KErrNotFound)
{
if (aServiceCmd.Compare(aOpaqueData) == 0)
{
return ETrue;
}
}
else
{
// Find the first section, up to the separator
TPtrC8 dataSection = aOpaqueData.Left(separatorPos);
TPtrC8 remainingData = aOpaqueData.Mid(separatorPos + separatorLength);
// Match against each section in turn
while (separatorPos != KErrNotFound)
{
if (dataSection.Compare(aServiceCmd) == 0)
{
return ETrue;
}
// Move on to the next section
separatorPos = remainingData.Find(dataSeparator);
if (separatorPos != KErrNotFound)
{
dataSection.Set(remainingData.Left(separatorPos));
remainingData.Set(remainingData.Mid(separatorPos + separatorLength));
}
else
{
dataSection.Set(remainingData);
}
}
if (dataSection.Compare(aServiceCmd) == 0)
{
return ETrue;
}
}
return EFalse;
}