qtmobility/src/messaging/qmessagecontentcontainer.cpp
changeset 1 2b40d63a9c3d
child 4 90517678cc4f
equal deleted inserted replaced
0:cfcbf08528c4 1:2b40d63a9c3d
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 #include "qmessagecontentcontainer.h"
       
    42 #ifdef Q_OS_SYMBIAN
       
    43 #include "qmessagecontentcontainer_symbian_p.h"
       
    44 #else
       
    45 #include "qmessagecontentcontainer_p.h"
       
    46 #endif
       
    47 
       
    48 QTM_BEGIN_NAMESPACE
       
    49 
       
    50 /*!
       
    51     \class QMessageContentContainer
       
    52     \preliminary
       
    53 
       
    54     \brief The QMessageContentContainer class provides an interface for internet media (MIME) 
       
    55     and Transport Neutral Encapsulation Format (TNEF) content that is possibly only 
       
    56     partially retrieved.
       
    57 
       
    58     \ingroup messaging
       
    59 
       
    60     A QMessageContentContainer object can either directly contain media such as text, 
       
    61     image, audio, video, application or message data, or contain multiple parts of content, 
       
    62     but can not contain both media and multiple parts directly.
       
    63     
       
    64     Container objects can be obtained via their QMessageContentContainerId 
       
    65     identifier, using the find() function of the containing QMessage object.
       
    66     
       
    67     For textual content using a recognized charset encoding textContent() will 
       
    68     return the content as a unicode string.
       
    69     
       
    70     For non-multipart content content() will return the content data after decoding any 
       
    71     transfer encoding used to represent binary data using 7-bit ASCII characters, such as 
       
    72     quoted-printable and base64.
       
    73     
       
    74     The internet media (MIME) type of the container is returned by contentType(),
       
    75     the content subtype is returned by contentSubType(), the content type charset parameter 
       
    76     is returned by contentCharset(), and the content suggested filename by suggestedFileName(). 
       
    77 
       
    78     The type of a container that contains multiple parts of content must be "multipart" (case 
       
    79     insensitive).  A list of identifiers for directly contained parts of content is returned 
       
    80     by contentIds().
       
    81     
       
    82     An indication of the size of the container and its contents on the originating server is 
       
    83     given by size(). If the content is entirely available on the device 
       
    84     isContentAvailable() will return true.
       
    85 
       
    86     Non-multipart content can be serialized to a QDataStream using 
       
    87     writeContentTo(), or to a QTextStream using writeTextContentTo().
       
    88   
       
    89     A container also stores name-value pairs known as header fields. Names are ASCII strings, 
       
    90     while values are charset encoded unicode strings.  A list of the header fields present 
       
    91     in a container is returned by headerFields(). The unicode string values associated 
       
    92     with a particular header field name are returned by headerFieldValues().
       
    93 
       
    94     \sa QMessage, QMessageContentContainerId
       
    95 */
       
    96 
       
    97 /*!
       
    98     \fn QMessageContentContainer::QMessageContentContainer()
       
    99     
       
   100     Constructs an empty container object.
       
   101 */
       
   102 
       
   103 /*!
       
   104     \fn QMessageContentContainer::QMessageContentContainer(const QMessageContentContainer &other)
       
   105 
       
   106     Constructs a copy of \a other.
       
   107 */
       
   108 
       
   109 /*!
       
   110     \internal
       
   111     \fn QMessageContentContainer::operator=(const QMessageContentContainer& other)
       
   112 */
       
   113 
       
   114 /*!
       
   115     \fn QMessageContentContainer::~QMessageContentContainer()
       
   116     
       
   117     Destroys the container object.
       
   118 */
       
   119 
       
   120 /*!
       
   121     \fn QMessageContentContainer::contentType() const
       
   122     
       
   123     Returns the content type of the container. Common types are "text", "image", "audio", 
       
   124     "video", "application", "message" and "multipart".
       
   125 
       
   126     The internet media (MIME) type of the container is "multipart" if the container directly 
       
   127     contains multiple parts rather than directly contains media.
       
   128 
       
   129     \sa contentSubType(), contentCharset()
       
   130 */
       
   131 
       
   132 /*!
       
   133     \fn QMessageContentContainer::contentSubType() const
       
   134     
       
   135     Returns the internet media (MIME) subtype of the content.
       
   136 
       
   137     \sa contentType(), contentCharset()
       
   138 */
       
   139 
       
   140 /*!
       
   141     \fn QMessageContentContainer::contentCharset() const
       
   142     
       
   143     Returns the internet media (MIME) content charset, when defined; 
       
   144     otherwise an empty array is returned.
       
   145 
       
   146     \sa contentType(), contentSubType()
       
   147 */
       
   148 
       
   149 /*!
       
   150     \fn QMessageContentContainer::suggestedFileName() const
       
   151     
       
   152     Returns the suggested filename for the attachment, when defined;
       
   153     otherwise an empty array is returned.
       
   154 
       
   155     The default is an empty array.
       
   156 */
       
   157 
       
   158 /*!
       
   159     \fn QMessageContentContainer::isContentAvailable() const
       
   160     
       
   161     Returns true if the entirety of the content contained is available on the device; 
       
   162     otherwise returns false.
       
   163 */
       
   164 
       
   165 /*!
       
   166     \fn QMessageContentContainer::size() const
       
   167     
       
   168     If the size of the container is known then returns an indication of the size of the container 
       
   169     on the originating server, including contents; otherwise returns 0.
       
   170 */
       
   171 
       
   172 /*!
       
   173     \fn QMessageContentContainer::textContent() const
       
   174     
       
   175     For textual content encoded with a recognized charset, returns the content as a unicode string; 
       
   176     otherwise a null string is returned.
       
   177 */
       
   178 
       
   179 /*!
       
   180     \fn QMessageContentContainer::content() const
       
   181     
       
   182     Return the content after decoding any transfer encoding used to represent binary data 
       
   183     using 7-bit ASCII characters, such as quoted-printable and base64.
       
   184   
       
   185     For textual content any text charset encoding such as Shift-JIS, ISO 2022-JP, KOI8-R, 
       
   186     Windows-1251 etc will not be decoded.
       
   187 
       
   188     \sa textContent()
       
   189 */
       
   190 
       
   191 /*!
       
   192     \fn QMessageContentContainer::writeTextContent(QTextStream& out) const
       
   193     
       
   194     For a non-multipart container, writes the content as returned by textContent() 
       
   195     to the stream \a out; otherwise does nothing.
       
   196 */
       
   197 
       
   198 /*!
       
   199     \fn QMessageContentContainer::writeContent(QDataStream& out) const
       
   200     
       
   201     For a non-multipart container, writes the content as returned by content() 
       
   202     to the stream \a out; otherwise does nothing.
       
   203 */
       
   204 
       
   205 /*!
       
   206     \fn QMessageContentContainer::contentIds() const
       
   207     
       
   208     For a multipart container returns a list of identifiers for all content directly contained by 
       
   209     the container; otherwise returns an empty list.
       
   210 
       
   211     \sa find(), contains()
       
   212 */
       
   213 
       
   214 /*!
       
   215     \fn QMessageContentContainer::find(const QMessageContentContainerId &id) const
       
   216     
       
   217     If the container contains another container with identifier \a id either directly or 
       
   218     recursively, then returns the value of that other container; otherwise returns an 
       
   219     empty container constructed with the default constructor.
       
   220 
       
   221     \sa contains(), contentIds()
       
   222 */
       
   223 
       
   224 /*!
       
   225     \fn bool QMessageContentContainer::contains(const QMessageContentContainerId &id) const;
       
   226     
       
   227     If the container contains content with the identifier \a id, either directly or recursively 
       
   228     then returns true; otherwise returns false.
       
   229 
       
   230     \sa find(), contentIds()
       
   231 */
       
   232 
       
   233 /*!
       
   234     \fn QMessageContentContainer::headerFieldValue(const QByteArray &name) const
       
   235     
       
   236     Returns the value of the first header field of the container with the name \a name, if any;
       
   237     otherwise returns a null string.
       
   238 
       
   239     \sa headerFields(), headerFieldValues()
       
   240 */
       
   241 
       
   242 /*!
       
   243     \fn QMessageContentContainer::headerFieldValues(const QByteArray &name) const
       
   244     
       
   245     Returns a list of values of header fields with the name \a name, if any;
       
   246     otherwise returns an empty list.
       
   247 
       
   248     \sa headerFields(), headerFieldValue()
       
   249 */
       
   250 
       
   251 /*!
       
   252     \fn QMessageContentContainer::headerFields() const
       
   253     
       
   254     Returns a list of names of header fields of the container.
       
   255 
       
   256     \sa headerFieldValue(), headerFieldValues()
       
   257 */
       
   258 
       
   259 QTM_END_NAMESPACE