Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

helpbase.h

Go to the documentation of this file.
00001 /*
00002  * helpbase.h
00003  *
00004  * Turbo Vision - Version 2.0
00005  *
00006  * Copyright (c) 1994 by Borland International
00007  * All Rights Reserved.
00008  *
00009  * Modified by Sergio Sigala <sergio@sigala.it>
00010  */
00011 
00019 const long magicHeader = 0x46484246L; //"FBHF"
00020 
00021 #define cHelpViewer "\x06\x07\x08"
00022 #define cHelpWindow "\x80\x81\x82\x83\x84\x85\x86\x87"
00023 
00024 // TParagraph
00025 
00030 class TParagraph
00031 {
00032 public:
00036     TParagraph() {}
00040     TParagraph *next;
00044     Boolean wrap;
00048     ushort size;
00052     char *text;
00053 };
00054 
00055 // TCrossRef
00056 
00061 class TCrossRef
00062 {
00063 public:
00067     TCrossRef() {}
00071     int ref;
00075     int offset;
00079     uchar length;
00080 };
00081 
00085 typedef void (*TCrossRefHandler) ( opstream&, int );
00086 
00091 class THelpTopic: public TObject, public TStreamable
00092 {
00093 public:
00097     THelpTopic();
00101     THelpTopic( StreamableInit ) {};
00105     virtual ~THelpTopic();
00109     void addCrossRef( TCrossRef ref );
00113     void addParagraph( TParagraph *p );
00117     void getCrossRef( int i, TPoint& loc, uchar& length, int& ref );
00121     char *getLine( int line, char *buffer, int buflen );
00125     int getNumCrossRefs();
00129     int numLines();
00133     void setCrossRef( int i, TCrossRef& ref );
00137     void setNumCrossRefs( int i );
00141     void setWidth( int aWidth );
00145     TParagraph *paragraphs;
00149     int numRefs;
00153     TCrossRef *crossRefs;
00154 private:
00155     char *wrapText( char *text, int size, int& offset, Boolean wrap, char *lineBuf, int lineBufLen );
00156     void readParagraphs( ipstream& s );
00157     void readCrossRefs( ipstream& s );
00158     void writeParagraphs( opstream& s );
00159     void writeCrossRefs( opstream& s );
00160     void disposeParagraphs();
00161     const char *streamableName() const
00162         { return name; }
00163     int width;
00164     int lastOffset;
00165     int lastLine;
00166     TParagraph *lastParagraph;
00167 protected:
00168     virtual void write( opstream& os );
00169     virtual void *read( ipstream& is );
00170 public:
00174     static const char * const name;
00178     static TStreamable *build();
00179 };
00180 
00184 inline ipstream& operator >> ( ipstream& is, THelpTopic& cl )
00185     { return is >> (TStreamable&)cl; }
00189 inline ipstream& operator >> ( ipstream& is, THelpTopic*& cl )
00190     { return is >> (void *&)cl; }
00191 
00195 inline opstream& operator << ( opstream& os, THelpTopic& cl )
00196     { return os << (TStreamable&)cl; }
00200 inline opstream& operator << ( opstream& os, THelpTopic* cl )
00201     { return os << (TStreamable *)cl; }
00202 
00203 
00204 // THelpIndex
00205 
00210 class THelpIndex : public TObject, public TStreamable
00211 {
00212 public:
00216     THelpIndex();
00220     THelpIndex( StreamableInit ) {};
00224     virtual ~THelpIndex();
00228     long position( int );
00232     void add( int, long );
00236     ushort size;
00240     long *index;
00241 private:
00242     const char *streamableName() const
00243         { return name; }
00244 protected:
00245     virtual void write( opstream& os );
00246     virtual void *read( ipstream& is );
00247 public:
00251     static const char * const name;
00255     static TStreamable *build();
00256 };
00257 
00261 inline ipstream& operator >> ( ipstream& is, THelpIndex& cl )
00262     { return is >> (TStreamable&)cl; }
00266 inline ipstream& operator >> ( ipstream& is, THelpIndex*& cl )
00267     { return is >> (void *&)cl; }
00268 
00272 inline opstream& operator << ( opstream& os, THelpIndex& cl )
00273     { return os << (TStreamable&)cl; }
00277 inline opstream& operator << ( opstream& os, THelpIndex* cl )
00278     { return os << (TStreamable *)cl; }
00279 
00280 
00281 // THelpFile
00282 
00287 class THelpFile : public TObject
00288 {
00289     static const char * invalidContext;
00290 public:
00294     THelpFile( fpstream& s );
00298     virtual ~THelpFile();
00302     THelpTopic *getTopic( int );
00306     THelpTopic *invalidTopic();
00310     void recordPositionInIndex( int );
00314     void putTopic( THelpTopic* );
00318     fpstream *stream;
00322     Boolean modified;
00326     THelpIndex *index;
00330     long indexPos;
00331 };
00332 
00336 extern void notAssigned( opstream& s, int value );
00337 
00341 extern TCrossRefHandler crossRefHandler;

Generated at Sat Sep 22 20:19:09 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001