mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsfile.h
author hgs
Fri, 23 Jul 2010 18:35:35 +0800
changeset 35 c4c427c00f31
parent 29 3ae5cb0b4c02
permissions -rw-r--r--
201029_04
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     1
/*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     2
* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     3
* All rights reserved.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     8
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     9
* Initial Contributors:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    11
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    12
* Contributors:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    13
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    14
* Description:  This class reads and writes the file content. 
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    15
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    16
*/
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    17
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    18
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    19
#ifndef DPSFILE_H
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    20
#define DPSFILE_H
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    21
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    22
#include <e32base.h>
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    23
#include <f32file.h>
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    24
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    25
/**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    26
*   This class creates, reads, writes and deletes dps files.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    27
*/
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    28
NONSHARABLE_CLASS(CDpsFile) : public CBase
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    29
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    30
public:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    31
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    32
    * Two-phased constructor.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    33
    * @return An instance of CDpsFile.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    34
    */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    35
    static CDpsFile* NewL();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    36
	
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    37
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    38
    * C++ destructor.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    39
    */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    40
    ~CDpsFile();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    41
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    42
public: 
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    43
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    44
    *   Creates the dps script file
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    45
    *   @param aFileName the script file name
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    46
    *   @param aScript the script file content
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    47
    *   @aFileSize the file size
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    48
    *   @return KErrNone if successful or systme wide error if failed
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    49
    */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    50
    TInt CreateScriptFile(const TDesC& aFileName, const TDesC8& aScript, 
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    51
                          const TInt aFileSize);
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    52
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    53
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    54
    *   Gets the content of the script file
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    55
    *   @param aFileName the file name
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    56
    *   @param aScript the file content. It has the valid content after this 
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    57
    *   call is returned.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    58
    *   @return KErrNone if successful or systme wide error if failed
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    59
    */						  
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    60
    void GetContentL(const TDesC& aFileName, TDes8& aScript);
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    61
	
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    62
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    63
    *   Deletes the file
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    64
    *   @param aFileName the name of the file to be delted.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    65
    *   @return KErrNone if successful or systme wide error if failed
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    66
    */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    67
    TInt Delete(const TDesC& aFileName);
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    68
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    69
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    70
    *   @return RFs& the reference to the file server session, which
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    71
    *   is shared by the whole component (dps engine binary)
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    72
    */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    73
    inline RFs& FileSession();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    74
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    75
    void FileSizeL(const TDesC& aFileName, TInt& aSize);
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    76
	
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    77
private:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    78
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    79
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    80
    *   Second phase constructor
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    81
    */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    82
    void ConstructL();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    83
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    84
private:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    85
    // file server session, owned by this class
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    86
    RFs iFs;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    87
    };
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    88
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    89
#include "dpsfile.inl"
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    90
#endif