/* * Copyright (c) 1995, 1996 Gunther Schadow. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef PG_HASHCODE_H_ #define PG_HASHCODE_H_ #include #pragma interface #include class HashCode : public Code { public: const int invalid = -3; const int not_present = -2; const int null = -1; void unset(); void nullify(); operator const char* () const; operator int () const; const HashCode& operator = (const HashCode&); const HashCode& operator = (const char*); const HashCode& operator = (int); bool operator == (const HashCode&) const; bool operator != (const HashCode&) const; bool operator == (const char*) const; bool operator != (const char*) const; bool operator == (int) const; bool operator != (int) const; bool OK() const; int lookup(const char *str) /* const -- gperf problem */; bool valid(int i) const; protected: HashCode(const char *table[], int first, int last); HashCode(int val, const char *table[], int first, int last); HashCode(const char *s, const char *table[], int first, int last); virtual int in_word_set(const char *str, int len) =0; /* const -- gperf problem */ ; private: const char **_table; int _first; int _last; int _val; void set(const char *); }; #ifndef OUTLINE # include "HashCode.icc" #endif #endif /* !PG_LINEARCODE_H_ */