22 #ifndef _CACHED_STRING_HPP 23 #define _CACHED_STRING_HPP 25 #include <boost/noncopyable.hpp> 70 bool equals(
const string& other)
const;
79 const char*
c_str()
const;
80 const string&
str()
const;
82 std::size_t
hash()
const;
92 template<
typename Archive>
98 template<
class Archive>
106 BOOST_SERIALIZATION_SPLIT_MEMBER()
144 bool equals(
const string& other)
const;
152 const char*
c_str()
const;
153 const string&
str()
const;
156 std::size_t
hash()
const;
157 bool isCached()
const;
161 if(cached && other.
cached)
165 return str() < other.
str();
210 template<
typename Stream>
213 str =
CachedString(static_cast<std::stringstream const&>(std::stringstream() << stream.rdbuf()).
str());
218 template<
typename Stream>
243 :
public std::binary_function<MaybeCachedString, CachedString, bool>
bool operator!=(const CachedString &first, const CachedString &second)
Hasher for the StringStorageElement.
bool operator==(const StringStorageElement &other) const
This file is part of alaCarte.
Comparator for comparing STringStorageELements with strings.
void load(Archive &ar, const unsigned int version)
const string & str() const
Returns the internal string.
static void Shutdown()
Frees all internal memory used by the cache mechanism.
void assign(const string &str)
Assigns a std string.
~CachedString()
Tidies up the cached string.
Represents a string which could be cached into an internal cache.
CachedString()
Cretaes a new Cached string.
const string & str() const
Returns the internal string.
bool equals(const string &other) const
Compares this string with a given std string.
const StringStorageElement * internalString
void save(Archive &ar, const unsigned int version) const
const char * c_str() const
Returns the internal c string.
friend class MaybeCachedString
Stream & operator<<(Stream &stream, const CachedString &str)
const StringStorageElement * internalString
void clear()
Sets this string to the empty string.
CachedString::StringStorage StringStorage
std::size_t hash() const
Returns the internal hash.
bool operator<(const CachedString &other) const
std::size_t hash_value(const CachedString &cs)
Stream & operator>>(Stream &stream, CachedString &str)
Represents a string which is cached into an internal cache.
StringStorageElement(const string &str)
Creates a new StringStorageELement.
bool equals(const string &other) const
Compares this cached string with an non cached string.
bool operator()(const MaybeCachedString &str, const CachedString &cs) const
CachedString::StringStorageElement StringStorageElement
friend class boost::serialization::access
Storage class for cached strings.
CachedString & operator=(const string &str)
Assigns a std string.