本文整理汇总了C++中CFileStore类的典型用法代码示例。如果您正苦于以下问题:C++ CFileStore类的具体用法?C++ CFileStore怎么用?C++ CFileStore使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFileStore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RetrievePackagesL
void CMsvSendExe::RetrievePackagesL()
{
//open the filestore
CFileStore* store = CDirectFileStore::FromLC(iTaskFile);//pushes store
RStoreReadStream instream;
instream.OpenLC(*store,store->Root());//pushes instream
//get task count
TInt taskCount = instream.ReadInt32L();
SCHSENDLOG(FLog(iFileName, _L("\tTask Count=%d"), taskCount));
for (TInt curTask = 0; curTask < taskCount; curTask++)
{
CScheduledTask* task = CScheduledTask::NewLC(instream);
AddPackageL(*task);
CleanupStack::PopAndDestroy(task);
}
CleanupStack::PopAndDestroy(2, store);
}
示例2: ptr
TInt CSecMgrStore::ReadCounter(TExecutableID& aExecID)
{
HBufC *configFile = HBufC::NewLC(KMaxName);
TPtr ptr(configFile->Des());
TInt ret(GetConfigFile (ptr));
if ( KErrNone==ret)
{
if ( !BaflUtils::FileExists(iFsSession,*configFile))
{
aExecID = (TExecutableID)KCRUIdSecMgr.iUid;
BaflUtils::EnsurePathExistsL (iFsSession, *configFile);
CleanupStack::PopAndDestroy (configFile);
return WriteCounter (aExecID);
}
CFileStore* store = CPermanentFileStore::OpenLC (iFsSession,
*configFile, EFileRead);
RStoreReadStream instream;
instream.OpenLC (*store, store->Root ());
aExecID = instream.ReadInt32L ();
CleanupStack::PopAndDestroy (&instream);
CleanupStack::PopAndDestroy (store);
}
CleanupStack::PopAndDestroy (configFile);
return ret;
}
示例3: doInternalizeL
LOCAL_C void doInternalizeL(const TDesC& aName)
{
TParse filestorename;
fsSession.Parse(aName,filestorename);
// construct file store object - specifying the file
// containing the store.
CFileStore* store = CDirectFileStore::OpenLC(fsSession,filestorename.FullName(),EFileRead);
// Construct a CCompound object
// from the root stream created earlier.
CCompound* thecompound = CCompound::NewL(*store,store->Root());
// Show contents of the CCompound object (and its
// components)
_LIT(KTxtRestoredContent,"... Restored CCompound content.");
doShow(KTxtRestoredContent,*thecompound);
// destroy the store object (this also closes the file
// containing the store)
CleanupStack::PopAndDestroy();
// Now destroy the CCompound object
delete thecompound;
}
示例4: doDeferredLoadingL
LOCAL_C void doDeferredLoadingL(const TDesC& aName)
{
TParse filestorename;
fsSession.Parse(aName,filestorename);
// construct file store object - specifying the file
// containing the store.
CFileStore* store = CPermanentFileStore::OpenLC(fsSession,filestorename.FullName(),EFileRead);
// Construct an object of type CCompound.
// The loading of its components is deferred
// until needed.
CCompound* thecompound = CCompound::NewLC(*store,store->Root());
// Display component A.
// The component is loaded in from the
// stream if not already loaded.
_LIT(KTxtFirstDisplay," (first display)");
thecompound->DisplayAL(KTxtFirstDisplay);
// Re-Display component A
// The component should now be in memory.
_LIT(KTxtSecondDisplay," (second display)");
thecompound->DisplayAL(KTxtSecondDisplay);
console->Printf(KTxtNewLine);
// Destroy:
// 1. the CCompound object
// 2. the store object (this also closes
// the file containing the store)
// Remove both from the cleanup stack
CleanupStack::PopAndDestroy(2);
}
示例5: __ASSERT
//SYMBIAN_REMOVE_TRIVIAL_ENCRYPTION version of the method.
EXPORT_C void CDbFileStoreDatabase::CreateL(const TDesC& aName, TDbFormat::TCreate aMode,
const TUidType& aType)
{
__ASSERT(!iName); // check construction phase
//
iName=aName.AllocL();
CFileStore* store;
switch (aMode)
{
default:
__LEAVE(KErrNotSupported);
case TDbFormat::ECreate:
store=CPermanentFileStore::CreateL(iFs,aName,EFileRead|EFileWrite);
break;
case TDbFormat::EReplace:
store=CPermanentFileStore::ReplaceL(iFs,aName,EFileRead|EFileWrite);
break;
};
iStore=store;
iDelete=ETrue; // cleanup fully in case of failure
store->SetTypeL(aType);
store->SetRootL(CreateRootL(CDbStoreDatabase::ConstructL()));
store->CommitL();
iDelete=EFalse; // file is now good
}
示例6: privateDirptr
void CSecMgrStore::RestorePoliciesL(RPolicies& aPolicy)
{
//Fetch all the individual policy files from "epoc32\winscw\c\private\<SECMGR_UID>\policy" directory
//Iteratively internalise the policy files, with the policyID (PolicyID is = to filename)
HBufC *privateDir = HBufC::NewLC(KMaxName);
TPtr privateDirptr(privateDir->Des());
GetPolicyPath (privateDirptr);
// create search string
HBufC* searchBuf = privateDirptr.AllocLC ();
TPtr searchPtr(searchBuf->Des());
CDir* dir= NULL;
iFsSession.GetDir (searchPtr, KEntryAttNormal,
ESortByName | EAscending, dir);
if ( dir)
{
CleanupStack::PushL (dir);
for (TInt i=0; i!=dir->Count ();++i)
{
TEntry entry = dir->operator[] (i);
HBufC *fileName = HBufC::NewLC(KMaxName);
TPtr ptr(fileName->Des());
ptr = entry.iName;
HBufC *policyFile = HBufC::NewLC(KMaxName);
TPtr policyFileptr(policyFile->Des());
policyFileptr.Copy(privateDirptr) ;
policyFileptr.Append (ptr);
CFileStore* store = CPermanentFileStore::OpenLC (iFsSession,
policyFileptr, EFileShareAny);
RStoreReadStream instream;
instream.OpenLC (*store, store->Root ());
TLex16 lexer(ptr);
TPolicyID pID;
lexer.Val (pID);
CPolicy* policy = CPolicy::NewL (pID, instream);
aPolicy.Append (policy);
CleanupStack::PopAndDestroy (&instream); //instream
CleanupStack::PopAndDestroy (store); //store
CleanupStack::PopAndDestroy (policyFile);
CleanupStack::PopAndDestroy (fileName);
}
CleanupStack::PopAndDestroy (dir);
}
CleanupStack::PopAndDestroy (searchBuf);
CleanupStack::PopAndDestroy (privateDir);
}
示例7: DoReadRootStreamL
void CApaProcess::DoReadRootStreamL(CStreamDictionary& aStreamDictionary, const CFileStore& aStore)
{ // static
const TStreamId rootStreamId=aStore.Root();
if ((aStore.Type()[1] != KUidAppDllDoc) || (rootStreamId == KNullStreamId))
User::Leave(KErrCorrupt);
RStoreReadStream rootStream;
rootStream.OpenLC(aStore, rootStreamId);
rootStream >> aStreamDictionary;
CleanupStack::PopAndDestroy(&rootStream);
}
示例8: SetTypeL
/**
@SYMTestCaseID SYSLIB-STORE-CT-4007
@SYMTestCaseDesc CDirectFileStore::ReplaceLC() and SetTypeL() performance test
@SYMTestPriority High
@SYMTestActions Creates new CDirectFileStore object and measures the time of the operation.
@SYMTestExpectedResults Tests set type time
@SYMCR ATHE-7CQP8H
*/
void CreateDirectFileStoreTestL()
{
(void)TheFs.Delete(TheTestFile);
TUint32 fc = User::FastCounter();
CFileStore* store = CDirectFileStore::ReplaceLC(TheFs, TheTestFile, EFileWrite | EFileRead);
// Must say what kind of file store
// SetTypeL() calls RFileBuf::EndL() which used to call RFile::Size()
store->SetTypeL(KDirectFileStoreLayoutUid);
TUint32 time = CalcTickDiff(fc, User::FastCounter());
CleanupStack::PopAndDestroy(store);
PrintFcDiffAsUs(_L("### CDirectFileStore::ReplaceLC() & SetTypeL(), Time=%d us\r\n"), time);
}
示例9: doMakeAndExternalizeL
LOCAL_C void doMakeAndExternalizeL(const TDesC& aName)
{
TParse filestorename;
fsSession.Parse(aName,filestorename);
// construct file store object - the file to contain the
// the store replaces any existing file of the same name.
CFileStore* store = CPermanentFileStore::ReplaceLC(fsSession,filestorename.FullName(),EFileWrite);
// Must say what kind of file store
store->SetTypeL(KPermanentFileStoreLayoutUid);
// Construct an object of type CCompound ...
CCompound* thecompound = CCompound::NewLC(*store);
// ... and put some data into it.
// Note that "iA->" achieves the same
// as "iA->AsPtr()->"
_LIT(KTxtClassAText,"CClassA text");
_LIT(KTxtClassBText,"CClassB text");
thecompound->iA.AsPtr()->iBufferA = KTxtClassAText;
thecompound->iA.AsPtr()->iXA = -1;
thecompound->iA->iYA = 2; // see note above
thecompound->iB.AsPtr()->iBufferB = KTxtClassBText;
thecompound->iC.AsPtr()->iZC = 3.456;
// Show contents of the CCompound object (and its
// components).
_LIT(KTxtInitialContent,"... Initial content of CCompound");
doShowAll(KTxtInitialContent,*thecompound);
// stores all components as separate streams and
// then streams the store map
TStreamId id = thecompound->StoreL();
// Set the stream id as the root
store->SetRootL(id);
// Commit changes to the store
store->CommitL();
// Destroy:
// 1. the CCompound object
// 2. the store object (this also closes
// the file containing the store)
// Remove both from the cleanup stack
CleanupStack::PopAndDestroy(2);
}
示例10: doMakeAndExternalizeL
LOCAL_C void doMakeAndExternalizeL(const TDesC& aName)
{
TParse filestorename;
fsSession.Parse(aName,filestorename);
// construct file store object - the file to contain the
// the store replaces any existing file of the same name.
CFileStore* store = CDirectFileStore::ReplaceLC(fsSession,filestorename.FullName(),EFileWrite);
// Must say what kind of file store
store->SetTypeL(KDirectFileStoreLayoutUid);
// Construct an object of type CCompound
// and put some data into it.
CCompound* thecompound = CCompound::NewLC();
_LIT(KTxtClassAText,"CClassA text");
_LIT(KTxtClassBText,"CClassB text");
thecompound->iCa->iBufferA = KTxtClassAText;
thecompound->iCa->iXA = -1;
thecompound->iCa->iYA = 2;
thecompound->iCb->iBufferB = KTxtClassBText;
thecompound->iTc.iZC = 3.456;
// Show contents of the CCompound object (and its
// components)
_LIT(KTxtInitialContent,"... Initial content of CCompound");
doShow(KTxtInitialContent,*thecompound);
// Store the compound object to a single stream
// and save the stream id as the root id.
TStreamId id = thecompound->StoreL(*store);
// Set the stream id as the root
store->SetRootL(id);
// Commit changes to the store
store->CommitL();
// Destroy:
// 1. the CCompound object
// 2. the store object (this also closes
// the file containing the store)
// Remove both from the cleanup stack
CleanupStack::PopAndDestroy(2);
}
示例11: TEST
/**
Auxiliary Fn for Test Case ID T-StreamStep-TestPrintSetupL,
T-StreamStep-TestModelRestoreL,
T-StreamStep-TestHeaderFooterL.\n
This function tests Picture persistance.\n
Copies the aOriginal CPrintSetup object to the store and restores to the aCopy object\n
*/
void CT_StreamStep::TestStoreRestoreL(CPrintSetup* aCopy, CPrintSetup* aOriginal)
{
// set up the store
RFile theFile;
TInt ret=theFile.Replace(iFs,_L("c:\\tprint.tst"),EFileRead|EFileWrite);
TEST(ret==KErrNone);
CFileStore* theStore;
theStore=CDirectFileStore::NewLC(theFile); // Creates concrete store over the file.
theStore->SetTypeL(TUidType(KDirectFileStoreLayoutUid,KNullUid,KNullUid));
//
// store the original
TStreamId id=0;
TRAP(ret,id=aOriginal->StoreL(*theStore));
TEST(ret==KErrNone);
//
// restore into the copy
TRAP(ret,aCopy->RestoreL(*theStore,id));
TEST(ret==KErrNone);
//
// tidy up
CleanupStack::PopAndDestroy(); // theStore
iFs.Delete(_L("c:\\tprint.tst"));
}
示例12: GetSampleVersitL
void CVersitTest::StreamLC(RReadStream& aStream)
{
GetSampleVersitL();
RFs fsSession;
User::LeaveIfError(fsSession.Connect());
CFileStore* store = CDirectFileStore::ReplaceLC(fsSession,_L("c:\\TTVersitIn"),EFileWrite);
store->SetTypeL(KDirectFileStoreLayoutUid);
RStoreWriteStream outstream;
TStreamId id = outstream.CreateLC(*store);
TInt length=iVersit.Length();
for (TInt ii=0; ii<length; ii++)
outstream.WriteInt8L(iVersit[ii]);
outstream.CommitL();
CleanupStack::PopAndDestroy();
store->SetRootL(id);
store->CommitL();
CleanupStack::PopAndDestroy(); // store
store = CDirectFileStore::OpenLC(fsSession,_L("c:\\TTVersitIn"),EFileRead); //retrieve stream
RStoreReadStream instream;
instream.OpenLC(*store,store->Root());
CleanupStack::Pop(); // instream
aStream=RReadStream(instream);
}
示例13: CMtmDllInfoArray
EXPORT_C void CMsvTestUtils::CreateServerMtmRegL(const TUid aMsgType, const TDesC& aHumanReadableName, const TMsvTestDllInfo& aServerMtm, const TMsvTestDllInfo& aClientMtm, const TMsvTestDllInfo& aUiMtm, const TMsvTestDllInfo& aUiDataMtm, const TUid aGroup, const TDesC& aDatFile)
{
CMtmDllInfoArray* mtmdllinfoarray=new(ELeave) CMtmDllInfoArray();
CleanupStack::PushL(mtmdllinfoarray);
CMtmDllInfo* mtmdllinfo1=CMtmDllInfo::NewL(aHumanReadableName,TUidType(KDynamicLibraryUid,KUidMtmServerComponent,TUid::Uid(KUidMtmDefaultSpecificVal)),aServerMtm.iFileName,aServerMtm.iOrdinal,aServerMtm.iVersion);
mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo1);
CMtmDllInfo* mtmdllinfo2=CMtmDllInfo::NewL(aHumanReadableName,TUidType(KDynamicLibraryUid,KUidMtmClientComponent,TUid::Uid(KUidMtmDefaultSpecificVal)),aClientMtm.iFileName,aClientMtm.iOrdinal,aClientMtm.iVersion);
mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo2);
CMtmDllInfo* mtmdllinfo3=CMtmDllInfo::NewL(aHumanReadableName,TUidType(KDynamicLibraryUid,KUidMtmUiComponent,TUid::Uid(KUidMtmDefaultSpecificVal)),aUiMtm.iFileName,aUiMtm.iOrdinal,aUiMtm.iVersion);
mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo3);
CMtmDllInfo* mtmdllinfo4=CMtmDllInfo::NewL(aHumanReadableName,TUidType(KDynamicLibraryUid,KUidMtmUiDataComponent,TUid::Uid(KUidMtmDefaultSpecificVal)),aUiDataMtm.iFileName,aUiDataMtm.iOrdinal,aUiDataMtm.iVersion);
mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo4);
// Create an empty capability set for creating a new group data object
TCapabilitySet capSet;
capSet.SetEmpty();
CleanupStack::Pop(mtmdllinfoarray); // next line takes ownership
CMtmGroupData* mtmgroupdata=CMtmGroupData::NewL(aMsgType, aGroup, mtmdllinfoarray, capSet);
CleanupStack::PushL(mtmgroupdata);
CFileStore* filestore = CPermanentFileStore::ReplaceLC(FileSession(), aDatFile, EFileShareExclusive|EFileStream|EFileWrite);
TUidType uidtype(KPermanentFileStoreLayoutUid, KUidMsvDataComponent, aMsgType);
filestore->SetTypeL(uidtype);
RStoreWriteStream out;
TStreamId streamid=out.CreateLC(*filestore); // Push to stack
mtmgroupdata->ExternalizeL(out);
out.CommitL();
CleanupStack::PopAndDestroy(); // out
filestore->SetRootL(streamid);
filestore->CommitL();
CleanupStack::PopAndDestroy(2, mtmgroupdata); // filestore, mtmgroupdata
}
示例14: StreamInL
void CVersitTest::StreamInL()
//Convert the iVersit into stream format, save it as "TTVersitIn"
//and internalize it as a CVersitParser
{
RFs fsSession;
User::LeaveIfError(fsSession.Connect());
CFileStore* store = CDirectFileStore::ReplaceLC(fsSession,_L("c:\\TTVersit2"),EFileWrite);
store->SetTypeL(KDirectFileStoreLayoutUid);
RStoreWriteStream outstream;
TStreamId id = outstream.CreateLC(*store);
TInt length=iVersit.Length();
for (TInt ii=0; ii<length; ii++)
outstream.WriteInt8L(iVersit[ii]);
outstream.CommitL();
CleanupStack::PopAndDestroy();
store->SetRootL(id);
store->CommitL();
CleanupStack::PopAndDestroy();
store = CDirectFileStore::OpenLC(fsSession,_L("c:\\TTVersit2"),EFileRead); //retrieve stream
RStoreReadStream instream;
instream.OpenLC(*store,store->Root());
iParser->InternalizeL(instream);
CleanupStack::PopAndDestroy(2); //store + stream
}
示例15: TestUiMtmLoadPanicL
LOCAL_C void TestUiMtmLoadPanicL()
{
// Make sure the server is closed
CMsgsTestUtils::WaitForServerClose();
User::After(500000);
TChar driveChar= theUtils->FileSession().GetSystemDriveChar();
TBuf<2> systemDrive;
systemDrive.Append(driveChar);
systemDrive.Append(KDriveDelimiter);
TPath pathName(systemDrive);
pathName.Append(KDefaultRegistryFileStoreName);
theUtils->FileSession().Delete(pathName);
CMtmDllInfoArray* mtmdllinfoarray=new(ELeave) CMtmDllInfoArray();
CleanupStack::PushL(mtmdllinfoarray);
// Create library info with silly imports
CMtmDllInfo* mtmdllinfo=CMtmDllInfo::NewL(KMtmName, TUidType(KDynamicLibraryUid, KUidMtmServerComponent, TUid::Uid(KUidMtmDefaultSpecificVal)),KMtmDllName,1,TVersion(2,0,0));
mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo);
mtmdllinfo=CMtmDllInfo::NewL(KMtmName, TUidType(KDynamicLibraryUid, KUidMtmClientComponent, TUid::Uid(KUidMtmDefaultSpecificVal)),KMtmDllName,1,TVersion(2,0,0));
mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo);
mtmdllinfo=CMtmDllInfo::NewL(KMtmName, TUidType(KDynamicLibraryUid, KUidMtmUiComponent, TUid::Uid(KUidMtmDefaultSpecificVal)),KMtmDllName,345,TVersion(2,0,0));
mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo);
mtmdllinfo=CMtmDllInfo::NewL(KMtmName, TUidType(KDynamicLibraryUid, KUidMtmUiDataComponent, TUid::Uid(KUidMtmDefaultSpecificVal)),KMtmDllName,456,TVersion(2,0,0));
mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo);
TCapabilitySet capSet;
capSet.SetEmpty();
CleanupStack::Pop(mtmdllinfoarray); // next line takes ownership
CMtmGroupData* mtmgroupdata=CMtmGroupData::NewL(KUidTestMtm, KUidTestMtm, mtmdllinfoarray, capSet);
CleanupStack::PushL(mtmgroupdata);
CFileStore* filestore = CPermanentFileStore::ReplaceLC(theUtils->FileSession(), KMtmDataFile, EFileShareExclusive|EFileStream|EFileWrite);
TUidType uidtype(KPermanentFileStoreLayoutUid,KUidMsvDataComponent, KUidTestMtm);
filestore->SetTypeL(uidtype);
RStoreWriteStream out;
TStreamId streamid=out.CreateLC(*filestore); // Push to stack
mtmgroupdata->ExternalizeL(out);
out.CommitL();
CleanupStack::PopAndDestroy(); // out
filestore->SetRootL(streamid);
filestore->CommitL();
CleanupStack::PopAndDestroy(2, mtmgroupdata); // filestore, mtmgroupdata
CDummyObserver* ob = new(ELeave)CDummyObserver;
CleanupStack::PushL(ob);
CMsvSession* session = CMsvSession::OpenSyncL(*ob);
CleanupStack::PushL(session);
TInt err = session->InstallMtmGroup(KMtmDataFile);
test(err == KErrNone || err == KErrAlreadyExists);
CClientMtmRegistry* clientReg = CClientMtmRegistry::NewL(*session);
CleanupStack::PushL(clientReg);
CBaseMtm* client = NULL;
client = clientReg->NewMtmL(KUidTestMtm);
CleanupStack::PushL(client);
CMtmUiRegistry* uiReg = CMtmUiRegistry::NewL(*session);
CleanupStack::PushL(uiReg);
if (client !=NULL)
{
TRAPD(error, uiReg->NewMtmUiL(*client));
test(error == KErrBadLibraryEntryPoint);
}
CleanupStack::PopAndDestroy(5); // uiReg, client, clientReg, session, ob
}