Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes | Private Attributes
SfxEntry Class Reference

#include <affentry.hxx>

Inheritance diagram for SfxEntry:
Inheritance graph
[legend]
Collaboration diagram for SfxEntry:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SfxEntry (AffixMgr *pmgr, affentry *dp)
 ~SfxEntry ()
struct hentrycheck (const char *word, int len, int optflags, AffEntry *ppfx)
bool allowCross ()
unsigned char getFlag ()
const char * getKey ()
char * add (const char *word, int len)
SfxEntrygetNext ()
SfxEntrygetNextNE ()
SfxEntrygetNextEQ ()
SfxEntrygetFlgNxt ()
void setNext (SfxEntry *ptr)
void setNextNE (SfxEntry *ptr)
void setNextEQ (SfxEntry *ptr)
void setFlgNxt (SfxEntry *ptr)

Protected Attributes

char * appnd
char * strip
short appndl
short stripl
short numconds
short xpflg
char achar
char conds [SETSIZE]

Private Attributes

AffixMgrpmyMgr
char * rappnd
SfxEntrynext
SfxEntrynexteq
SfxEntrynextne
SfxEntryflgnxt

Detailed Description

Definition at line 48 of file affentry.hxx.


Constructor & Destructor Documentation

SfxEntry::SfxEntry ( AffixMgr pmgr,
affentry dp 
)

Definition at line 138 of file affentry.cpp.

{
  // register affix manager
  pmyMgr = pmgr;

  // set up its intial values
  achar = dp->achar;         // char flag 
  strip = dp->strip;         // string to strip
  appnd = dp->appnd;         // string to append
  stripl = dp->stripl;       // length of strip string
  appndl = dp->appndl;       // length of append string
  numconds = dp->numconds;   // number of conditions to match
  xpflg = dp->xpflg;         // cross product flag

  // then copy over all of the conditions
  memcpy(&conds[0],&dp->conds[0],SETSIZE*sizeof(conds[0]));

  rappnd = myrevstrdup(appnd);
}

Here is the call graph for this function:

Definition at line 159 of file affentry.cpp.

{
    achar = '\0';
    if (appnd) free(appnd);
    if (rappnd) free(rappnd);
    if (strip) free(strip);
    pmyMgr = NULL;
    appnd = NULL;
    strip = NULL;    
}

Member Function Documentation

char * SfxEntry::add ( const char *  word,
int  len 
)

Definition at line 173 of file affentry.cpp.

