• Skip to content
  • Skip to link menu
KDE 4.0 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;
00049   bool isEmpty() const;
00050   QString localPart;
00051   QString domain;
00052 };
00053 typedef QList<AddrSpec> AddrSpecList;
00054 
00059 class KMIME_EXPORT Mailbox
00060 {
00061   public:
00062     typedef QList<Mailbox> List;
00063 
00068     QByteArray address() const;
00069 
00070     AddrSpec addrSpec() const;
00071 
00075     QString name() const;
00076 
00080     void setAddress( const AddrSpec &addr );
00081 
00085     void setAddress( const QByteArray &addr );
00086 
00090     void setName( const QString &name );
00091 
00095     void setNameFrom7Bit( const QByteArray &name,
00096                           const QByteArray &defaultCharset = QByteArray() );
00097 
00101     bool hasAddress() const;
00102 
00106     bool hasName() const;
00107 
00113     QString prettyAddress() const;
00114 
00118     void fromUnicodeString( const QString &s );
00119 
00123     void from7BitString( const QByteArray &s );
00124 
00130     QByteArray as7BitString( const QByteArray &encCharset ) const;
00131 
00132   private:
00133     QString mDisplayName;
00134     AddrSpec mAddrSpec;
00135 };
00136 
00137 typedef QList<Mailbox> MailboxList;
00138 
00139 struct KMIME_EXPORT Address {
00140   QString displayName;
00141   MailboxList mailboxList;
00142 };
00143 typedef QList<Address> AddressList;
00144 
00145 } // namespace KMime::Types
00146 
00147 namespace HeaderParsing {
00148 
00164 KMIME_EXPORT bool parseEncodedWord( const char* &scursor,
00165                                     const char * const send,
00166                                     QString &result, QByteArray &language,
00167                                     QByteArray &usedCS, const QByteArray &defaultCS = QByteArray(),
00168                                     bool forceCS = false );
00169 
00170 //
00171 // The parsing squad:
00172 //
00173 
00176 KMIME_EXPORT bool parseAtom( const char* &scursor, const char * const send,
00177                              QString &result, bool allow8Bit=false );
00178 
00179 KMIME_EXPORT bool parseAtom( const char* &scursor, const char * const send,
00180                              QPair<const char*,int> &result,
00181                              bool allow8Bit=false );
00182 
00185 KMIME_EXPORT bool parseToken( const char* &scursor, const char * const send,
00186                               QString &result, bool allow8Bit=false );
00187 
00188 KMIME_EXPORT bool parseToken( const char* &scursor, const char * const send,
00189                               QPair<const char*,int> &result,
00190                               bool allow8Bit=false );
00191 
00193 KMIME_EXPORT bool parseGenericQuotedString( const char* &scursor,
00194                                             const char* const send,
00195                                             QString &result, bool isCRLF,
00196                                             const char openChar='"',
00197                                             const char closeChar='"' );
00198 
00200 KMIME_EXPORT bool parseComment( const char* &scursor, const char * const send,
00201                                 QString &result, bool isCRLF=false,
00202                                 bool reallySave=true );
00203 
00219 KMIME_EXPORT bool parsePhrase( const char* &scursor, const char * const send,
00220                                QString &result, bool isCRLF=false );
00221 
00234 KMIME_EXPORT bool parseDotAtom( const char* &scursor, const char * const send,
00235                                 QString &result, bool isCRLF=false );
00236 
00251 KMIME_EXPORT void eatCFWS( const char* &scursor, const char * const send,
00252                            bool isCRLF );
00253 
00254 KMIME_EXPORT bool parseDomain( const char* &scursor, const char * const send,
00255                                QString &result, bool isCRLF=false );
00256 
00257 KMIME_EXPORT bool parseObsRoute( const char* &scursor, const char * const send,
00258                                  QStringList &result, bool isCRLF=false,
00259                                  bool save=false );
00260 
00261 KMIME_EXPORT bool parseAddrSpec( const char* &scursor, const char * const send,
00262                                  Types::AddrSpec &result, bool isCRLF=false );
00263 
00264 KMIME_EXPORT bool parseAngleAddr( const char* &scursor, const char * const send,
00265                                   Types::AddrSpec &result, bool isCRLF=false );
00266 
00283 KMIME_EXPORT bool parseMailbox( const char* &scursor, const char * const send,
00284                                 Types::Mailbox &result, bool isCRLF=false );
00285 
00286 KMIME_EXPORT bool parseGroup( const char* &scursor, const char * const send,
00287                               Types::Address &result, bool isCRLF=false );
00288 
00289 KMIME_EXPORT bool parseAddress( const char* &scursor, const char * const send,
00290                                 Types::Address &result, bool isCRLF=false );
00291 
00292 KMIME_EXPORT bool parseAddressList( const char* &scursor,
00293                                     const char * const send,
00294                                     Types::AddressList &result,
00295                                     bool isCRLF=false );
00296 
00297 KMIME_EXPORT bool parseParameter( const char* &scursor, const char * const send,
00298                                   QPair<QString,Types::QStringOrQPair> &result,
00299                                   bool isCRLF=false );
00300 
00301 KMIME_EXPORT bool parseParameterList( const char* &scursor,
00302                                       const char * const send,
00303                                       QMap<QString,QString> &result,
00304                                       bool isCRLF=false );
00305 
00306 KMIME_EXPORT bool parseRawParameterList( const char* &scursor,
00307                                          const char * const send,
00308                                          QMap<QString,Types::QStringOrQPair> &result,
00309                                          bool isCRLF=false );
00310 
00318 KMIME_EXPORT int parseDigits( const char* &scursor, const char* const send, int &result );
00319 
00320 KMIME_EXPORT bool parseTime( const char* &scursor, const char * const send,
00321                              int &hour, int &min, int &sec,
00322                              long int &secsEastOfGMT,
00323                              bool &timeZoneKnown, bool isCRLF=false );
00324 
00325 KMIME_EXPORT bool parseDateTime( const char* &scursor, const char * const send,
00326                                  KDateTime &result, bool isCRLF=false );
00327 
00328 } // namespace HeaderParsing
00329 
00330 } // namespace KMime
00331 
00332 #endif // __KMIME_HEADER_PARSING_H__
00333 

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"
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.5
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