• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

KMIME Library

kmime_header_parsing.h

00001 /*  -*- c++ -*-
00002     kmime_header_parsing.h
00003 
00004     KMime, the KDE internet mail/usenet news message library.
00005     Copyright (c) 2001-2002 Marc Mutz <mutz@kde.org>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #ifndef __KMIME_HEADER_PARSING_H__
00024 #define __KMIME_HEADER_PARSING_H__
00025 
00026 #include <QtCore/QString>
00027 #include <QtCore/QPair>
00028 
00029 #include <kdatetime.h>
00030 
00031 #include "kmime_export.h"
00032 
00033 template <typename K, typename V> class QMap;
00034 class QStringList;
00035 
00036 namespace KMime {
00037 
00038 namespace Types {
00039 
00040 // for when we can't make up our mind what to use...
00041 struct KMIME_EXPORT QStringOrQPair {
00042   QStringOrQPair() : qstring(), qpair( 0, 0 ) {}
00043   QString qstring;
00044   QPair<const char*,int> qpair;
00045 };
00046 
00047 struct KMIME_EXPORT AddrSpec {
00048   QString asString() const;
00050   QString asPrettyString() const;
00051   bool isEmpty() const;
00052   QString localPart;
00053   QString domain;
00054 };
00055 typedef QList<AddrSpec> AddrSpecList;
00056 
00061 class KMIME_EXPORT Mailbox
00062 {
00063   public:
00064     typedef QList<Mailbox> List;
00065 
00070     QByteArray address() const;
00071 
00072     AddrSpec addrSpec() const;
00073 
00077     QString name() const;
00078 
00082     void setAddress( const AddrSpec &addr );
00083 
00087     void setAddress( const QByteArray &addr );
00088 
00092     void setName( const QString &name );
00093 
00097     void setNameFrom7Bit( const QByteArray &name,
00098                           const QByteArray &defaultCharset = QByteArray() );
00099 
00103     bool hasAddress() const;
00104 
00108     bool hasName() const;
00109 
00115     QString prettyAddress() const;
00116 
00120     void fromUnicodeString( const QString &s );
00121 
00125     void from7BitString( const QByteArray &s );
00126 
00132     QByteArray as7BitString( const QByteArray &encCharset ) const;
00133 
00134   private:
00135     QString mDisplayName;
00136     AddrSpec mAddrSpec;
00137 };
00138 
00139 typedef QList<Mailbox> MailboxList;
00140 
00141 struct KMIME_EXPORT Address {
00142   QString displayName;
00143   MailboxList mailboxList;
00144 };
00145 typedef QList<Address> AddressList;
00146 
00147 } // namespace KMime::Types
00148 
00149 namespace HeaderParsing {
00150 
00166 KMIME_EXPORT bool parseEncodedWord( const char* &scursor,
00167                                     const char * const send,
00168                                     QString &result, QByteArray &language,
00169                                     QByteArray &usedCS, const QByteArray &defaultCS = QByteArray(),
00170                                     bool forceCS = false );
00171 
00172 //
00173 // The parsing squad:
00174 //
00175 
00178 KMIME_EXPORT bool parseAtom( const char* &scursor, const char * const send,
00179                              QString &result, bool allow8Bit=false );
00180 
00181 KMIME_EXPORT bool parseAtom( const char* &scursor, const char * const send,
00182                              QPair<const char*,int> &result,
00183                              bool allow8Bit=false );
00184 
00187 KMIME_EXPORT bool parseToken( const char* &scursor, const char * const send,
00188                               QString &result, bool allow8Bit=false );
00189 
00190 KMIME_EXPORT bool parseToken( const char* &scursor, const char * const send,
00191                               QPair<const char*,int> &result,
00192                               bool allow8Bit=false );
00193 
00195 KMIME_EXPORT bool parseGenericQuotedString( const char* &scursor,
00196                                             const char* const send,
00197                                             QString &result, bool isCRLF,
00198                                             const char openChar='"',
00199                                             const char closeChar='"' );
00200 
00202 KMIME_EXPORT bool parseComment( const char* &scursor, const char * const send,
00203                                 QString &result, bool isCRLF=false,
00204                                 bool reallySave=true );
00205 
00221 KMIME_EXPORT bool parsePhrase( const char* &scursor, const char * const send,
00222                                QString &result, bool isCRLF=false );
00223 
00236 KMIME_EXPORT bool parseDotAtom( const char* &scursor, const char * const send,
00237                                 QString &result, bool isCRLF=false );
00238 
00253 KMIME_EXPORT void eatCFWS( const char* &scursor, const char * const send,
00254                            bool isCRLF );
00255 
00256 KMIME_EXPORT bool parseDomain( const char* &scursor, const char * const send,
00257                                QString &result, bool isCRLF=false );
00258 
00259 KMIME_EXPORT bool parseObsRoute( const char* &scursor, const char * const send,
00260                                  QStringList &result, bool isCRLF=false,
00261                                  bool save=false );
00262 
00263 KMIME_EXPORT bool parseAddrSpec( const char* &scursor, const char * const send,
00264                                  Types::AddrSpec &result, bool isCRLF=false );
00265 
00266 KMIME_EXPORT bool parseAngleAddr( const char* &scursor, const char * const send,
00267                                   Types::AddrSpec &result, bool isCRLF=false );
00268 
00285 KMIME_EXPORT bool parseMailbox( const char* &scursor, const char * const send,
00286                                 Types::Mailbox &result, bool isCRLF=false );
00287 
00288 KMIME_EXPORT bool parseGroup( const char* &scursor, const char * const send,
00289                               Types::Address &result, bool isCRLF=false );
00290 
00291 KMIME_EXPORT bool parseAddress( const char* &scursor, const char * const send,
00292                                 Types::Address &result, bool isCRLF=false );
00293 
00294 KMIME_EXPORT bool parseAddressList( const char* &scursor,
00295                                     const char * const send,
00296                                     Types::AddressList &result,
00297                                     bool isCRLF=false );
00298 
00299 KMIME_EXPORT bool parseParameter( const char* &scursor, const char * const send,
00300                                   QPair<QString,Types::QStringOrQPair> &result,
00301                                   bool isCRLF=false );
00302 
00303 KMIME_EXPORT bool parseParameterList( const char* &scursor,
00304                                       const char * const send,
00305                                       QMap<QString,QString> &result,
00306                                       bool isCRLF=false );
00307 
00308 KMIME_EXPORT bool parseRawParameterList( const char* &scursor,
00309                                          const char * const send,
00310                                          QMap<QString,Types::QStringOrQPair> &result,
00311                                          bool isCRLF=false );
00312 
00320 KMIME_EXPORT int parseDigits( const char* &scursor, const char* const send, int &result );
00321 
00322 KMIME_EXPORT bool parseTime( const char* &scursor, const char * const send,
00323                              int &hour, int &min, int &sec,
00324                              long int &secsEastOfGMT,
00325                              bool &timeZoneKnown, bool isCRLF=false );
00326 
00327 KMIME_EXPORT bool parseDateTime( const char* &scursor, const char * const send,
00328                                  KDateTime &result, bool isCRLF=false );
00329 
00330 } // namespace HeaderParsing
00331 
00332 } // namespace KMime
00333 
00334 #endif // __KMIME_HEADER_PARSING_H__
00335 

KMIME Library

Skip menu "KMIME Library"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.6
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal