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

rawgbf.cpp

00001 /******************************************************************************
00002  *  rawgbf.cpp - code for class 'RawGBF'- a module that reads raw text files:
00003  *                ot and nt using indexs ??.bks ??.cps ??.vss
00004  */
00005 
00006 
00007 #include <ctype.h>
00008 #include <stdio.h>
00009 #include <fcntl.h>
00010 
00011 #ifndef __GNUC__
00012 #include <io.h>
00013 #else
00014 #include <unistd.h>
00015 #endif
00016 
00017 #include <string.h>
00018 #include <utilfuns.h>
00019 #include <rawverse.h>
00020 #include <rawgbf.h>
00021 
00022 
00023 /******************************************************************************
00024  * RawGBF Constructor - Initializes data for instance of RawGBF
00025  *
00026  * ENT: iname - Internal name for module
00027  *      idesc - Name to display to user for module
00028  *      idisp    - Display object to use for displaying
00029  */
00030 
00031 RawGBF::RawGBF(const char *ipath, const char *iname, const char *idesc, SWDisplay *idisp) : SWText(iname, idesc, idisp), RawVerse(ipath)
00032 {
00033 }
00034 
00035 
00036 /******************************************************************************
00037  * RawGBF Destructor - Cleans up instance of RawGBF
00038  */
00039 
00040 RawGBF::~RawGBF()
00041 {
00042 }
00043 
00044 
00045 /******************************************************************************
00046  * RawGBF::operator char *      - Returns the correct verse when char * cast
00047  *                                      is requested
00048  *
00049  * RET: string buffer with verse
00050  */
00051 
00052 RawGBF::operator char*()
00053 {
00054         long  start;
00055         unsigned short size;
00056         VerseKey *key = 0;
00057 
00058 #ifndef _WIN32_WCE
00059         try {
00060 #endif
00061                 key = SWDYNAMIC_CAST(VerseKey, this->key);
00062 #ifndef _WIN32_WCE
00063         }
00064         catch ( ... ) {}
00065 #endif
00066         if (!key)
00067                 key = new VerseKey(this->key);
00068 
00069 
00070         findoffset(key->Testament(), key->Index(), &start, &size);
00071 
00072         if (entrybuf)
00073                 delete [] entrybuf;
00074         entrybuf = new char [ size * 3 ];               // extra for conversion to RTF or other.
00075 
00076         gettext(key->Testament(), start, size + 1, entrybuf);
00077         preptext(entrybuf);
00078         RenderText(entrybuf, size * 3);
00079         
00080         if (key != this->key)
00081                 delete key;
00082 
00083         return entrybuf;
00084 }

Generated on Thu Jun 20 22:13:00 2002 for The Sword Project by doxygen1.2.15