email/imap4mtm/imapsession/src/cimapbodystructure.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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 #include "cimapbodystructure.h"
       
    18 
       
    19 #include "cimapenvelope.h"
       
    20 
       
    21 
       
    22 CImapBodyStructure* CImapBodyStructure::NewL()
       
    23 // static method
       
    24 // There is no non-trivial construction required, so no need for a ConstructL()
       
    25 // iRfc822EnvelopeStructure is only constructed when needed.
       
    26 	{
       
    27 	return new(ELeave)CImapBodyStructure;
       
    28 	}
       
    29 
       
    30 CImapBodyStructure::CImapBodyStructure()
       
    31 	{}
       
    32 	
       
    33 CImapBodyStructure::~CImapBodyStructure()
       
    34 	{
       
    35 	iEmbeddedBodyStructureList.ResetAndDestroy();
       
    36 	
       
    37 	iParameterList.Close();
       
    38 	iExtDispositionParameterList.Close();
       
    39 	iExtLanguageList.Close();
       
    40 	
       
    41 	delete iRfc822EnvelopeStructure;
       
    42 	}
       
    43 
       
    44 /**
       
    45 @return The type of this bodystructure
       
    46 */	
       
    47 EXPORT_C CImapBodyStructure::TBodyStructureType CImapBodyStructure::BodyStructureType() const
       
    48 	{
       
    49 	return iBodyStructureType;
       
    50 	}
       
    51 /**
       
    52 Multipart bodystructures can have many sub-parts.
       
    53 Message/RFC822 bodystructures will have a single sub-part.
       
    54 This method gives access to those sub-parts.
       
    55 @return The list of sub-part bodystructures.
       
    56 */
       
    57 EXPORT_C const CImapBodyStructure::RBodyStructureList CImapBodyStructure::EmbeddedBodyStructureList() const
       
    58 	{
       
    59 	return iEmbeddedBodyStructureList;
       
    60 	}
       
    61 
       
    62 /**
       
    63 @return The MIME type for this message part
       
    64 */
       
    65 EXPORT_C const TDesC8& CImapBodyStructure::Type() const
       
    66 	{
       
    67 	return iType;
       
    68 	}
       
    69 /**
       
    70 @return The MIME sub-type for this message part
       
    71 */
       
    72 EXPORT_C const TDesC8& CImapBodyStructure::SubType() const
       
    73 	{
       
    74 	return iSubType;
       
    75 	}
       
    76 
       
    77 /**
       
    78 @return A list of parameter-value pairs, corresponding to a top level "body-fld-param"
       
    79 */	
       
    80 EXPORT_C const CImapBodyStructure::RAttributeValuePairList& CImapBodyStructure::ParameterList() const
       
    81 	{
       
    82 	return iParameterList;
       
    83 	}
       
    84 /**
       
    85 @return The "body-fld-id" field
       
    86 */	
       
    87 EXPORT_C const TDesC8& CImapBodyStructure::BodyId() const
       
    88 	{
       
    89 	return iBodyId;
       
    90 	}
       
    91 /**
       
    92 @return The "body-fld-desc" field
       
    93 */	
       
    94 EXPORT_C const TDesC8& CImapBodyStructure::BodyDescription() const
       
    95 	{
       
    96 	return iBodyDescription;
       
    97 	}
       
    98 /**
       
    99 @return The "body-fld-enc" field
       
   100 */	
       
   101 EXPORT_C const TDesC8& CImapBodyStructure::BodyEncoding() const
       
   102 	{
       
   103 	return iBodyEncoding;
       
   104 	}
       
   105 /**
       
   106 @return The "body-fld-octets" field
       
   107 */	
       
   108 EXPORT_C const TDesC8& CImapBodyStructure::BodySizeOctets() const
       
   109 	{
       
   110 	return iBodySizeOctets;
       
   111 	}
       
   112 /**
       
   113 @return The "body-fld-lines" field
       
   114 */	
       
   115 EXPORT_C const TDesC8& CImapBodyStructure::BodyLines() const
       
   116 	{
       
   117 	return iBodyLines;
       
   118 	}
       
   119 /**
       
   120 @return The "body-fld-md5" field
       
   121 */	
       
   122 EXPORT_C const TDesC8& CImapBodyStructure::ExtMD5() const
       
   123 	{
       
   124 	return iExtMD5;
       
   125 	}
       
   126 /**
       
   127 @return The "string" part the "body-fld-dsp" field
       
   128 */	
       
   129 EXPORT_C const TDesC8& CImapBodyStructure::ExtDispositionName() const
       
   130 	{
       
   131 	return iExtDispositionName;
       
   132 	}
       
   133 /**
       
   134 @return A list of parameter-value pairs, corresponding the "body-fld-param" part of a "body-fld-dsp" field
       
   135 */	
       
   136 EXPORT_C const CImapBodyStructure::RAttributeValuePairList& CImapBodyStructure::ExtDispositionParameterList() const
       
   137 	{
       
   138 	return iExtDispositionParameterList;
       
   139 	}
       
   140 /**
       
   141 @return A list of the strings returned in the "body-fld-lang" field
       
   142 */	
       
   143 EXPORT_C const CImapBodyStructure::RArrayTPtrC8& CImapBodyStructure::ExtLanguageList() const
       
   144 	{
       
   145 	return iExtLanguageList;
       
   146 	}
       
   147 /**
       
   148 @return The "body-fld-loc" field
       
   149 */	
       
   150 EXPORT_C const TDesC8& CImapBodyStructure::ExtLocation() const
       
   151 	{
       
   152 	return iExtLocation;	
       
   153 	}	
       
   154 
       
   155 /**
       
   156 Most CImapBodyStructure objects will not need to store an envelope, as these are only 
       
   157 required by MESSAGE/RFC822.  So this method constructs the envelope on demand.
       
   158 @return The CImapEnvelope object for this class.  An object is constructed if one does not already exist.
       
   159 */
       
   160 EXPORT_C CImapEnvelope& CImapBodyStructure::GetRfc822EnvelopeStructureL()
       
   161 	{
       
   162 	if (iRfc822EnvelopeStructure == NULL)
       
   163 		{
       
   164 		iRfc822EnvelopeStructure = CImapEnvelope::NewL();
       
   165 		}
       
   166 		
       
   167 	return *iRfc822EnvelopeStructure;
       
   168 	}
       
   169 	
       
   170 void CImapBodyStructure::SetBodyStructureType(TBodyStructureType aBodyStructureType)
       
   171 	{
       
   172 	iBodyStructureType = aBodyStructureType;
       
   173 	}
       
   174 void CImapBodyStructure::AppendEmbeddedBodyStructureL(const CImapBodyStructure& aBodyStructure)
       
   175 	{
       
   176 	iEmbeddedBodyStructureList.AppendL(&aBodyStructure);
       
   177 	}
       
   178 	
       
   179 void CImapBodyStructure::SetType(const TDesC8& aType)
       
   180 	{
       
   181 	iType.Set(aType);
       
   182 	}
       
   183 void CImapBodyStructure::SetSubType(const TDesC8& aSubType)
       
   184 	{
       
   185 	iSubType.Set(aSubType);
       
   186 	}
       
   187 	
       
   188 void CImapBodyStructure::AppendParameterListL(const TAttributeValuePair& aAttributeValuePair)
       
   189 	{
       
   190 	iParameterList.AppendL(aAttributeValuePair);
       
   191 	}
       
   192 
       
   193 void CImapBodyStructure::SetBodyId(const TDesC8& aBodyId)
       
   194 	{
       
   195 	iBodyId.Set(aBodyId);
       
   196 	}
       
   197 void CImapBodyStructure::SetBodyDescription(const TDesC8& aBodyDescription)
       
   198 	{
       
   199 	iBodyDescription.Set(aBodyDescription);
       
   200 	}
       
   201 void CImapBodyStructure::SetBodyEncoding(const TDesC8& aBodyEncoding)
       
   202 	{
       
   203 	iBodyEncoding.Set(aBodyEncoding);
       
   204 	}
       
   205 void CImapBodyStructure::SetBodySizeOctets(const TDesC8& aBodySizeOctets)
       
   206 	{
       
   207 	iBodySizeOctets.Set(aBodySizeOctets);
       
   208 	}
       
   209 void CImapBodyStructure::SetBodyLines(const TDesC8& aBodyLines)
       
   210 	{
       
   211 	iBodyLines.Set(aBodyLines);
       
   212 	}
       
   213 
       
   214 void CImapBodyStructure::SetExtMD5(const TDesC8& aExtMD5)
       
   215 	{
       
   216 	iExtMD5.Set(aExtMD5);
       
   217 	}
       
   218 void CImapBodyStructure::SetExtDispositionName(const TDesC8& aExtDispositionName)
       
   219 	{
       
   220 	iExtDispositionName.Set(aExtDispositionName);
       
   221 	}
       
   222 	
       
   223 void CImapBodyStructure::AppendExtDispositionParameterListL(const TAttributeValuePair& aAttributeValuePair)
       
   224 	{
       
   225 	iExtDispositionParameterList.AppendL(aAttributeValuePair);
       
   226 	}
       
   227 
       
   228 void CImapBodyStructure::AppendExtLanguageListL(const TDesC8& aExtLanguage)
       
   229 	{
       
   230 	iExtLanguageList.AppendL(aExtLanguage);
       
   231 	}
       
   232 void CImapBodyStructure::SetExtLocation(const TDesC8& aExtLocation)
       
   233 	{
       
   234 	iExtLocation.Set(aExtLocation);
       
   235 	}