ncdengine/provider/storage/inc/ncdstorage.h
changeset 4 32704c33136d
equal deleted inserted replaced
-1:000000000000 4:32704c33136d
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef M_NCDSTORAGE_H
       
    20 #define M_NCDSTORAGE_H
       
    21 
       
    22 
       
    23 class MNcdDatabaseStorage;
       
    24 class MNcdFileStorage;
       
    25 class RFs;
       
    26 
       
    27 /**
       
    28  *  Storage interface
       
    29  *
       
    30  *  A storage can contain several databases and file storages (directories)
       
    31  *
       
    32  *
       
    33  */
       
    34 class MNcdStorage
       
    35     {
       
    36 public:
       
    37 
       
    38     /**
       
    39      * Database storage getter
       
    40      *
       
    41      * Creates the database if it doesn't already exist.
       
    42      *
       
    43      * @param aUid UID of the database
       
    44      * @return Reference to the database     
       
    45      * @throw KErrArgument if the name was empty
       
    46      */     
       
    47     virtual MNcdDatabaseStorage& DatabaseStorageL( const TDesC& aUid ) = 0;
       
    48 
       
    49 
       
    50     /**
       
    51      * File storage getter
       
    52      *
       
    53      * Creates the file storage if it doesn't already exist.
       
    54      *
       
    55      * @param aUid UID of the file storage
       
    56      * @return Reference to the file storage
       
    57      * @throw KErrArgument if the name was empty
       
    58      */     
       
    59     virtual MNcdFileStorage& FileStorageL( const TDesC& aUid ) = 0;
       
    60 
       
    61 
       
    62     /**
       
    63      * Storage namespace getter
       
    64      *
       
    65      * @return Storage namespace
       
    66      */
       
    67     virtual const TDesC& Namespace() const = 0;
       
    68 
       
    69 
       
    70     /**
       
    71      * Storage subdirectory getter
       
    72      *
       
    73      * @return Storage directory
       
    74      * @note Directory is the namespace that is encoded to ensure
       
    75      * compatibility with the filesystem
       
    76      */
       
    77     virtual const TDesC& Directory() const = 0;
       
    78     
       
    79     
       
    80     /**
       
    81      * File session getter
       
    82      *
       
    83      * @return File session
       
    84      */
       
    85     virtual RFs& FileSession() = 0;    
       
    86     
       
    87     
       
    88      /**
       
    89       * Storage size getter
       
    90       *
       
    91       * Returns the combined size of all databases and filestorages in
       
    92       * this namespace.
       
    93       *
       
    94       * @return Storage size in bytes
       
    95       */
       
    96      virtual TInt SizeL() = 0;
       
    97     
       
    98     
       
    99 protected:
       
   100 
       
   101     virtual ~MNcdStorage()
       
   102         {
       
   103         }
       
   104     };
       
   105 
       
   106 
       
   107 #endif // M_NCDSTORAGE_H