libkmime

kmime_headers.h
1 /* -*- c++ -*
2  kmime_headers.h
3 
4  KMime, the KDE internet mail/usenet news message library.
5  Copyright (c) 2001-2002 the KMime authors.
6  See file AUTHORS for details
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License version 2.0 as
10  published by the Free Software Foundation.
11  You should have received a copy of the GNU General Public License
12  along with this program; if not, write to the Free Software Foundation,
13  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
14 */
15 #ifndef __KMIME_HEADERS_H__
16 #define __KMIME_HEADERS_H__
17 
18 // Content:
19 //
20 // - header's base class defining the common interface
21 // - generic base classes for different types of fields
22 // - incompatible, GStructured-based field classes
23 // - compatible, GUnstructured-based field classes
24 
25 #include "kmime_header_parsing.h"
26 
27 #include <tqstring.h>
28 #include <tqstrlist.h>
29 #include <tqstringlist.h>
30 #include <tqregexp.h>
31 #include <tqdatetime.h>
32 #include <tqasciidict.h>
33 #include <tqmap.h>
34 #include <tqptrlist.h>
35 
36 #include <time.h>
37 
38 #include <tdepimmacros.h>
39 
40 namespace KMime {
41 
42 //forward declaration
43 class Content;
44 
45 namespace Headers {
46 
47 
48 enum contentCategory { CCsingle,
49  CCcontainer,
50  CCmixedPart,
51  CCalternativePart };
52 
53 enum contentEncoding { CE7Bit,
54  CE8Bit,
55  CEquPr,
56  CEbase64,
57  CEuuenc,
58  CEbinary };
59 
60 enum contentDisposition { CDinline,
61  CDattachment,
62  CDparallel };
63 
64 //often used charset
65 static const TQCString Latin1("ISO-8859-1");
66 
67 #define mk_trivial_subclass_with_name( subclass, subclassName, baseclass ) \
68 class subclass : public Generics::baseclass { \
69 public: \
70  subclass() : Generics::baseclass() {} \
71  subclass( Content * p ) : Generics::baseclass( p ) {} \
72  subclass( Content * p, const TQCString & s ) \
73  : Generics::baseclass( p ) { from7BitString( s ); } \
74  subclass( Content * p, const TQString & s, const TQCString & cs ) \
75  : Generics::baseclass( p ) { fromUnicodeString( s, cs ); } \
76  ~subclass() {} \
77  \
78  const char * type() const { return #subclassName; } \
79 }
80 
81 #define mk_trivial_subclass( subclass, baseclass ) \
82 mk_trivial_subclass_with_name( subclass, subclass, baseclass )
83 
84 #define mk_parsing_subclass_with_name( subclass, subclassName, baseclass ) \
85 class subclass : public Generics::baseclass { \
86 public: \
87  subclass() : Generics::baseclass() {} \
88  subclass( Content * p ) : Generics::baseclass( p ) {} \
89  subclass( Content * p, const TQCString & s ) \
90  : Generics::baseclass( p ) { from7BitString( s ); } \
91  subclass( Content * p, const TQString & s, const TQCString & cs ) \
92  : Generics::baseclass( p ) { fromUnicodeString( s, cs ); } \
93  ~subclass() {} \
94  \
95  const char * type() const { return #subclassName; } \
96 protected: \
97  bool parse( const char* & scursor, const char * const send, bool isCRLF=false ); \
98 }
99 
100 #define mk_parsing_subclass( subclass, baseclass ) \
101 mk_parsing_subclass_with_name( subclass, subclass, baseclass )
103 //
104 //
105 // HEADER'S BASE CLASS. DEFINES THE COMMON INTERFACE
106 //
107 //
108 
111 class KDE_EXPORT Base {
112 
113  public:
114  typedef TQPtrList<Base> List;
115 
117  Base() : e_ncCS(0), p_arent(0) {}
118 
120  Base(KMime::Content *parent) : e_ncCS(0), p_arent(parent) {}
121 
123  virtual ~Base() {}
124 
126  KMime::Content* parent() { return p_arent; }
127 
129  void setParent(KMime::Content *p) { p_arent=p; }
130 
134  virtual void from7BitString(const TQCString&) {}
135 
138  virtual TQCString as7BitString(bool=true) { return TQCString(); }
139 
141  TQCString rfc2047Charset();
142 
144  void setRFC2047Charset(const TQCString &cs);
147  TQCString defaultCS();
148 
150  bool forceCS();
151 
153  virtual void fromUnicodeString(const TQString&, const TQCString&) {}
154 
157  virtual TQString asUnicodeString() { return TQString(); }
158 
160  virtual void clear() {}
161 
163  virtual bool isEmpty() { return false; }
166  virtual const char* type() { return ""; }
167 
169  bool is(const char* t) { return (strcasecmp(t, type())==0); }
170 
172  bool isMimeHeader() { return (strncasecmp(type(), "Content-", 8)==0); }
173 
175  bool isXHeader() { return (strncmp(type(), "X-", 2)==0); }
176 
177  protected:
178  TQCString typeIntro() { return (TQCString(type())+": "); }
179 
180  const char *e_ncCS;
181  Content *p_arent;
182 
183 };
184 
185 
186 //
187 //
188 // GENERIC BASE CLASSES FOR DIFFERENT TYPES OF FIELDS
189 //
190 //
191 
192 namespace Generics {
193 
213  // known issues:
214  // - uses old decodeRFC2047String function, instead of our own...
215 
216 class KDE_EXPORT GUnstructured : public Base {
217 
218 public:
219  GUnstructured() : Base() {}
220  GUnstructured( Content * p ) : Base( p ) {}
221  GUnstructured( Content * p, const TQCString & s )
222  : Base( p ) { from7BitString(s); }
223  GUnstructured( Content * p, const TQString & s, const TQCString & cs )
224  : Base( p ) { fromUnicodeString( s, cs ); }
225  ~GUnstructured() {}
226 
227  virtual void from7BitString( const TQCString& str );
228  virtual TQCString as7BitString( bool withHeaderType=true );
229 
230  virtual void fromUnicodeString( const TQString & str,
231  const TQCString & suggestedCharset);
232  virtual TQString asUnicodeString();
233 
234  virtual void clear() { d_ecoded.truncate(0); }
235  virtual bool isEmpty() { return (d_ecoded.isEmpty()); }
236 
237 private:
238  TQString d_ecoded;
239 };
240 
269 class KDE_EXPORT GStructured : public Base {
270 public:
271  GStructured() : Base() {}
272  GStructured( Content * p ) : Base( p ) {}
273  GStructured( Content * p, const TQCString & s )
274  : Base( p ) { from7BitString(s); }
275  GStructured( Content * p, const TQString & s, const TQCString & cs )
276  : Base( p ) { fromUnicodeString( s, cs ); }
277  ~GStructured() {}
278 
279 
280 protected:
281 #if 0
282  // the assembly squad:
283 
284  bool writeAtom( char* & dcursor, const char * const dend, const TQString & input );
285  bool writeAtom( char* & dcursor, const char * const dend,
286  const TQPair<const char*,int> & input );
287  bool writeToken( char* & dcursor, const char * const dend, const TQString & input );
288  bool writeToken( char* & dcursor, const char * const dend,
289  const TQPair<const char*int> & input );
290 
291  bool writeGenericQuotedString( char* & dcursor, const char * const dend,
292  const TQString & input, bool withCRLF=false );
293  bool writeComment( char* & dcursor, const char * const dend,
294  const TQString & input, bool withCRLF=false );
295  bool writePhrase( char* & dcursor, const char * const dend,
296  const TQString & input, bool withCRLF=false );
297  bool writeDotAtom( char* & dcursor, const char * const dend,
298  const TQString & input, bool withCRLF=false );
299 #endif
300 };
301 
302 
303 class KDE_EXPORT GAddress : public GStructured {
304 public:
305  GAddress() : GStructured() {}
306  GAddress( Content * p ) : GStructured( p ) {}
307  GAddress( Content * p, const TQCString & s )
308  : GStructured( p ) { from7BitString(s); }
309  GAddress( Content * p, const TQString & s, const TQCString & cs )
310  : GStructured( p ) { fromUnicodeString( s, cs ); }
311  ~GAddress() {}
313 protected:
314 };
315 
316 
319 class KDE_EXPORT MailboxList : public GAddress {
320 public:
321  MailboxList() : GAddress() {}
322  MailboxList( Content * p ) : GAddress( p ) {}
323  MailboxList( Content * p, const TQCString & s )
324  : GAddress( p ) { from7BitString(s); }
325  MailboxList( Content * p, const TQString & s, const TQCString & cs )
326  : GAddress( p ) { fromUnicodeString( s, cs ); }
327  ~MailboxList() {}
329 protected:
330  bool parse( const char* & scursor, const char * const send, bool isCRLF=false );
331 
333  TQValueList<Types::Mailbox> mMailboxList;
334 };
335 
336 
339 mk_parsing_subclass(SingleMailbox,MailboxList);
340 
343 class KDE_EXPORT AddressList : public GAddress {
344 public:
345  AddressList() : GAddress() {}
346  AddressList( Content * p ) : GAddress( p ) {}
347  AddressList( Content * p, const TQCString & s )
348  : GAddress( p ) { from7BitString(s); }
349  AddressList( Content * p, const TQString & s, const TQCString & cs )
350  : GAddress( p ) { fromUnicodeString( s, cs ); }
351  ~AddressList() {}
352 
353 protected:
354  bool parse( const char* & scursor, const char * const send, bool isCRLF=false );
355 
357  TQValueList<Types::Address> mAddressList;
358 };
361 class KDE_EXPORT GIdent : public GAddress {
362 public:
363  GIdent() : GAddress() {}
364  GIdent( Content * p ) : GAddress( p ) {}
365  GIdent( Content * p, const TQCString & s )
366  : GAddress( p ) { from7BitString(s); }
367  GIdent( Content * p, const TQString & s, const TQCString & cs )
368  : GAddress( p ) { fromUnicodeString( s, cs ); }
369  ~GIdent() {}
371 protected:
372  bool parse( const char* & scursor, const char * const send, bool isCRLF=false );
373 
375  TQValueList<Types::AddrSpec> mMsgIdList;
376 };
377 
379 mk_parsing_subclass(GSingleIdent,GIdent);
380 
382 class KDE_EXPORT GToken : public GStructured {
383 public:
384  GToken() : GStructured() {}
385  GToken( Content * p ) : GStructured( p ) {}
386  GToken( Content * p, const TQCString & s )
387  : GStructured( p ) { from7BitString(s); }
388  GToken( Content * p, const TQString & s, const TQCString & cs )
389  : GStructured( p ) { fromUnicodeString( s, cs ); }
390  ~GToken() {}
391 
392 protected:
393  bool parse( const char* & scursor, const char * const send, bool isCRLF=false );
394 
395  TQCString mToken;
396 };
397 
398 
399 class KDE_EXPORT GPhraseList : public GStructured {
400 public:
401  GPhraseList() : GStructured() {}
402  GPhraseList( Content * p ) : GStructured( p ) {}
403  GPhraseList( Content * p, const TQCString & s )
404  : GStructured( p ) { from7BitString(s); }
405  GPhraseList( Content * p, const TQString & s, const TQCString & cs )
406  : GStructured( p ) { fromUnicodeString( s, cs ); }
407  ~GPhraseList() {}
408 
409 protected:
410  bool parse( const char* & scursor, const char * const send, bool isCRLF=false );
411 
412  TQStringList mPhraseList;
413 };
414 
415 class KDE_EXPORT GDotAtom : public GStructured {
416 public:
417  GDotAtom() : GStructured() {}
418  GDotAtom( Content * p ) : GStructured( p ) {}
419  GDotAtom( Content * p, const TQCString & s )
420  : GStructured( p ) { from7BitString(s); }
421  GDotAtom( Content * p, const TQString & s, const TQCString & cs )
422  : GStructured( p ) { fromUnicodeString( s, cs ); }
423  ~GDotAtom() {}
424 
425 protected:
426  bool parse( const char* & scursor, const char * const send, bool isCRLF=false );
427 
428  TQString mDotAtom;
429 };
430 
431 class KDE_EXPORT GParametrized : public GStructured {
432 public:
433  GParametrized() : GStructured() {}
434  GParametrized( Content * p ) : GStructured( p ) {}
435  GParametrized( Content * p, const TQCString & s )
436  : GStructured( p ) { from7BitString(s); }
437  GParametrized( Content * p, const TQString & s, const TQCString & cs )
438  : GStructured( p ) { fromUnicodeString( s, cs ); }
439  ~GParametrized() {}
440 
441 protected:
442  TQMap<TQString,TQString> mParameterHash;
443 
444 private:
445 };
446 
447 class KDE_EXPORT GContentType : public GParametrized {
448 public:
449  GContentType() : GParametrized() {}
450  GContentType( Content * p ) : GParametrized( p ) {}
451  GContentType( Content * p, const TQCString & s )
452  : GParametrized( p ) { from7BitString(s); }
453  GContentType( Content * p, const TQString & s, const TQCString & cs )
454  : GParametrized( p ) { fromUnicodeString( s, cs ); }
455  ~GContentType() {}
456 
457 protected:
458  bool parse( const char* & scursor, const char * const send, bool isCRLF=false );
459 
460  TQCString mMimeType;
461  TQCString mMimeSubType;
462 };
463 
464 
465 class KDE_EXPORT GCISTokenWithParameterList : public GParametrized {
466 public:
467  GCISTokenWithParameterList() : GParametrized() {}
468  GCISTokenWithParameterList( Content * p ) : GParametrized( p ) {}
469  GCISTokenWithParameterList( Content * p, const TQCString & s )
470  : GParametrized( p ) { from7BitString(s); }
471  GCISTokenWithParameterList( Content * p, const TQString & s, const TQCString & cs )
472  : GParametrized( p ) { fromUnicodeString( s, cs ); }
473  ~GCISTokenWithParameterList() {}
474 
475 protected:
476  bool parse( const char* & scursor, const char * const send, bool isCRLF=false );
477 
478  TQCString mToken;
479 };
480 
481 
482 } // namespace Generics
483 
484 //
485 //
486 // INCOMPATIBLE, GSTRUCTURED-BASED FIELDS:
487 //
488 //
489 
490 
492 class KDE_EXPORT ReturnPath : public Generics::GAddress {
493 public:
494  ReturnPath() : Generics::GAddress() {}
495  ReturnPath( Content * p ) : Generics::GAddress( p ) {}
496  ReturnPath( Content * p, const TQCString & s )
497  : Generics::GAddress( p ) { from7BitString(s); }
498  ReturnPath( Content * p, const TQString & s, const TQCString & cs )
499  : Generics::GAddress( p ) { fromUnicodeString( s, cs ); }
500  ~ReturnPath() {}
501 
502  const char * type() const { return "Return-Path"; }
503 
504 protected:
505  bool parse( const char* & scursor, const char * const send, bool isCRLF=false );
506 };
507 
508 #if defined(KMIME_NEW_STYLE_CLASSTREE)
509 // classes whose names collide with earlier ones:
510 
511 // GAddress et al.:
512 
513 // rfc(2)822 headers:
514 mk_trivial_subclass(From,MailboxList);
515 mk_trivial_subclass(Sender,SingleMailbox);
516 mk_trivial_subclass_with_name(ReplyTo,Reply-To,AddressList);
517 mk_trivial_subclass(Cc,AddressList);
518 mk_trivial_subclass(Bcc,AddressList);
519 // usefor headers:
520 mk_trivial_subclass_with_name(MailCopiesTo,Mail-Copies-To,AddressList);
521 
522 // GToken:
523 
524 mk_trivial_subclass_with_name(ContentTransferEncoding,
525  Content-Transfer-Encoding,GToken);
526 
527 // GPhraseList:
528 
529 mk_trivial_subclass(Keywords,GPhraseList);
530 
531 // GDotAtom:
532 
533 mk_trivial_subclass_with_name(MIMEVersion,MIME-Version,GDotAtom);
534 
535 // GIdent:
536 
537 mk_trivial_subclass_with_name(MessageID,Message-ID,GSingleIdent);
538 mk_trivial_subclass_with_name(ContentID,Content-ID,GSingleIdent);
539 mk_trivial_subclass(Supersedes,GSingleIdent);
540 mk_trivial_subclass_with_name(InReplyTo,In-Reply-To,GIdent);
541 mk_trivial_subclass(References,GIdent);
542 
543 // GContentType:
544 
545 mk_trivial_subclass_with_name(ContentType,ContentType,GContentType);
546 
547 // GCISTokenWithParameterList:
548 
549 mk_trivial_subclass_with_name(ContentDisposition,Content-Disposition,
550  GCISTokenWithParameterList);
551 
552 
553 #endif
554 
555 
556 //
557 //
558 // COMPATIBLE GUNSTRUCTURED-BASED FIELDS:
559 //
560 //
561 
562 
568 class KDE_EXPORT Generic : public Generics::GUnstructured {
569 
570  public:
571  Generic() : Generics::GUnstructured(), t_ype(0) {}
572  Generic(const char *t)
573  : Generics::GUnstructured(), t_ype(0) { setType(t); }
574  Generic(const char *t, Content *p)
575  : Generics::GUnstructured( p ), t_ype(0) { setType(t); }
576  Generic(const char *t, Content *p, const TQCString &s)
577  : Generics::GUnstructured( p, s ), t_ype(0) { setType(t); }
578  Generic(const char *t, Content *p, const TQString &s, const TQCString &cs)
579  : Generics::GUnstructured( p, s, cs ), t_ype(0) { setType(t); }
580  ~Generic() { delete[] t_ype; }
581 
582  virtual void clear() { delete[] t_ype; GUnstructured::clear(); }
583  virtual bool isEmpty() { return (t_ype==0 || GUnstructured::isEmpty()); }
584  virtual const char* type() { return t_ype; }
585  void setType(const char *type);
586 
587  protected:
588  char *t_ype;
589 
590 };
591 
592 
594 class KDE_EXPORT Subject : public Generics::GUnstructured {
595 
596  public:
598  Subject( Content * p ) : Generics::GUnstructured( p ) {}
599  Subject( Content * p, const TQCString & s )
600  : Generics::GUnstructured( p, s ) {}
601  Subject( Content * p, const TQString & s, const TQCString & cs )
602  : Generics::GUnstructured( p, s, cs ) {}
603  ~Subject() {}
604 
605  virtual const char* type() { return "Subject"; }
606 
607  bool isReply() {
608  return ( asUnicodeString().find( TQString("Re:"), 0, false ) == 0 );
609  }
610 };
611 
613 class KDE_EXPORT Organization : public Generics::GUnstructured {
614 
615  public:
618  Organization( Content * p, const TQCString & s )
619  : Generics::GUnstructured( p, s ) {};
620  Organization( Content * p, const TQString & s, const TQCString & cs)
621  : Generics::GUnstructured( p, s, cs ) {}
622  ~Organization() {}
623 
624  virtual const char* type() { return "Organization"; }
625 
626 };
627 
628 //
629 //
630 // NOT YET CONVERTED STUFF BELOW:
631 //
632 //
633 
634 
635 
637 class KDE_EXPORT Control : public Base {
638 
639  public:
640  Control() : Base() {}
641  Control(Content *p) : Base(p) {}
642  Control(Content *p, const TQCString &s) : Base(p) { from7BitString(s); }
643  Control(Content *p, const TQString &s) : Base(p) { fromUnicodeString(s, Latin1); }
644  ~Control() {}
645 
646  virtual void from7BitString(const TQCString &s);
647  virtual TQCString as7BitString(bool incType=true);
648  virtual void fromUnicodeString(const TQString &s, const TQCString&);
649  virtual TQString asUnicodeString();
650  virtual void clear() { c_trlMsg.truncate(0); }
651  virtual bool isEmpty() { return (c_trlMsg.isEmpty()); }
652  virtual const char* type() { return "Control"; }
653 
654  bool isCancel() { return (c_trlMsg.find("cancel", 0, false)!=-1); }
655 
656  protected:
657  TQCString c_trlMsg;
658 
659 };
660 
662 class KDE_EXPORT Date : public Base {
663 
664  public:
665  Date() : Base(), t_ime(0) {}
666  Date(Content *p) : Base(p), t_ime(0) {}
667  Date(Content *p, time_t t) : Base(p), t_ime(t) {}
668  Date(Content *p, const TQCString &s) : Base(p) { from7BitString(s); }
669  Date(Content *p, const TQString &s) : Base(p) { fromUnicodeString(s, Latin1); }
670  ~Date() {}
671 
672  virtual void from7BitString(const TQCString &s);
673  virtual TQCString as7BitString(bool incType=true);
674  virtual void fromUnicodeString(const TQString &s, const TQCString&);
675  virtual TQString asUnicodeString();
676  virtual void clear() { t_ime=0; }
677  virtual bool isEmpty() { return (t_ime==0); }
678  virtual const char* type() { return "Date"; }
679 
680  time_t unixTime() { return t_ime; }
681  void setUnixTime(time_t t) { t_ime=t; }
682  void setUnixTime() { t_ime=time(0); }
683  TQDateTime qdt();
684  int ageInDays();
685 
686  protected:
687  time_t t_ime;
688 
689 };
690 
691 
693 class KDE_EXPORT Newsgroups : public Base {
694 
695  public:
696  Newsgroups() : Base() {}
697  Newsgroups(Content *p) : Base(p) {}
698  Newsgroups(Content *p, const TQCString &s) : Base(p) { from7BitString(s); }
699  Newsgroups(Content *p, const TQString &s) : Base(p) { fromUnicodeString(s, Latin1); }
700  ~Newsgroups() {}
701 
702  virtual void from7BitString(const TQCString &s);
703  virtual TQCString as7BitString(bool incType=true);
704  virtual void fromUnicodeString(const TQString &s, const TQCString&);
705  virtual TQString asUnicodeString();
706  virtual void clear() { g_roups.resize(0); }
707  virtual bool isEmpty() { return g_roups.isEmpty(); }
708  virtual const char* type() { return "Newsgroups"; }
709 
710  TQCString firstGroup();
711  bool isCrossposted() { return ( g_roups.find(',')>-1 ); }
712  TQStringList getGroups();
713 
714  protected:
715  TQCString g_roups;
716 
717 };
718 
719 
721 class KDE_EXPORT FollowUpTo : public Newsgroups {
722 
723  public:
724  FollowUpTo() : Newsgroups() {}
725  FollowUpTo(Content *p) : Newsgroups(p) {}
726  FollowUpTo(Content *p, const TQCString &s) : Newsgroups(p,s) {}
727  FollowUpTo(Content *p, const TQString &s) : Newsgroups(p,s) {}
728  ~FollowUpTo() {}
729 
730  virtual const char* type() { return "Followup-To"; }
731 
732 };
733 
734 
736 class KDE_EXPORT Lines : public Base {
737 
738  public:
739  Lines() : Base(),l_ines(-1) {}
740  Lines(Content *p) : Base(p),l_ines(-1) {}
741  Lines(Content *p, unsigned int i) : Base(p),l_ines(i) {}
742  Lines(Content *p, const TQCString &s) : Base(p) { from7BitString(s); }
743  Lines(Content *p, const TQString &s) : Base(p) { fromUnicodeString(s, Latin1); }
744  ~Lines() {}
745 
746  virtual void from7BitString(const TQCString &s);
747  virtual TQCString as7BitString(bool incType=true);
748  virtual void fromUnicodeString(const TQString &s, const TQCString&);
749  virtual TQString asUnicodeString();
750  virtual void clear() { l_ines=-1; }
751  virtual bool isEmpty() { return (l_ines==-1); }
752  virtual const char* type() { return "Lines"; }
753 
754  int numberOfLines() { return l_ines; }
755  void setNumberOfLines(int i) { l_ines=i; }
756 
757  protected:
758  int l_ines;
759 
760 };
761 
762 
763 
765 class KDE_EXPORT UserAgent : public Base {
766 
767  public:
768  UserAgent() : Base() {}
769  UserAgent(Content *p) : Base(p) {}
770  UserAgent(Content *p, const TQCString &s) : Base(p) { from7BitString(s); }
771  UserAgent(Content *p, const TQString &s) : Base(p) { fromUnicodeString(s, Latin1); }
772  ~UserAgent() {}
773 
774  virtual void from7BitString(const TQCString &s);
775  virtual TQCString as7BitString(bool incType=true);
776  virtual void fromUnicodeString(const TQString &s, const TQCString&);
777  virtual TQString asUnicodeString();
778  virtual void clear() { u_agent.resize(0); }
779  virtual bool isEmpty() { return (u_agent.isEmpty()); }
780  virtual const char* type() { return "User-Agent"; }
781 
782  protected:
783  TQCString u_agent;
784 
785 };
786 
787 
788 #if !defined(KMIME_NEW_STYLE_CLASSTREE)
789 #include "kmime_headers_obs.h"
790 #endif
791 } //namespace Headers
792 
793 #if 0
794 typedef Headers::Base* (*headerCreator)(void);
795 
811 class HeaderFactory : public TQAsciiDict<headerCreator>
812 {
813 private:
814  HeaderFactory();
815  ~HeaderFactory() {}
816  static TQAsciiDict
817 
818 public:
822  static Headers::Base* create( const char* aType )
823  {
824  if (!s_elf)
825  s_elf = new HeaderFactory;
826  headerCreator * hc = (*s_elf)[aType];
827  if ( !hc )
828  return 0;
829  else
830  return (*hc)();
831  }
832 
837  static Headers::Base* create( const TQCString& aType )
838  {
839  return create( aType.data() );
840  }
841 
851  static Headers::Base* upgrade( Headers::Generic* aType ) { (void)aType; return new Headers::Base; }
852 
853 };
854 
855 #endif
856 
857 } //namespace KMime
858 
859 
860 #endif // __KMIME_HEADERS_H__
861