mtpfws/mtpfw/datatypes/interface/rmtptype.h
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2006-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 /**
       
    17  @file
       
    18  @publishedPartner
       
    19  @released
       
    20 */
       
    21 
       
    22 #ifndef RMTPTYPE_H
       
    23 #define RMTPTYPE_H
       
    24 
       
    25 #include <e32std.h>
       
    26 #include <mtp/mmtptype.h>
       
    27 
       
    28 /**
       
    29 Defines a general purpose class for containing, accessing, and manipulating 
       
    30 a reference to any MMTPType derived data type. The data type buffer itself 
       
    31 resides on the heap and is managed by this class.
       
    32 
       
    33 By default all MTP simple (signed and unsigned integer), array (signed and 
       
    34 unsigned integer), and string types are supported. Support for any other data 
       
    35 types can be provided by derived subclasses which provide suitable 
       
    36 implementions of the CreateL and Destroy methods.
       
    37 
       
    38 This class and it's derived subclasses can be freely contained as member 
       
    39 variables within any CBase derived class (typically a CMTPTypeCompoundBase 
       
    40 derived class). When used as a stack variable the class's CleanupClosePushL
       
    41 method should always be used to ensure that the heap storage managed by the 
       
    42 class is correctly deallocated.
       
    43 
       
    44 @publishedPartner
       
    45 @released 
       
    46 */
       
    47 class RMTPType : public MMTPType
       
    48     {
       
    49 public:
       
    50 
       
    51     IMPORT_C RMTPType();    
       
    52     IMPORT_C virtual ~RMTPType();
       
    53     
       
    54     IMPORT_C void CleanupClosePushL();
       
    55     IMPORT_C void Close();
       
    56     IMPORT_C void OpenL(TUint aDataType);
       
    57     
       
    58     IMPORT_C MMTPType& Data();
       
    59     
       
    60     //internal API
       
    61     static MMTPType* AllocL(const TUint aDataType);
       
    62     static void Destroy(const TUint aDataType, MMTPType* aType);
       
    63 public: // From MMTPType
       
    64 
       
    65     IMPORT_C TInt FirstReadChunk(TPtrC8& aChunk) const;
       
    66     IMPORT_C TInt NextReadChunk(TPtrC8& aChunk) const;
       
    67     IMPORT_C TInt FirstWriteChunk(TPtr8& aChunk);
       
    68     IMPORT_C TInt NextWriteChunk(TPtr8& aChunk);
       
    69     IMPORT_C TUint64 Size() const;
       
    70     IMPORT_C TUint Type() const;
       
    71     IMPORT_C TBool CommitRequired() const;
       
    72     IMPORT_C MMTPType* CommitChunkL(TPtr8& aChunk);
       
    73     IMPORT_C TInt Validate() const;
       
    74     
       
    75 protected:
       
    76     
       
    77     IMPORT_C virtual MMTPType* CreateL(TUint aDataType);
       
    78     IMPORT_C virtual void Destroy(MMTPType* aType);
       
    79     
       
    80 private:
       
    81 
       
    82 //   MMTPType* AllocL(TUint aDataType);
       
    83     
       
    84 private: // Owned
       
    85    
       
    86     /**
       
    87     The data type buffer.
       
    88     */
       
    89     MMTPType*   iData;
       
    90     };
       
    91 
       
    92 #endif // RMTPTYPE_H