persistentstorage/store/UFILE/UF_DIR.CPP
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "UF_STD.H"
       
    17 
       
    18 EXPORT_C TUid CDirectFileStore::Layout() const 
       
    19 /** Gets the UID that uniquely identifies this file store as a direct file store.
       
    20 
       
    21 @return KDirectFileStoreLayoutUid. */
       
    22 	{
       
    23 	return KDirectFileStoreLayoutUid;
       
    24 	}
       
    25 
       
    26 EXPORT_C CDirectFileStore::CDirectFileStore(RFile& aFile)
       
    27 //
       
    28 // Constructor creating a new file store.
       
    29 //
       
    30 	: CFileStore(aFile)
       
    31 	{}
       
    32 
       
    33 EXPORT_C CDirectFileStore::CDirectFileStore(RFileBuf& aBuf,const TUidType& aType)
       
    34 //
       
    35 // Constructor opening an existing file store.
       
    36 //
       
    37 	: CFileStore(aBuf,aType)
       
    38 	{}
       
    39 
       
    40 EXPORT_C MStreamBuf* CDirectFileStore::DoReadL(TStreamId anId) const
       
    41 //
       
    42 // Open a stream for reading.
       
    43 //
       
    44 	{
       
    45 	return HDirectStoreBuf::OpenL(Host(),anId,HDirectStoreBuf::ERead);
       
    46 	}
       
    47 
       
    48 EXPORT_C MStreamBuf* CDirectFileStore::DoCreateL(TStreamId& anId)
       
    49 //
       
    50 // Create a new stream and open for both reading and writing.
       
    51 //
       
    52 	{
       
    53 	return HDirectStoreBuf::CreateL(Host(),anId,HDirectStoreBuf::ERead|HDirectStoreBuf::EWrite);
       
    54 	}
       
    55 
       
    56 EXPORT_C void CDirectFileStore::ExternalizeL(RWriteStream& aStream) const
       
    57 //
       
    58 // Externalize this store's structure, consisting of just the root stream id.
       
    59 //
       
    60 	{
       
    61 	aStream<<iRoot;
       
    62 	}
       
    63 
       
    64 EXPORT_C void CDirectFileStore::InternalizeL(RReadStream& aStream)
       
    65 //
       
    66 // Internalize this store's structure, consisting of just the root stream id.
       
    67 //
       
    68 	{
       
    69 	aStream>>iRoot;
       
    70 	}
       
    71 
       
    72 EXPORT_C void CDirectFileStore::DoSetRootL(TStreamId anId)
       
    73 //
       
    74 // Set the root stream id and flag a change to this store's structure.
       
    75 //
       
    76 	{
       
    77 	iRoot=anId;
       
    78 	ChangedL();
       
    79 	}
       
    80 
       
    81 EXPORT_C CFileStore* CDirectFileStore::DoNewL(RFile& aFile)
       
    82 //
       
    83 // Factory function creating a new file.
       
    84 //
       
    85 	{
       
    86 	return new(ELeave) CDirectFileStore(aFile);
       
    87 	}
       
    88