$#include "StringHash.h" /// 32-bit hash value for a string. class StringHash { public: /// Construct with zero value. StringHash(); /// Copy-construct from another hash. StringHash(const StringHash& rhs); /// Construct with an initial value. explicit StringHash(unsigned value); /// Construct from a C string case-insensitively. StringHash(const char* str); /// Construct from a string case-insensitively. StringHash(const String& str); /// Add a hash. StringHash operator + (const StringHash& rhs) const; // Test for equality with another hash. bool operator == (const StringHash& rhs) const; /// Test if less than another hash. bool operator < (const StringHash& rhs) const; /// Return hash value. unsigned Value() const; /// Calculate hash value case-insensitively from a C string. static unsigned Calculate(const char* str); /// Zero hash. static const StringHash ZERO; }; /// 16-bit hash value for a string. class ShortStringHash { public: /// Construct with zero hash value. ShortStringHash(); /// Copy-construct from another hash value. ShortStringHash(const ShortStringHash& rhs); /// Copy-construct from another 32-bit hash value (ignore the high bits.) explicit ShortStringHash(const StringHash& rhs); /// Construct with an initial value. explicit ShortStringHash(unsigned short value); /// Construct from a C string case-insensitively. ShortStringHash(const char* str); /// Construct from a string case-insensitively. ShortStringHash(const String& str); /// Add a hash. ShortStringHash operator + (const ShortStringHash& rhs) const; /// Test for equality with another hash. bool operator == (const ShortStringHash& rhs) const; /// Test if less than another hash. bool operator < (const ShortStringHash& rhs) const; /// Return hash value. unsigned short Value() const { return value_; } /// Calculate hash value case-insensitively from a C string. static unsigned short Calculate(const char* str); /// Zero hash. static const ShortStringHash ZERO; };