00001 /*========================================================================== 00002 * Copyright (c) 2001 Carnegie Mellon University. All Rights Reserved. 00003 * 00004 * Use of the Lemur Toolkit for Language Modeling and Information Retrieval 00005 * is subject to the terms of the software license set forth in the LICENSE 00006 * file included with this software, and also available at 00007 * http://www.lemurproject.org/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 00013 #ifndef _STRINGH_ 00014 #define _STRINGH_ 00015 00016 #include "common_headers.hpp" 00017 #include "ByteHash.hpp" 00018 namespace lemur 00019 { 00020 namespace utility 00021 { 00022 00023 class String : public string { 00024 public: 00025 String() : string() {} 00026 String(const char * p) : string(p) {} 00027 String(const string & s) : string(s) {} 00028 String(unsigned int n, char c) : string(n, c) {} 00029 00030 unsigned int Hash() const { return ByteHash(data(),length(),0); } 00031 unsigned int hash() const { return Hash(); } 00032 operator const char *() const { return c_str(); } 00033 friend ostream &operator<<(ostream &os, const String &ts); 00034 friend istream &operator>>(istream &is, String &ts); 00035 }; 00036 ostream &operator<<(ostream &os, const String &ts); 00037 istream &operator>>(istream &is, String &ts); 00038 } 00039 } 00040 00041 #endif