TDE personal information management applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
3.9KB

  1. /***************************************************************************
  2. mapihd.h - description
  3. -------------------
  4. begin : Tue Jul 25 2000
  5. copyright : (C) 2000 by Hans Dijkema
  6. email : kmailcvt@hum.org
  7. ***************************************************************************/
  8. /***************************************************************************
  9. * *
  10. * This program is free software; you can redistribute it and/or modify *
  11. * it under the terms of the GNU General Public License as published by *
  12. * the Free Software Foundation; either version 2 of the License, or *
  13. * (at your option) any later version. *
  14. * *
  15. ***************************************************************************/
  16. #ifndef _MAPIHD_H_
  17. #define _MAPIHD_H_
  18. #include <tqmemarray.h>
  19. #include "pab_xxport.h"
  20. #define T_MS_ARRAY 0x1100 // Some sort of array
  21. #define T_MS_STRING ((unsigned long) 0x1e) // definitely a string
  22. typedef unsigned long adr_t;
  23. typedef unsigned long content_t;
  24. typedef unsigned short pabsize_t;
  25. typedef unsigned char byte_t;
  26. typedef unsigned short word_t;
  27. typedef byte_t byte;
  28. class pab;
  29. class pabrec {
  30. private:
  31. char entry[1024];
  32. byte *_mem;
  33. word_t m_N;
  34. word_t *m_W;
  35. public:
  36. pabrec(pab &); // expects record the begin at reading point (ftell).
  37. ~pabrec();
  38. public:
  39. word_t N(void) { return m_N; }
  40. word_t operator[](int i) { return m_W[i]; }
  41. const char *getEntry(int i);
  42. public:
  43. content_t read(word_t offset);
  44. };
  45. typedef enum {
  46. pr_unknown,pr_notused,
  47. pr_givenname,pr_email,
  48. pr_firstname,pr_additionalname,pr_lastname,pr_title,
  49. pr_address,pr_town,pr_state,pr_zip,pr_country,
  50. pr_organization,pr_department,pr_subdep,pr_job,
  51. pr_tel,pr_fax,pr_modem,pr_mobile,pr_url,pr_talk,
  52. pr_notes,pr_birthday
  53. }
  54. pabrec_entry;
  55. class mapitag_t
  56. {
  57. friend bool operator < (mapitag_t &,mapitag_t &);
  58. friend bool operator > (mapitag_t &,mapitag_t &);
  59. friend bool operator == (mapitag_t &,mapitag_t &);
  60. private:
  61. word_t _tag;
  62. word_t _type;
  63. content_t _order;
  64. public:
  65. mapitag_t(content_t tag,content_t order) { _tag=(word_t) tag;_type=(word_t) (tag>>16);_order=order; }
  66. mapitag_t() { _tag=0;_type=0;_order=0; }
  67. public:
  68. mapitag_t & operator = (mapitag_t & t) { _tag=t._tag;_type=t._type;_order=t._order;return *this; }
  69. public:
  70. bool isUsed(void) { return (_type==T_MS_STRING || (_type&T_MS_ARRAY)!=0) && _order!=0; }
  71. word_t literal(void) { return _tag; }
  72. content_t order(void) { return _order; }
  73. pabrec_entry matchTag(void);
  74. };
  75. bool operator < (mapitag_t & a,mapitag_t & b);
  76. bool operator > (mapitag_t & a,mapitag_t & b);
  77. bool operator == (mapitag_t & a,mapitag_t & b);
  78. class pabfields_t
  79. {
  80. private:
  81. TQMemArray<mapitag_t> tags,context_tags;
  82. pabrec *m_R;
  83. TQString givenName,email,
  84. title,firstName,additionalName,lastName,
  85. address,town,state,zip,country,
  86. organization,department,subDep,job,
  87. tel,fax,modem,mobile,homepage,talk,
  88. comment,birthday;
  89. bool OK;
  90. private:
  91. bool isUsed(int k);
  92. pabrec_entry isWhat(int k);
  93. word_t literal(int k);
  94. content_t order(int k);
  95. public:
  96. pabfields_t(pabrec & R, TQWidget *parent);
  97. public:
  98. KABC::Addressee get( );
  99. bool isOK(void) { return OK; }
  100. bool isUsable(void) { return givenName!=""; }
  101. };
  102. #endif