Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Aportis.h

Go to the documentation of this file.
00001 /*
00002   Derived from makedoc9 by Pat Beirne
00003 */
00004 
00005 #ifndef __Aportis_h
00006 #define __Aportis_h
00007 #include "CExpander.h"
00008 #include "pdb.h"
00009 
00010 typedef UInt32 DWORD;
00011 typedef UInt16 WORD;
00012 
00013 #define DISP_BITS 11
00014 #define COUNT_BITS 3
00015 /*
00016 // all numbers in these structs are big-endian, MAC format
00017 struct tDocHeader {
00018         char sName[32];
00019         DWORD dwUnknown1;
00020         DWORD dwTime1;
00021         DWORD dwTime2;
00022         DWORD dwTime3;
00023         DWORD dwLastSync;
00024         DWORD ofsSort;
00025         DWORD ofsCatagories;
00026         DWORD dwCreator;
00027         DWORD dwType;
00028         DWORD dwUnknown2;
00029         DWORD dwUnknown3;
00030         WORD  wNumRecs;
00031 };
00032 */
00033 struct tDocRecord0 {
00034         WORD wVersion;  // 1=plain text, 2=compressed
00035         WORD wSpare;
00036         DWORD dwStoryLen;   // in chars, when decompressed
00037         WORD wNumRecs;                  // text records only; equals tDocHeader.wNumRecs-1
00038         WORD wRecSize;                  // usually 0x1000
00039         DWORD dwSpare2;
00040 };
00041 
00042 struct PeanutHeader
00043 {
00044     UInt16 Version;
00045     UInt8 Junk1[6];
00046     UInt16 Records;
00047     UInt8 Junk2[106];
00048 };
00049 
00051 
00052 inline WORD SwapWord(WORD r)
00053 {
00054         return (r>>8) + (r<<8);
00055 }
00056 
00057 inline DWORD SwapLong(DWORD r)
00058 {
00059         return  ((r>>24) & 0xFF) + (r<<24) + ((r>>8) & 0xFF00) + ((r<<8) & 0xFF0000);
00060 }
00061 
00062 class Aportis : public Cpdb {
00063     bool peanutfile, html;
00064     void dePeanut(int&);
00065   DWORD dwLen;
00066   WORD nRecs2;
00067   DWORD dwTLen;
00068   WORD nRecs;
00069   WORD BlockSize;
00070   DWORD dwRecLen;
00071   WORD mobiimagerec;
00072   int currentrec, currentpos;
00073   unsigned int cbptr;
00074   unsigned int outptr;
00075   unsigned char circbuf[2048];
00076   char bCompressed;
00077 public:
00078   void sizes(unsigned long& _file, unsigned long& _text)
00079     {
00080       qDebug("Calling aportis sizes:(%u,%u,%u)", dwTLen, nRecs, BlockSize);
00081       _file = dwLen;
00082       _text = dwTLen;
00083     }
00084   bool hasrandomaccess() { return true; }
00085   virtual ~Aportis() {}
00086   Aportis();
00087   int OpenFile(const char *src);
00088   int getch();
00089   unsigned int locate();
00090   void locate(unsigned int n);
00091   CList<Bkmk>* getbkmklist();
00092   MarkupType PreferredMarkup()
00093       {
00094           return (peanutfile) ? cPML : ((html) ? cHTML : cTEXT);
00095       }
00096   QImage* getPicture(unsigned long);
00097   QString about() { return QString("AportisDoc codec (c) Tim Wentford"); }
00098 private:
00099   bool refreshbuffer();
00100   unsigned int GetBS(unsigned int bn);
00101 };
00102 
00103 #endif

Generated on Sat Nov 5 16:16:53 2005 for OPIE by  doxygen 1.4.2