本文整理汇总了C++中TPtrC::Compare方法的典型用法代码示例。如果您正苦于以下问题:C++ TPtrC::Compare方法的具体用法?C++ TPtrC::Compare怎么用?C++ TPtrC::Compare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPtrC
的用法示例。
在下文中一共展示了TPtrC::Compare方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetOpaqueHintL
TBool CHuiFxEffectParser::GetOpaqueHintL( CMDXMLNode *aNode )
{
if (aNode->NodeType() != CMDXMLNode::EElementNode)
{
FAIL(KErrGeneral, _L("Text node expected while reading visual source type"));
}
TInt attributeIndex = ((CMDXMLElement*)aNode)->FindIndex( KLitOpaque );
if (attributeIndex == KErrNotFound)
{
// If src not found, the source defaults to visual itself
return EFalse;
}
TPtrC attributeValue;
TPtrC attributeName;
User::LeaveIfError(((CMDXMLElement*)aNode)->AttributeDetails( attributeIndex, attributeName, attributeValue ));
if( attributeValue.Compare( KLitTrue ) == 0 )
{
return ETrue;
}
if( attributeValue.Compare( KLitFalse ) == 0 )
{
return EFalse;
}
return EFalse;
}
示例2: doTestStepPreambleL
TVerdict CTestChangeLanguageStep::doTestStepPreambleL()
/**
* @return - TVerdict code
* Override of base class virtual
*/
{
TPtrC langFromIni;
GetStringFromConfig(ConfigSection(),KLanguageTag,langFromIni);
if (langFromIni.Compare(_L("English")) == KErrNone)
{
iLanguage = ELangEnglish;
}
else if (langFromIni.Compare(_L("French")) == KErrNone)
{
iLanguage = ELangFrench;
}
else
{
_LIT(KLanguageNotFound,"TestChangeLanguage: Language Tag not found, default to English");
INFO_PRINTF1(KLanguageNotFound);
iLanguage = ELangEnglish;
}
return TestStepResult();
}
示例3: HandleMessageL
// -----------------------------------------------------------------------------
// COMASuplWapListener::HandleMessageL
// Handles a push message synchronously.
// -----------------------------------------------------------------------------
//
void COMASuplWapListener::HandleMessageL( CPushMessage* aPushMsg )
{
//TBuf<64> contentType;
__ASSERT_ALWAYS( aPushMsg, User::Panic( KPushMsgNull, KErrUnknown ) );
iTrace->Trace( _L( "COMASuplWapListener::HandleMessageL() Sync Start" ), KTraceFileName, __LINE__ );
iMessage = aPushMsg;
TPtrC receivedContentType;
iTrace->Trace( _L("Retriving Content Type:" ), KTraceFileName, __LINE__ );
iMessage->GetContentType(receivedContentType);
iTrace->Trace( _L("Received Content Type for WAP ..." ), KTraceFileName, __LINE__ );
iTrace->Trace(receivedContentType, KTraceFileName, __LINE__ );
if(receivedContentType.Compare(KSupportedContentType) == 0 ||
receivedContentType.Compare(KSupportedBinaryContentType) == 0 ||
receivedContentType.Compare(KSupportedBinaryContentType2) == 0 ) //can be combined...
{
iState = EProcess;
}
else if (CheckBinaryContentType(aPushMsg))
{
iState = EProcess;
}
else
{
iTrace->Trace( _L("ERROR:Received Content Type is not supported..." ), KTraceFileName, __LINE__ );
iState = EComplete;
iErrCode = KErrNotSupported;
}
IdleComplete();
}
示例4: GetConnectionType
TInt CTS_MultiHomingStep::GetConnectionType(TConnDetails *conn, TDesC& aName)
{
TPtrC ptrBuf;
TInt err = GetStringFromConfig(aName, KConnType, ptrBuf);
if(err != 1)
{
LogExtra((TText8*)__FILE__, __LINE__, ESevrWarn, KEConfigFile);
return err;
}
if(ptrBuf.Compare(KConnDefault) ==0)
conn->iConnectionType = TConnDetails::defaultConn;
else if(ptrBuf.Compare(KConnImplicit) ==0)
conn->iConnectionType = TConnDetails::implicitConn;
else if(ptrBuf.Compare(KConnExplicit) ==0)
conn->iConnectionType = TConnDetails::explicitConn;
else
{
_LIT(KTypeErr, "Connection type should be one of %S %S or %S");
LogExtra((TText8*)__FILE__, __LINE__, ESevrErr, KTypeErr, KConnExplicit, KConnImplicit, KConnDefault );
return KErrNotFound;
}
return KErrNone;
}
示例5: NameL
// -----------------------------------------------------------------------------
// CMdETestScripter::NameL
// -----------------------------------------------------------------------------
//
TInt CMdETestScripter::NameL( CStifItemParser& aItem )
{
TInt mode;
TPtrC name;
User::LeaveIfError( aItem.GetNextInt( mode ));
if ( mode == EPropertyDef )
{
CMdEPropertyDef* propDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem );
aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
User::LeaveIfError( aItem.GetNextString( name ));
TL( name.Compare( propDef->Name()) == 0 );
}
else if ( mode == ENamespaceDef )
{
CMdENamespaceDef* spaceDef = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem );
aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
User::LeaveIfError( aItem.GetNextString( name ));
TL( name.Compare( spaceDef->Name()) == 0 );
}
else
{
User::Leave( KErrArgument );
}
return KErrNone;
}
示例6: ConfigureFromIni
TInt COpenRSubConnectionStep::ConfigureFromIni()
{
iParams.Reset();
// Read in appropriate fields
if((GetStringFromConfig(iSection, KTe_SubConnectionName, iParams.iSubConnectionName) != 1)
|| (iParams.iSubConnectionName.Length() == 0))
{
INFO_PRINTF1(_L("Couldn't find appropriate field in config file"));
return KErrNotFound;
}
if (GetStringFromConfig(iSection,KTe_SocketServName,iParams.iSockServName)!=1)
{
INFO_PRINTF2(_L("%S: Socket server name missing."),&iParams.iSubConnectionName);
return KErrNotFound;
}
if (GetStringFromConfig(iSection,KTe_ConnectionName,iParams.iConnectionName)!=1)
{
INFO_PRINTF2(_L("%S: Connection name missing."),&iParams.iSubConnectionName);
return KErrNotFound;
}
TPtrC subConnTypeName;
if (GetStringFromConfig(iSection,KTe_SubConnectionTypeName,subConnTypeName)!=1)
{
INFO_PRINTF2(_L("%S: SubConnection type missing."),&iParams.iSubConnectionName);
return KErrNotFound;
}
if (subConnTypeName.Compare(KTe_SubConnectionTypeAttach)==0)
{ iParams.iSubConnType = RSubConnection::EAttachToDefault; }
else if (subConnTypeName.Compare(KTe_SubConnectionTypeNew)==0)
{ iParams.iSubConnType = RSubConnection::ECreateNew; }
else
{
INFO_PRINTF3(_L("%S: SubConnection type (%S) not recognised."),&iParams.iSubConnectionName,&subConnTypeName);
return KErrNotFound;
}
if (!GetIntFromConfig(iSection, KExpectedError, iExpectedError))
{
iExpectedError = KErrNone;
}
else
{
INFO_PRINTF2(_L("Error to be expected: %d"),iExpectedError);
}
// All ok if we got this far
return KErrNone;
}
示例7: VerifyMimeHeaderPartsL
TBool CT_MsgVerifyHeaders::VerifyMimeHeaderPartsL(CMsvEntrySelection* aEntrySelection)
{
TBool status = EPass;
for(int index = 0; index < aEntrySelection->Count(); ++index)
{
CMsvEntry* entry = iSharedDataPOP.iSession->GetEntryL(aEntrySelection->At(index));
CleanupStack::PushL(entry);
CMsvStore* store = entry->ReadStoreL();
CleanupStack::PushL(store);
if (store->IsPresentL(KUidMsgFileMimeHeader))
{
CImMimeHeader* mimeHeader = CImMimeHeader::NewLC();
mimeHeader->RestoreL(*store);
TBuf<256> param;
TPtrC contentType;
param.Format(KContentType, index);
if(GetStringFromConfig( ConfigSection(), param, contentType))
{
TPtrC8 content8 = mimeHeader->ContentType();
HBufC* content16 = HBufC::NewLC(content8.Length());
content16->Des().Copy(content8);
if(contentType.Compare(content16->Des()))
{
ERR_PRINTF1(_L("Content Type is not matched"));
status = EFail;
}
CleanupStack::PopAndDestroy(content16);
}
TPtrC contentSubType;
param.Format(KContentSubType, index);
if(GetStringFromConfig( ConfigSection(), param, contentSubType))
{
TPtrC8 content8 = mimeHeader->ContentSubType();
HBufC* content16 = HBufC::NewLC(content8.Length());
content16->Des().Copy(content8);
if(contentSubType.Compare(content16->Des()))
{
ERR_PRINTF1(_L("Content Sub Type is not matched"));
status = EFail;
}
CleanupStack::PopAndDestroy(content16);
}
CleanupStack::PopAndDestroy(mimeHeader);
}
CleanupStack::PopAndDestroy(store);
CleanupStack::PopAndDestroy(entry);
}
return status;
}
示例8: FindFolderL
TMsvId CTestImapSyncManager::FindFolderL(const TDesC& aName, TBool aCaseSensitive)
{
TMsvId remoteId = KErrNotFound;
iEntry->SetEntry(iServiceId);
CMsvEntrySelection* msvEntrySelection = new (ELeave) CMsvEntrySelection;
iEntry->GetChildren(*msvEntrySelection);
TPtrC iEntryName = aName;
TInt count = msvEntrySelection->Count();
for (TInt i=0; i<count; i++)
{
iEntry->SetEntry((*msvEntrySelection)[i]);
if (aCaseSensitive)
{
if (iEntryName.Compare(iEntry->Entry().iDetails ) == 0)
{
remoteId = (*msvEntrySelection)[i];
break;
}
}
else if ((iEntryName.CompareF(iEntry->Entry().iDetails) == 0))
{
remoteId = (*msvEntrySelection)[i];
break;
}
}
delete msvEntrySelection;
return remoteId;
}
示例9:
// ---------------------------------------------------------
// CPosTp52::CheckLongLandmarkNameL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosTp52::CheckLongLandmarkNameL()
{
iLog->Log(_L("CheckLandmarkL"));
// Should only exist one landmark in db
CPosLandmark* lm = iDatabase->ReadLandmarkLC(1);
TPtrC lmname;
TInt res = lm->GetLandmarkName(lmname);
if (res != KErrNone) //LogErrorAndLeave(_L("Problem getting Landmark"));
{
iLog->Log(_L("Problem getting Landmark"));
User::Leave(-1);
}
_LIT(KLONGNAME, "Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landm");
if (lmname.Compare(KLONGNAME) != 0)
{
iLog->Log(_L("Long landmark name does not match"));
iErrorsFound++;
}
CleanupStack::PopAndDestroy(lm);
}
示例10: CompareHashValuesL
/**
Auxilary function called to compare generated hash with reference hash and report error if they don't match.
@param aHashIndex holds the hashId.
*/
EXPORT_C void CTHashReferenceImages::CompareHashValuesL(const TDesC& aHashIndex)
{
TBuf<KLengthOfHashValue> hexString;
//Gets the hash value for the current drawings
GenerateHashAndReturnInHexFormatL(hexString);
TPtrC hashFromConfig;
TBool stringFound = iStep->GetStringFromConfig(iStep->ConfigSection(), aHashIndex, hashFromConfig);
if (stringFound)
{
//cannot use the macro //TEST((hashFromConfig.Compare(hexString)) == 0); since iStep needs to be
//referenced
iStep->testBooleanTrue((hashFromConfig.Compare(hexString)) == 0, (TText8*)__FILE__, __LINE__, ETrue);
}
else
{
#ifdef APPEND_NEW_OR_MISSING_HASH_DATA
//Hash data will be written to ini file if hash id is not found.
//If written the status will be as INI WRITE with the new hash id and value in test log file.
iStep->testBooleanTrue(iStep->WriteStringToConfig(iStep->ConfigSection(), aHashIndex, hexString), (TText8*)__FILE__, __LINE__);
#ifdef SAVEBITMAP
CopyScreenToBitmapL(aHashIndex);
#endif
#else
//Report error in case hash data is missing and APPEND_NEW_OR_MISSING_HASH_DATA is not defined
iStep->testBooleanTrue( 0, (TText8*)__FILE__, __LINE__);
#endif
}
}
示例11: GetMediaTypeL
// -----------------------------------------------------------------------------
// CCLFItemImpl::GetMediaTypeL
// -----------------------------------------------------------------------------
//
TInt CCLFItemImpl::GetMediaTypeL( CMdEObjectDef& aObjectDef, TInt32& aValue ) const
{
const TDesC* mdemediatypes[] =
{
&MdeConstants::Audio::KAudioObject,
&MdeConstants::Video::KVideoObject,
&MdeConstants::Image::KImageObject,
};
const TInt clfmediatypes[] =
{
ECLFMediaTypeSound,
ECLFMediaTypeVideo,
ECLFMediaTypeImage,
};
const TPtrC name = aObjectDef.Name();
TInt32 error = KErrNotFound;
aValue = ECLFMediaTypeUnknown; // Default to this.
for ( TUint i = 0; i < sizeof( clfmediatypes ) / sizeof( TInt ); ++i )
{
if ( name.Compare( *mdemediatypes[ i ] ) == 0 )
{
aValue = clfmediatypes[ i ];
error = KErrNone;
break;
}
}
if ( aValue == ECLFMediaTypeSound )
{
DetermineIfMusicL( aObjectDef, aValue );
}
return error;
}
示例12: GetResolverConfig
TInt CTS_MultiHomingStep::GetResolverConfig(const TInt aIndex, TName &aHostName, TInt& aProtocol,
TBool& aExpectSuccess, TBool& aExpectTimeout, TBool& aExpectNotReady,
TBool& aExplicitResolve, TConnDetails **aConnDetails)
/**
* Gets resolver configuration from file, using defaults if necessary
* @param aIndex The index for the socket configkey
* @param aHostName The host to be resolved
* @param aProtocol The protocol to be used
* @param aExpectSuccess Flag indicating if name should be resolved ok
* @param aExpectTimeout Flag indicating if name resolution should timeout
* @param aConnDetails The connection for an explicit resolver
* @return System wide error code
*/
{
TInt err=KErrNone;
TName resolverName; // Create the Key for the config lookup
resolverName = KResolver;
resolverName.AppendNum(aIndex);
TPtrC ptrBuf;
err = GetStringFromConfig(resolverName, KDestName, ptrBuf);
if (!err)
{
LogExtra((TText8*)__FILE__, __LINE__, ESevrWarn, KEConfigFile);
iTestStepResult= EInconclusive;
return KErrNotFound;
}
aHostName.Copy(ptrBuf.Ptr(), ptrBuf.Length());
aExpectSuccess = ETrue;
GetBoolFromConfig(resolverName, KExpectSuccess, aExpectSuccess);
aExpectTimeout = EFalse;
GetBoolFromConfig(resolverName, KExpectTimeout, aExpectTimeout);
aExpectNotReady = EFalse;
GetBoolFromConfig(resolverName, KExpectNoDnsServer, aExpectNotReady);
aExplicitResolve = EFalse;
GetBoolFromConfig(resolverName, KExplicitResolve, aExplicitResolve);
err = GetStringFromConfig(resolverName, KProtocol, ptrBuf);
if (err && (ptrBuf.Compare(KTcp)==0))
aProtocol = KProtocolInetTcp;
else
aProtocol = KProtocolInetUdp;
err = GetStringFromConfig(resolverName, KConnName, ptrBuf);
if (!err)
{
return KErrNotFound;
}
*aConnDetails = iOwnerSuite->GetTConnection(ptrBuf);
return KErrNone;
}
示例13: AddFieldsL
/** Create Contact Item and add field to it and
* verify the field is being added
* aValue - field value
* @param aStorageType - Storage type of each field
* @param aContFieldUid - Uid of Contact field
* @param avCardMapUid - Uid of vCard
* @return - void
*/
void CTestAddFieldsStep::AddFieldsL(TPtrC aValue, TInt aStorageType,TUid aContFieldUid, TUid avCardMap)
{
TPtrC value;
TInt year, month, day;
// Create contact Item and add field to it
CContactItem* item = CContactCard::NewLC();
CContactItemField* field = CContactItemField::NewL(aStorageType, aContFieldUid);
CleanupStack::PushL(field);
field->SetMapping(avCardMap);
if(aStorageType==KStorageTypeDateTime)
{
GetIntFromConfig(ConfigSection(), KIniYear, year);
GetIntFromConfig(ConfigSection(), KIniMonth, month);
GetIntFromConfig(ConfigSection(), KIniDay, day);
TDateTime date(year,(TMonth)month,day,0,0,0,0);
field->DateTimeStorage()->SetTime(date);
}
else
{
field->TextStorage()->SetTextL(aValue);
}
item->AddFieldL(*field);
// verify the field is being added
CContactItemFieldSet& ContactFieldSet = item->CardFields();
TInt pos = ContactFieldSet.Find(aContFieldUid, avCardMap);
if(pos != KErrNotFound)
{
if(aStorageType==KStorageTypeDateTime)
{
TDateTime result=ContactFieldSet[pos].DateTimeStorage()->Time().DateTime();
//compair the results
if((result.Year() == year) && (result.Month() == (TMonth)month) && (result.Day() == day))
{
SetTestStepResult(EPass);
}
else
{
SetTestStepResult(EFail);
}
}
else
{
value.Set(ContactFieldSet[pos].TextStorage()->Text());
//compair the results
if(aValue.Compare(value)==0 )
{
SetTestStepResult(EPass);
}
else
{
SetTestStepResult(EFail);
}
}
}
CleanupStack::Pop(field);
CleanupStack::PopAndDestroy(item);
}
示例14: DoListStoresLCL
void CNSmlDummyDataProvider_Test::DoListStoresLCL()
{
CDesCArray* store = iCNSmlDummyDataProvider->DoListStoresLC();
TPtrC ptrStoreName = ( *store )[ 0 ];
EUNIT_PRINT( ptrStoreName );
EUNIT_ASSERT( ptrStoreName.Compare( KDefaultDBName ) == 0 );
CleanupStack::PopAndDestroy( store );
}
示例15: SetTimeMode
/**
* Sets the time mode based on the input given
@param aTimeMode time mode of the entry
*/
TCalTime::TTimeMode CTestCalInterimApiSuiteStepBase::SetTimeMode(const TPtrC& aTimeMode)
{
TCalTime::TTimeMode timeMode = TCalTime::EFixedUtc;
if (aTimeMode.Compare(KTimeModeFloating) == 0)
{
timeMode = TCalTime::EFloating;
}
else if (aTimeMode.Compare(KFixedTimeZone) == 0)
{
timeMode = TCalTime::EFixedTimeZone;
}
else
{
timeMode = TCalTime::EFixedUtc;
}
return timeMode;
}