os/ossrv/lowlevellibsandfws/apputils/multipartparser/src/bodypart.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2005-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 FILES
    17 #include <bafl/bodypart.h>
    18 
    19 // CONSTANTS
    20 
    21 // ============================= LOCAL FUNCTIONS ===============================
    22 
    23 // ============================ MEMBER FUNCTIONS ===============================
    24 
    25 // -----------------------------------------------------------------------------
    26 // CBodyPart::NewL
    27 // Two-phased constructor.
    28 // -----------------------------------------------------------------------------
    29 //
    30 EXPORT_C CBodyPart* CBodyPart::NewL()
    31     {
    32     CBodyPart* self = new (ELeave) CBodyPart();
    33     CleanupStack::PushL(self);
    34     self->ConstructL();
    35     CleanupStack::Pop(); //self
    36 
    37     return self;
    38     }
    39 
    40 // -----------------------------------------------------------------------------
    41 // C++ default constructor.
    42 // -----------------------------------------------------------------------------
    43 CBodyPart::CBodyPart()
    44     {   
    45     iBody.Set( NULL, 0 );
    46     iBoundary.Set( NULL, 0 );
    47     iCharset.Set( NULL, 0 );
    48     iContentBase.Set( NULL, 0 );
    49     iContentLocation.Set( NULL, 0 );
    50     iContentTransferEncoding.Set( NULL, 0 );
    51     iContentType.Set( NULL, 0 );
    52     iContentID.Set( NULL, 0 );
    53     iIsDecodedBody = EFalse;
    54     iUrl = NULL;
    55     }
    56 
    57 // -----------------------------------------------------------------------------
    58 // Symbian 2nd phase constructor
    59 // -----------------------------------------------------------------------------
    60 void CBodyPart::ConstructL() 
    61     {
    62     }
    63 
    64 // -----------------------------------------------------------------------------
    65 // Destructor.
    66 // -----------------------------------------------------------------------------
    67 EXPORT_C CBodyPart::~CBodyPart()
    68     {
    69     if( iIsDecodedBody )
    70         {
    71         delete  (TUint8*) iBody.Ptr();
    72         }
    73 
    74     delete iUrl;
    75     }
    76 
    77 // -----------------------------------------------------------------------------
    78 // return The content-base of this body part
    79 // -----------------------------------------------------------------------------
    80 const TDesC8& CBodyPart::ContentBase()
    81     {
    82     return iContentBase;
    83     }
    84 
    85 // -----------------------------------------------------------------------------
    86 // return The content-location of this body part
    87 // -----------------------------------------------------------------------------
    88 const TDesC8& CBodyPart::ContentLocation()
    89     {
    90     return iContentLocation;
    91     }
    92 
    93 // -----------------------------------------------------------------------------
    94 // return The content-transfer-encoding of this body part
    95 // -----------------------------------------------------------------------------
    96 const TDesC8& CBodyPart::ContentTransferEncoding()
    97     {
    98     return iContentTransferEncoding;
    99     }
   100 
   101 // -----------------------------------------------------------------------------
   102 // return The boundary of this body part
   103 // -----------------------------------------------------------------------------
   104 const TDesC8& CBodyPart::Boundary()
   105     {
   106     return iBoundary;
   107     }
   108 
   109 // -----------------------------------------------------------------------------
   110 // return If the body of the body part is decoded or unzipped
   111 // -----------------------------------------------------------------------------
   112 TBool CBodyPart::IsDecodedBody()
   113     {
   114     return iIsDecodedBody;
   115     }
   116 
   117 // -----------------------------------------------------------------------------
   118 // Set the boundary of the body part
   119 // -----------------------------------------------------------------------------
   120 void CBodyPart::SetBoundary( const TDesC8& aBoundary )
   121     {
   122     iBoundary.Set( aBoundary );
   123     }
   124 
   125 // -----------------------------------------------------------------------------
   126 // Set the charset of the body part
   127 // -----------------------------------------------------------------------------
   128 void CBodyPart::SetCharset( const TDesC8& aCharset )
   129     {
   130     iCharset.Set( aCharset );
   131     }
   132 
   133 // -----------------------------------------------------------------------------
   134 // Set the content-base of the body part
   135 // -----------------------------------------------------------------------------
   136 void CBodyPart::SetContentBase( const TDesC8& aContentBase )
   137     {
   138     iContentBase.Set( aContentBase );
   139     }
   140 
   141 // -----------------------------------------------------------------------------
   142 // Set the content-location of the body part
   143 // -----------------------------------------------------------------------------
   144 void CBodyPart::SetContentLocation( const TDesC8& aContentLocation )
   145     {
   146     iContentLocation.Set( aContentLocation );
   147     }
   148 
   149 // -----------------------------------------------------------------------------
   150 // Set the content-transfer-encoding of the body part
   151 // -----------------------------------------------------------------------------
   152 void CBodyPart::SetContentTransferEncoding( const TDesC8& aContentTransferEncoding )
   153     {
   154     iContentTransferEncoding.Set( aContentTransferEncoding );
   155     }
   156 
   157 // -----------------------------------------------------------------------------
   158 // Set the content-type of the body part
   159 // -----------------------------------------------------------------------------
   160 void CBodyPart::SetContentType( const TDesC8& aContentType )
   161     {
   162     iContentType.Set( aContentType );
   163     }
   164 
   165 // -----------------------------------------------------------------------------
   166 // Set the content-ID of the body part
   167 // -----------------------------------------------------------------------------
   168 void CBodyPart::SetContentID( const TDesC8& aContentID )
   169     {
   170     iContentID.Set( aContentID );
   171     }
   172 
   173 // -----------------------------------------------------------------------------
   174 // Set if the body of the body part is decoded or unzipped
   175 // -----------------------------------------------------------------------------
   176 void CBodyPart::SetIsDecodedBody( TBool aIsDecodedBody )
   177     {
   178     iIsDecodedBody = aIsDecodedBody;
   179     }
   180 
   181 // -----------------------------------------------------------------------------
   182 // Set the URL of the body part
   183 // -----------------------------------------------------------------------------
   184 void CBodyPart::SetUrl( HBufC16* aUrl )
   185     {
   186     iUrl = aUrl;
   187     }
   188 
   189