Annotation of parser3/src/include/pa_dictionary.h, revision 1.15
1.1 parser 1: /** @file
2: Parser: dictionary class decl.
3:
1.14 paf 4: Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com)
1.10 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1 parser 6: */
7:
8: #ifndef PA_DICTIONARY_H
9: #define PA_DICTIONARY_H
1.11 paf 10:
1.15 ! paf 11: static const char* IDENT_DICTIONARY_H="$Date: 2003/07/24 11:31:21 $";
1.1 parser 12:
13: #include "pa_table.h"
14:
15: /// simple dictionary, speding up lookups on contained two columned table
1.14 paf 16: class Dictionary: public PA_Object {
1.1 parser 17: public:
18:
1.15 ! paf 19: struct Subst {
! 20: const char *from; size_t from_length;
! 21: const String* to;
! 22:
! 23: Subst(int): from(0) {}
! 24: Subst(const char* afrom, const String* ato): from(afrom), to(ato) {
! 25: from_length=strlen(afrom);
! 26: }
! 27: operator bool() { return from!=0; }
! 28: };
! 29:
1.1 parser 30: /// construct wrapper, grabbing first letters of first column into @b first
1.14 paf 31: Dictionary(Table& atable);
1.1 parser 32:
33: /// find first row that contains string in first column which starts @b src
1.15 ! paf 34: Subst first_that_begins(const char* str) const;
1.1 parser 35:
1.2 parser 36: private:
1.1 parser 37:
1.15 ! paf 38: Array<Subst> substs;
1.1 parser 39:
40: private:
1.14 paf 41: friend void pa_dictionary_add_first(Table::element_type row, Dictionary* self);
1.15 ! paf 42: //friend bool starts(FromTo row, First_that_begins_info* info);
1.1 parser 43:
1.2 parser 44: int starting_line_of[0x100]; int constructor_line;
1.1 parser 45: };
46:
47: #endif
E-mail: