本文整理汇总了C++中ConfigSection函数的典型用法代码示例。如果您正苦于以下问题:C++ ConfigSection函数的具体用法?C++ ConfigSection怎么用?C++ ConfigSection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigSection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: INFO_PRINTF2
/**
* Function Name : TestFtw4
* Description : ftw for invalid path
* Return Value : ftw returns ENOTDIR
*/
TInt CTestftw::TestFtw4()
{
char parm[PATH_MAX];
int result;
int ret;
int fd=open("c:\\validfile.txt", O_WRONLY|O_CREAT);
if(fd==-1)
{
INFO_PRINTF2(_L("file open fails with error No: %d"), errno);
return KErrGeneral;
}
memset(&parm[0], 0, PATH_MAX);
ReadStringParam(parm);
ret=ftw(parm, &action, 10);
GetIntFromConfig(ConfigSection(), _L("Expected"), result);
if(ret==-1 && errno==result)
{
close(fd);
INFO_PRINTF2(_L("ftw returns error no: %d"), errno);
unlink("c:\\validfile.txt");
return KErrNone;
}
INFO_PRINTF2(_L("ftw fails with error No: %d"), errno);
close(fd);
unlink("c:\\validfile.txt");
return KErrGeneral;
}
示例2: doTestStepL
/**
doTestStepL()
Reads the expected count from the ini file.
Obtains the count of the POP accounts created and compares against the expected number.
@return
Returns the test step result.
*/
TVerdict CT_MsgVerifyPopAccountsCount::doTestStepL()
{
INFO_PRINTF1(_L("Test Step: Verify Pop Accounts Count"));
TInt expectedCount = -1;
if(!GetIntFromConfig(ConfigSection(), KExpectedCount, expectedCount) && expectedCount < 0)
{
ERR_PRINTF1(_L("ExpectedCount is not Specified or < 0"));
SetTestStepResult(EFail);
}
else
{
CEmailAccounts *account = CEmailAccounts::NewLC();
RArray<TPopAccount> arrayPopAccounts;
account->GetPopAccountsL(arrayPopAccounts);
TInt count = arrayPopAccounts.Count();
CleanupStack::PopAndDestroy(account);
arrayPopAccounts.Reset();
if (count != expectedCount)
{
ERR_PRINTF3(_L("Number of POP accounts do not match ! expected = %d actual = %d"),
expectedCount, count);
SetTestStepResult(EFail);
}
else
{
INFO_PRINTF2(_L("Number of POP accounts matched value = %d !"), expectedCount);
}
}
return TestStepResult();
}
示例3: GetStringFromConfig
/**
* Copy the exported file attachments from ROM to RAM drive
*/
void CTestCalInterimApiSuiteStepBase::CopyImportFileToWritableDriveL()
{
CFileMan* fileCopier = CFileMan::NewL(iFsSession);
CleanupStack::PushL(fileCopier);
TPtrC file;
GetStringFromConfig(ConfigSection(), KInitialLocationOfFile, file);
RArray<TPtrC> fileList;
CleanupClosePushL(fileList);
TokenizeStringL(file, fileList);
// Iterate through the file list and copy them from z drive to c drive
for ( TInt i = 0; i < fileList.Count(); i++ )
{
TFileName initialLocationOfFile = fileList[i];
initialLocationOfFile.Insert(0, KOriginalDrive());
// get current time
TTime now;
now.HomeTime();
// clear any read only attribute if the file is present such we avoid errors at copy time
fileCopier->Attribs(fileList[i], 0, KEntryAttReadOnly, now);
User::LeaveIfError(fileCopier->Copy(initialLocationOfFile, fileList[i], CFileMan::EOverWrite|CFileMan::ERecurse));
// clear any read only attribute such we avoid errors at open time (true on real hardware)
User::LeaveIfError(fileCopier->Attribs(fileList[i], 0, KEntryAttReadOnly, now));
}
CleanupStack::PopAndDestroy(&fileList);
CleanupStack::PopAndDestroy(fileCopier);
}
示例4: drive
TVerdict CAddDriveStep::runTestStepL(TBool /*aOomTest*/)
{
TPtrC str;
TInt drive(0);
if (!GetStringFromConfig(ConfigSection(), _L("drive"), str))
{
ERR_PRINTF1(_L("Missing drive setting"));
SetTestStepResult(EFail);
}
else
{
RFs fs;
fs.Connect();
User::LeaveIfError(fs.CharToDrive(str[0], drive));
//iDriveChar = str[0];
fs.Close();
}
RSisRegistryWritableSession registrySession;
User::LeaveIfError(registrySession.Connect());
CleanupClosePushL(registrySession);
registrySession.AddDriveL(drive);
CleanupStack::PopAndDestroy(®istrySession);
return EPass;
}
示例5: GetIntFromConfig
/**
* Deleting the 1000 contact item
* with all new fields
* @return - void
*/
void CTestContactPerformanceStep::DeletePerformanceL()
{
// delete multiple contact item field
CContactItem *readItem = NULL;
//Get the number of contact item from ini file
GetIntFromConfig(ConfigSection(), KNoOfContactItem, iNoOfCI);
for(TInt readContact=0; readContact<iNoOfCI; readContact++)
{
readItem = dBase->ReadContactLC(idArray[readContact]);
CContactItemFieldSet& ContactFieldSet = readItem->CardFields();
for(TInt del=0; del<7; del++)
{
TInt pos = ContactFieldSet.Find(iFieldUid[del], iVcardUid[del]);
if(pos != KErrNotFound)
{
ContactFieldSet.Remove(pos);
SetTestStepResult(EPass);
}
else
{
ERR_PRINTF1(_L("field not deleted"));
SetTestStepResult(EFail);
}
}
CleanupStack::PopAndDestroy(readItem);
}
INFO_PRINTF1(_L("Fields deleted successfully"));
}
示例6: GetIntFromConfig
/** Retrieves numeric id for various time zones
*/
void CTestTZServer::TimeZoneNumericIdL()
{
iField.Zero();
iField.Append(KNumericIds);
GetIntFromConfig(ConfigSection(),iField,iIntNumericId); //gets expected numeric id
RTz tz;
CleanupClosePushL(tz);
User::LeaveIfError(tz.Connect());
CTzId* tzId = NULL;
TRAPD(err,tzId = tz.GetTimeZoneIdL());
TESTL(err == KErrNone);
CleanupStack::PushL(tzId);
TUint tzNumericId = tzId->TimeZoneNumericID();
INFO_PRINTF2(_L("actual : %d"),tzNumericId);
TESTL(tzNumericId == iIntNumericId);
CleanupStack::PopAndDestroy(tzId);
CleanupStack::PopAndDestroy(&tz);
}
示例7: GetIntFromConfig
EXPORT_C enum TVerdict CPerformOCSPStep::doTestStepPreambleL()
{
TInt result = KErrNone;
TBool found = GetIntFromConfig(ConfigSection(), KExpectedValidationResultKey, result);
User::LeaveIfError(iExpectedResults.Append(result));
if (!found)
{
WARN_PRINTF1(_L("Missing Expected result defaulting to KErrNone"));
}
else
{
TBuf<128> mymsg;
mymsg.Format(_L("Expected result: (%d)"), iExpectedResults[0]);
INFO_PRINTF1(mymsg);
}
if (CActiveScheduler::Current() == NULL)
{
INFO_PRINTF1(_L("Installing scheduler"));
iSched = new(ELeave) CActiveScheduler;
CActiveScheduler::Install (iSched);
}
return TestStepResult();
}
示例8: _LIT
/**
* Reads data specified in the ini file and constructs all view validation objects
*/
void CTestContactViewUnderlyingViewUpdateStep::ReadIniAndConstructViewValidationObjectsL()
{
_LIT(KListOfViewsToBeValidated, "ListOfViewsToBeValidated");
TPtrC listOfViewsToBeRemoved;
TESTL(GetStringFromConfig(ConfigSection(), KListOfViewsToBeValidated, listOfViewsToBeRemoved));
RArray<TPtrC> sections;
CleanupClosePushL(sections);
ViewUtilityReference().TokenizeStringL(listOfViewsToBeRemoved, sections);
for ( TInt i = 0; i < sections.Count(); ++i )
{
TViewValidationData ViewValidationData;
_LIT(KContactViewType, "ViewType");
TPtrC contactViewTypeString;
GetStringFromConfig(sections[i], KContactViewType, contactViewTypeString);
ViewValidationData.SetViewType(contactViewTypeString);
_LIT(KContactViewIndex, "ViewIndex");
TInt contactViewIndex;
GetIntFromConfig(sections[i], KContactViewIndex, contactViewIndex);
ViewValidationData.SetViewIndex(contactViewIndex);
_LIT(KUpdatedViewCount, "UpdatedViewCount");
TInt updatedViewCount = 0;
GetIntFromConfig(sections[i], KUpdatedViewCount, updatedViewCount);
ViewValidationData.SetExpectedViewCount(updatedViewCount);
iViewValidationArray.AppendL(ViewValidationData);
}
CleanupStack::PopAndDestroy(§ions);
}
示例9: GetIntFromConfig
void CTPKCS7OOMTest::doTestOOML()
{
TInt OOMTest;
GetIntFromConfig(ConfigSection(),_L("OOMTestNo"),OOMTest);
__UHEAP_MARK;
if (OOMTest == 1)
{
CPKCS7ContentInfo* theTest = NULL;
theTest = CPKCS7ContentInfo::NewL(iRawData->Des());
delete theTest;
}
// Digest Info
else if (OOMTest == 2)
{
CPKCS7DigestInfo* theTest0 = NULL;
theTest0 = CPKCS7DigestInfo::NewL(iRawData->Des());
delete theTest0;
}
// Encrypted Data
else if (OOMTest == 3)
{
CPKCS7ContentInfo* theTest1 = NULL;
theTest1 = CPKCS7ContentInfo::NewL(iRawData->Des());
CleanupStack::PushL(theTest1);
CPKCS7EncryptedDataObject* theTest2 = NULL;
theTest2 = CPKCS7EncryptedDataObject::NewL(*theTest1);
CleanupStack::PopAndDestroy(theTest1);
delete theTest2;
}
__UHEAP_MARKEND;
}
示例10: TestStepResult
// Step 4 Certificate
TVerdict CTPKCS7CertificateTest::doTestStepL()
{
if (TestStepResult() != EPass)
{
return TestStepResult();
}
TBool checkCount;
TInt expectedCount;
checkCount = GetIntFromConfig (ConfigSection(),_L("CertificateCount"), expectedCount);
TInt err;
CPKCS7ContentInfo * contentInfo = NULL;
TRAP (err, contentInfo = CPKCS7ContentInfo::NewL(iRawData->Des()));
if(err == KErrNone)
{
CPKCS7SignedObject * p7 = NULL;
if( contentInfo->ContentType() == 2)
{
TRAP (err, p7 = CPKCS7SignedObject::NewL(*contentInfo));
if (err != KErrNone)
{
SetTestStepResult(EFail);
INFO_PRINTF2(_L("Got %d building PKCS7 object"), err);
}
else
{
CleanupStack::PushL (p7);
const RPointerArray<CPKCS7ExtendedCertificateOrCertificate>& certificates = p7->Certificates();
if (checkCount)
{
if (certificates.Count() != expectedCount)
{
SetTestStepResult(EFail);
INFO_PRINTF3(_L("Expected %d certificates, got %d"), expectedCount, certificates.Count());
}
}
CleanupStack::PopAndDestroy (p7);
}
}
}
else
{
SetTestStepResult(EFail);
}
if (!checkCount && (TestStepResult()==EPass))
{
SetTestStepResult(EInconclusive);
INFO_PRINTF1(_L("No test performed in this step"));
}
return TestStepResult();
}
示例11: INFO_PRINTF1
TVerdict CVerifyServerCertStep::doTestStepL()
{
INFO_PRINTF1(_L("Calling TLS Provider Verify Certificate."));
CX509Certificate* cert = NULL;
TInt err = VerifyServerCertificateL(cert);
delete cert; // don't really need the cert
TInt expectedResult;
if (!GetIntFromConfig(ConfigSection(), KExpectedResult, expectedResult))
{
// failed to get expected result from config file... using KErrNone.
expectedResult = KErrNone;
}
if (err != expectedResult)
{
INFO_PRINTF3(_L("Failed! TLS Provider returned error code %d, expecting %d."),
err, expectedResult);
SetTestStepResult(EFail);
return EFail;
}
else
{
INFO_PRINTF1(_L("Test passed."));
SetTestStepResult(EPass);
}
return TestStepResult();
}
示例12: WriteIntToConfig
/**
Function : RetriveSearchSortResultL
Description : Retrieves the search/sort result
@return : none
*/
void CT_MsgSearchSortByQueryObject::RetriveSearchSortResultL(const TInt aIterationLimit, TMsvSearchSortResultType aResultType)
{
// Get the number of messages satisfying the search/sort request
TInt resultCount = iSharedDataCommon.iSearchSortOperation->GetResultCountL();
WriteIntToConfig(ConfigSection(), KCountOfResult, resultCount);
// Get the search/sort result according to user preference
TMsvId messageId, serviceId;
TMsvEntry messageEntry;
iSharedDataCommon.iSearchSortResultArray.Reset(); // Flush out the existing search/sort result
if (aIterationLimit > 0 && aResultType == EMsvResultAsTMsvId) // Iteration limit is one and result type is TMsvId
{
for(TInt index = 0; index < resultCount; ++index)
{
iSharedDataCommon.iSearchSortOperation->GetNextResultL(messageId);
// Get the corresponding index entry and append the same to array of entries.
iSharedDataCommon.iSession->GetEntry(messageId, serviceId, messageEntry);
iSharedDataCommon.iSearchSortResultArray.Append(messageEntry);
}
}
else if(aIterationLimit > 0 && aResultType == EMsvResultAsTMsvEntry) // Iteration limit is one and result type is TMsvEntry
{
for(TInt index = 0; index < resultCount; ++index)
{
iSharedDataCommon.iSearchSortOperation->GetNextResultL(messageEntry);
iSharedDataCommon.iSearchSortResultArray.Append(messageEntry);
}
}
else if (aIterationLimit == 0 && aResultType == EMsvResultAsTMsvId) // No iteration and result type is TMsvId
{
RArray<TMsvId> idArray;
TRAPD(error, iSharedDataCommon.iSearchSortOperation->GetResultsL(idArray));
if(error == KErrNone)
{
// Get the corresponding index entries and create an array of entries.
for(TInt index = 0; index < idArray.Count(); ++index)
{
iSharedDataCommon.iSession->GetEntry(idArray[index], serviceId, messageEntry);
iSharedDataCommon.iSearchSortResultArray.Append(messageEntry);
}
}
else
{
SetTestStepError(error);
}
}
else // No iteration and result type is TMsvEntry
{
// RArray<TMsvEntry> entryArray;
TRAPD(error, iSharedDataCommon.iSearchSortOperation->GetResultsL(iSharedDataCommon.iSearchSortResultArray));
SetTestStepError(error);
}
// Ensure Number of Entries in iSharedDataCommon.iSearchSortResultArray is same as the result count
if(iSharedDataCommon.iSearchSortResultArray.Count() != resultCount)
{
ERR_PRINTF1(_L("MisMatch in Result count and Entries retrieved"));
ERR_PRINTF3(_L("Search-sort result count= %d Entries retrieved= %d"), resultCount, iSharedDataCommon.iSearchSortResultArray.Count());
SetTestStepResult(EFail);
}
}
示例13: rawDataPtr
HBufC8* CTPKCS7StepBase::readFileL (TPtrC tag)
{
TPtrC fileName;
if (GetStringFromConfig(ConfigSection(), tag, fileName) == EFalse)
{
return NULL;
}
RFile file;
if (file.Open(iFs, fileName, EFileRead) != KErrNone)
{
INFO_PRINTF2(_L("Cannot open file %S for reading"), &fileName);
return NULL;
}
CleanupClosePushL(file);
TInt fileSize = 0;
User::LeaveIfError(file.Size(fileSize));
HBufC8* result = HBufC8::NewL(fileSize);
result->Des().SetLength(fileSize);
TPtr8 rawDataPtr(result->Des());
rawDataPtr.SetLength(fileSize);
file.Read (rawDataPtr);
CleanupStack::PopAndDestroy (&file);
INFO_PRINTF3(_L("Read %d octets from %S"), result->Size(), &fileName);
return result;
}
示例14: INFO_PRINTF1
/**
@SYMTestCaseID PIM-APP-ENGINES-CALINTERIMAPI-CIT-0005-HP
@SYMTestType CIT
@SYMTestPriority Medium
@SYMPREQ 1098
@SYMFssID 3.2.1 005
@SYMTestCaseDesc delete the opened file
@SYMTestActions deletes the opened file
@SYMTestExpectedResults Aganda file is and deleted
*/
void CTestCalInterimApiSuiteStepBase::DeleteCalenderFileL()
{
INFO_PRINTF1(_L("Deleting calender file"));
TRAPD(err, iSession->DeleteCalFileL(iCalenderFileName));
if( err == KErrNone )
{
TBool reCreateCalFile = ETrue;
if (!GetBoolFromConfig(ConfigSection(), KReCreateCalFile, reCreateCalFile))
{
reCreateCalFile = ETrue;
}
if (reCreateCalFile)
{
INFO_PRINTF1(_L("Trying to create the file after deletion"));
TRAPD(err, iSession->CreateCalFileL(iCalenderFileName));
if( err != KErrNone )
{
ERR_PRINTF2(KErrInDeleteCalFileL, err);
SetTestStepResult(EFail);
}
}
}
else
{
ERR_PRINTF2(KErrDeletingCalenderFile, err);
SetTestStepResult(EFail);
}
}
示例15: _LIT
TInt CTestSysunistd::nice_less_than_lowest( )
{
_LIT( KPassed, "Passed" );
_LIT( KFailed, "Failed" );
_LIT( KSetpriority, "In setpriority" );
INFO_PRINTF1( KSetpriority );
int retVal = 0, i;
TInt retrn;
errno = 0;
TInt prio_low_end;
TInt prio_low_start;
_LIT( Kprio_low_start, "Parameter1" );
TBool res = GetIntFromConfig(ConfigSection(), Kprio_low_start, prio_low_start);
if(!res)
{
_LIT(Kerr , "Failed to read first parameter from ini file") ;
INFO_PRINTF1(Kerr) ;
return KErrGeneral ;
}
_LIT( Kprio_low_end, "Parameter2" );
res = GetIntFromConfig(ConfigSection(), Kprio_low_end, prio_low_end);
if(!res)
{
_LIT(Kerr , "Failed to read second parameter from ini file") ;
INFO_PRINTF1(Kerr) ;
return KErrGeneral ;
}
errno = 0;
for (i = prio_low_start; i >= prio_low_end; i--)
{
retVal = nice(i);
if((retVal == -1)&&(errno))
{
INFO_PRINTF1( KFailed );
retrn = KErrGeneral;
}
else
{
INFO_PRINTF1( KPassed );
}
}
retrn = KErrNone;
return retrn ;
}