OOFILE  1.9
oofwords.h
Go to the documentation of this file.
1 // oofWordParser.h: oofWordParser class definition
2 // plus other string utilities
3 
4 #ifndef H_OOFWORDS
5 #define H_OOFWORDS
6 
7 #ifndef H_OOF2
8  #include "oof2.h"
9 #endif
10 
41 public:
42  oofWordParser(const char* stringToParse=0, unsigned short minWordLen = 3,
43  const char** stopWords = 0, unsigned short numStopWords = 0);
44  virtual ~oofWordParser();
45 
46  virtual void start();
47  virtual void start(const char* stringToParse);
48  virtual void next(void);
49  virtual bool more() const;
50  virtual const char* word() const;
51  virtual const char* wordString() const;
52  virtual unsigned short& minWordLength();
53  virtual bool isValidWord(const char *) const;
54 
55  virtual void generateSearchArray();
56  const char** generatedStrings() const;
57  unsigned long generatedCount() const;
58 
59  void extract(std::ostream&);
60 
61 protected:
62  enum {maxWordLength = 40};
63  const char* mpString;
64  const char* mpStringStart;
65  char mWord[maxWordLength];
66  unsigned short mWordLength;
67  unsigned short mMinWordLength;
68  const char** mStopWords;
69  unsigned short mNumStopWords;
70  const char** mGeneratedStrings;
71  unsigned long mGeneratedCount;
72  unsigned long mIterStrings;
73 };
74 
75 
79 inline const char**
81 {
82  return mGeneratedStrings;
83 }
84 
85 
86 inline unsigned long
88 {
89  return mGeneratedCount;
90 }
91 
92 
93 OOFILE_EXPORT inline std::ostream&
94 operator<<(std::ostream& os, oofWordParser& wp)
95 {
96  wp.extract(os);
97  return os;
98 }
99 
100 
108 public:
109  OOF_WordList();
110  ~OOF_WordList();
111  bool contains(const char*) const;
112  void append(const char*);
113  const char** orphanStringArray(unsigned long& outCount);
114 
115 private:
116  OOF_ExpandableLongArray mWords;
117 };
118 
119 #endif
120 
unsigned long mIterStrings
Definition: oofwords.h:72
unsigned long generatedCount() const
Definition: oofwords.h:87
Base class for user-replaceable word parser.
Definition: oofwords.h:40
Mixin for reference counted classes which you want to auto-delete when their count falls to zero...
Definition: oof1.h:82
const char * mpStringStart
pointer to original strings
Definition: oofwords.h:64
unsigned long mGeneratedCount
Definition: oofwords.h:71
const char * mpString
pointer to start of words to process, may point to mGeneratedStrings entries
Definition: oofwords.h:63
const char ** mStopWords
passed in list of stop words to ignore
Definition: oofwords.h:68
unsigned short mNumStopWords
Definition: oofwords.h:69
Array of longs which expands automatically as you write to cells.
Definition: oofarray.h:21
const char ** mGeneratedStrings
owned strings generated for subsearch call
Definition: oofwords.h:70
std::ostream & operator<<(std::ostream &, const oofE_Base &)
const char ** generatedStrings() const
return array of pointers to individual words.
Definition: oofwords.h:80
Contain a list of words parsed from an input string or field being word-indexed.
Definition: oofwords.h:107
unsigned short mMinWordLength
Definition: oofwords.h:67
#define OOFILE_EXPORT
Prefix for OOFILE database & general classes to enable optional DLL linking.
Definition: oof0.h:187
void extract(std::ostream &)
Definition: oofwords.cpp:257
unsigned short mWordLength
Definition: oofwords.h:66