{
    int                     cond;
    char              tword[MAXWORDLEN+1];

     /* make sure all conditions match */
     if ((len > stripl) && (len >= numconds)) {
            unsigned char * cp = (unsigned char *) (word + len);
            for (cond = numconds; --cond >=0; ) {
              if ((conds[*--cp] & (1 << cond)) == 0)
                 break;
            }
            if (cond < 0) {
             /* we have a match so add suffix */
              strcpy(tword,word);
              int tlen = len;
              if (stripl) {
               tlen -= stripl;
              }
              char * pp = (tword + tlen);
              if (appndl) {
                 strcpy(pp,appnd);
                  tlen += appndl;
             } else *pp = '\0';
               return mystrdup(tword);
           }
     }
     return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool SfxEntry::allowCross ( ) [inline]

Definition at line 66 of file affentry.hxx.

{ return ((xpflg & XPRODUCT) != 0); }

Here is the caller graph for this function:

struct hentry * SfxEntry::check ( const char *  word,
int  len,
int  optflags,
AffEntry ppfx 
) [read]

Definition at line 206 of file affentry.cpp.

{
    int                       tmpl;               // length of tmpword 
    int                     cond;          // condition beng examined
    struct hentry *     he;              // hash entry pointer
    unsigned char *  cp;
    char              tmpword[MAXWORDLEN+1];
    PfxEntry* ep = (PfxEntry *) ppfx;


    // if this suffix is being cross checked with a prefix
    // but it does not support cross products skip it

    if ((optflags & XPRODUCT) != 0 &&  (xpflg & XPRODUCT) == 0)
        return NULL;

    // upon entry suffix is 0 length or already matches the end of the word.
    // So if the remaining root word has positive length
    // and if there are enough chars in root word and added back strip chars
    // to meet the number of characters conditions, then test it

    tmpl = len - appndl;

    if ((tmpl > 0)  &&  (tmpl + stripl >= numconds)) {

           // generate new root word by removing suffix and adding
           // back any characters that would have been stripped or
           // or null terminating the shorter string

           strcpy (tmpword, word);
           cp = (unsigned char *)(tmpword + tmpl);
           if (stripl) {
              strcpy ((char *)cp, strip);
              tmpl += stripl;
              cp = (unsigned char *)(tmpword + tmpl);
           } else *cp = '\0';

            // now make sure all of the conditions on characters
            // are met.  Please see the appendix at the end of
            // this file for more info on exactly what is being
            // tested

           for (cond = numconds;  --cond >= 0; ) {
              if ((conds[*--cp] & (1 << cond)) == 0) break;
           }

            // if all conditions are met then check if resulting
            // root word in the dictionary

           if (cond < 0) {
               if ((he = pmyMgr->lookup(tmpword)) != NULL) {
                     if (TESTAFF(he->astr, achar , he->alen) && 
                           ((optflags & XPRODUCT) == 0 || 
                           TESTAFF(he->astr, ep->getFlag(), he->alen))) return he;
               }  
           }
    }
    return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned char SfxEntry::getFlag ( ) [inline]

Definition at line 67 of file affentry.hxx.

{ return achar;   }

Here is the caller graph for this function:

Definition at line 74 of file affentry.hxx.

{ return flgnxt; }
const char* SfxEntry::getKey ( ) [inline]

Definition at line 68 of file affentry.hxx.

{ return rappnd; } 

Here is the caller graph for this function:

SfxEntry* SfxEntry::getNext ( ) [inline]

Definition at line 71 of file affentry.hxx.

{ return next;   }

Here is the caller graph for this function:

Definition at line 73 of file affentry.hxx.

{ return nexteq; }

Here is the caller graph for this function:

Definition at line 72 of file affentry.hxx.

{ return nextne; }

Here is the caller graph for this function:

void SfxEntry::setFlgNxt ( SfxEntry ptr) [inline]

Definition at line 79 of file affentry.hxx.

{ flgnxt = ptr; }

Here is the caller graph for this function:

void SfxEntry::setNext ( SfxEntry ptr) [inline]

Definition at line 76 of file affentry.hxx.

{ next = ptr;   }

Here is the caller graph for this function:

void SfxEntry::setNextEQ ( SfxEntry ptr) [inline]

Definition at line 78 of file affentry.hxx.

{ nexteq = ptr; }

Here is the caller graph for this function:

void SfxEntry::setNextNE ( SfxEntry ptr) [inline]

Definition at line 77 of file affentry.hxx.

{ nextne = ptr; }

Here is the caller graph for this function:


Member Data Documentation

char AffEntry::achar [protected, inherited]

Definition at line 13 of file baseaffix.hxx.

char* AffEntry::appnd [protected, inherited]

Definition at line 7 of file baseaffix.hxx.

short AffEntry::appndl [protected, inherited]

Definition at line 9 of file baseaffix.hxx.

char AffEntry::conds[SETSIZE] [protected, inherited]

Definition at line 14 of file baseaffix.hxx.

Definition at line 56 of file affentry.hxx.

Definition at line 53 of file affentry.hxx.

Definition at line 54 of file affentry.hxx.

Definition at line 55 of file affentry.hxx.

short AffEntry::numconds [protected, inherited]

Definition at line 11 of file baseaffix.hxx.

Definition at line 50 of file affentry.hxx.

char* SfxEntry::rappnd [private]

Definition at line 51 of file affentry.hxx.

char* AffEntry::strip [protected, inherited]

Definition at line 8 of file baseaffix.hxx.

short AffEntry::stripl [protected, inherited]

Definition at line 10 of file baseaffix.hxx.

short AffEntry::xpflg [protected, inherited]

Definition at line 12 of file baseaffix.hxx.


The documentation for this class was generated from the following files: