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

swld.cpp

00001 /******************************************************************************
00002  *  swld.cpp   - code for base class 'SWLD'.  SWLD is the basis for all
00003  *                              types of Lexicon and Dictionary modules (hence the 'LD').
00004  */
00005 
00006 #include <swld.h>
00007 
00008 
00009 /******************************************************************************
00010  * SWLD Constructor - Initializes data for instance of SWLD
00011  *
00012  * ENT: imodname - Internal name for module
00013  *      imoddesc - Name to display to user for module
00014  *      idisp    - Display object to use for displaying
00015  */
00016 
00017 SWLD::SWLD(const char *imodname, const char *imoddesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang) : SWModule(imodname, imoddesc, idisp, "Lexicons / Dictionaries", enc, dir, mark, ilang)
00018 {
00019         delete key;
00020         key = CreateKey();
00021         entkeytxt = new char [1];
00022         *entkeytxt = 0;
00023 }
00024 
00025 
00026 /******************************************************************************
00027  * SWLD Destructor - Cleans up instance of SWLD
00028  */
00029 
00030 SWLD::~SWLD()
00031 {
00032         if (entkeytxt)
00033                 delete [] entkeytxt;
00034 }
00035 
00036 
00037 /******************************************************************************
00038  * SWLD::KeyText - Sets/gets module KeyText, getting from saved text if key is
00039  *                              persistent
00040  *
00041  * ENT: ikeytext - value which to set keytext
00042  *              [0] - only get
00043  *
00044  * RET: pointer to keytext
00045  */
00046 
00047 const char *SWLD::KeyText(const char *ikeytext)
00048 {
00049         if (key->Persist() && !ikeytext) {
00050                 getRawEntry();  // force module key to snap to entry
00051                 return entkeytxt;
00052         }
00053         else return SWModule::KeyText(ikeytext);
00054 }
00055 

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