mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsfile.h
branchRCL_3
changeset 19 0aa8cc770c8a
equal deleted inserted replaced
18:453dfc402455 19:0aa8cc770c8a
       
     1 /*
       
     2 * Copyright (c) 2006, 2007 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:  This class reads and writes the file content. 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DPSFILE_H
       
    20 #define DPSFILE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <f32file.h>
       
    24 
       
    25 /**
       
    26 *   This class creates, reads, writes and deletes dps files.
       
    27 */
       
    28 NONSHARABLE_CLASS(CDpsFile) : public CBase
       
    29     {
       
    30 public:
       
    31     /**
       
    32     * Two-phased constructor.
       
    33     * @return An instance of CDpsFile.
       
    34     */
       
    35     static CDpsFile* NewL();
       
    36 	
       
    37     /**
       
    38     * C++ destructor.
       
    39     */
       
    40     ~CDpsFile();
       
    41 
       
    42 public: 
       
    43     /**
       
    44     *   Creates the dps script file
       
    45     *   @param aFileName the script file name
       
    46     *   @param aScript the script file content
       
    47     *   @aFileSize the file size
       
    48     *   @return KErrNone if successful or systme wide error if failed
       
    49     */
       
    50     TInt CreateScriptFile(const TDesC& aFileName, const TDesC8& aScript, 
       
    51                           const TInt aFileSize);
       
    52 
       
    53     /**
       
    54     *   Gets the content of the script file
       
    55     *   @param aFileName the file name
       
    56     *   @param aScript the file content. It has the valid content after this 
       
    57     *   call is returned.
       
    58     *   @return KErrNone if successful or systme wide error if failed
       
    59     */						  
       
    60     void GetContentL(const TDesC& aFileName, TDes8& aScript);
       
    61 	
       
    62     /**
       
    63     *   Deletes the file
       
    64     *   @param aFileName the name of the file to be delted.
       
    65     *   @return KErrNone if successful or systme wide error if failed
       
    66     */
       
    67     TInt Delete(const TDesC& aFileName);
       
    68     
       
    69     /**
       
    70     *   @return RFs& the reference to the file server session, which
       
    71     *   is shared by the whole component (dps engine binary)
       
    72     */
       
    73     inline RFs& FileSession();
       
    74     
       
    75     void FileSizeL(const TDesC& aFileName, TInt& aSize);
       
    76 	
       
    77 private:
       
    78     
       
    79     /**
       
    80     *   Second phase constructor
       
    81     */
       
    82     void ConstructL();
       
    83     
       
    84 private:
       
    85     // file server session, owned by this class
       
    86     RFs iFs;
       
    87     };
       
    88     
       
    89 #include "dpsfile.inl"
       
    90 #endif