Updated German translation
[dasher.git] / Src / DasherCore / WordGeneratorBase.h
blob0f3ae55562cedd4e94bc5c34da425eaf73b85e7b
1 #ifndef __WordGeneratorBase_h__
2 #define __WordGeneratorBase_h__
4 #include <string>
5 #include <sstream>
6 #include "Alphabet/AlphabetMap.h"
7 #include "Alphabet/AlphIO.h"
9 using namespace std;
11 namespace Dasher {
12 /**
13 * The base class for all word generators. Word generators encapsulate
14 * logic for simply generating words based on implementation-specific
15 * conditions. The benefit of this is that a generator can
16 * easily be written that selects words based on a function of the current
17 * value of the Sri Lankan rupee and the amount of twitter feeds regarding
18 * the winter olympics, for example.
21 * A typical use case for any class deriving from CWordGeneratorBase
22 * would be the following:
23 * 1) Construct the object (providing any implementation-specific params)
24 * *
25 * 2) To retrieve a word, simply call GetNextWord. This will continue
26 * until the specific implementation determines that there are no
27 * more words for any reason. When there are no more, GetNextWord
28 * returns the empty string.
30 * Usage Example:
31 * CWordGeneratorBase gen = CWordGeneratorBase(params...);
32 * std::string word;
33 * while ((word = gen.GetNextWord()) != "") {
34 * Operate on the word
35 * }
36 */
37 class CWordGeneratorBase {
38 private:
39 const CAlphInfo *m_pAlph;
40 const CAlphabetMap *m_pAlphMap;
41 public:
42 CWordGeneratorBase(const CAlphInfo *pAlph, const CAlphabetMap *pAlphMap);
44 virtual ~CWordGeneratorBase() { }
46 void GetSymbols(std::vector<symbol> &into);
47 protected:
48 /// Gets the next line from this generator
49 /// @return the next line, or "" if exhausted
50 virtual std::string GetLine() = 0;
54 #endif