1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 21:19:24 +00:00

Introduce class KeywordExt.

This commit is contained in:
Bruno Haible
2002-11-04 12:09:45 +00:00
parent 5db232cb09
commit 8797dd362b
8 changed files with 93 additions and 58 deletions

View File

@@ -30,7 +30,7 @@ struct Keyword
/* Constructor. */
Keyword (const char *allchars, int allchars_length, const char *rest);
/* Data members. */
/* Data members defined immediately by the input file. */
/* The keyword as a string, possibly containing NUL bytes. */
const char *const allchars;
const int allchars_length;
@@ -38,6 +38,28 @@ struct Keyword
const char *const rest;
};
/* A keyword, in the context of a given keyposition list. */
struct KeywordExt : public Keyword
{
/* Constructor. */
KeywordExt (const char *allchars, int allchars_length, const char *rest);
/* Data members depending on the keyposition list. */
/* The selected characters that participate for the hash function,
reordered according to the keyposition list. */
const char * selchars;
int selchars_length;
/* Chained list of keywords having the same selchars. */
KeywordExt * duplicate_link;
/* Data members used by the algorithm. */
int occurrence; /* A metric for frequency of key set occurrences. */
int hash_value; /* Hash value for the key. */
/* Data members used by the output routines. */
int final_index;
};
/* A factory for creating Keyword instances. */
class Keyword_Factory
{
@@ -45,8 +67,8 @@ public:
Keyword_Factory ();
virtual ~Keyword_Factory ();
/* Creates a new Keyword. */
virtual Keyword create_keyword (const char *allchars, int allchars_length,
const char *rest) = 0;
virtual Keyword * create_keyword (const char *allchars, int allchars_length,
const char *rest) = 0;
};
#endif