#ifndef _PARSERULE_H #define _PARSERULE_H #include "extensions.h" #include "DBObjects.h" #include "StringMap.h" #include "Streams.h" //stateful ParseRules (may care about last action) //generic base class ParseRule: protected Phrase { protected: ParseRule() {} const char *endOfNames( const char **pos) const {return 0;} const char *lastName( const char **pos) const {return 0;} const char *jumpToEndOfNames(const char **pos) const {return endOfNames(pos);} public: virtual bool apply(const char **pos) const = 0; }; //------------------------------------- concrete Rules class IsEntity: public ParseRule { static StringMultiMapCI m_entities; //Tesco, France, John Williams, Lake Toha, Vacuum vector *m_entityids; public: IsEntity(vector *_entityids): m_entityids(_entityids), ParseRule() {} bool apply(const char **pos) const {return false;} }; class IsSalutation: public ParseRule { //for Mr. and Mrs. etc. to simply jump to the end of the name static StringMap m_salutations; //Map of Salutations public: IsSalutation(): ParseRule() {} bool apply(const char **pos) const {return false;} }; class IsGeographyReference: public ParseRule { //for Mr. and Mrs. etc. to simply jump to the end of the name static StringMap m_salutations; //Map of Salutations public: IsGeographyReference(): ParseRule() {} bool apply(const char **pos) const {return false;} }; class HasLtd: public ParseRule { //for Ltd. ltd limited precise company name static StringMap m_qualifiers; //Map of qualifiers public: HasLtd(): ParseRule() {} bool apply(const char **pos) const {return false;} }; class IsUnknown: public ParseRule { public: IsUnknown(): ParseRule() {} bool apply(const char **pos) const {return false;} }; #endif