13#ifndef ML_CONSTANT_STRING_H
14#define ML_CONSTANT_STRING_H
20#include <ThirdPartyWarningsDisable.h>
22#include <boost/functional/hash.hpp>
23#include <ThirdPartyWarningsRestore.h>
25ML_UTILS_START_NAMESPACE
39 boost::hash<std::string> hasher;
40 _hash = hasher(_value);
78 _value->incRefCount();
84 _value = other._value;
91 if (_value != other._value) {
93 _value->decRefCount();
95 _value = other._value;
105 _value->decRefCount();
111 return toString() < other.
toString();
115 if (other._value == _value) {
119 if (_value && other._value) {
121 if (_value->getHash() == other._value->
getHash()) {
123 return _value->_value == other._value->_value;
127 }
else if (!_value && !other._value) {
137 operator std::string()
const {
139 return _value->_value;
141 return std::string();
145 operator const std::string&()
const {
147 return _value->_value;
155 return _value->_value;
162 return _value ==
nullptr;
167 return _value->getHash();
184ML_UTILS_END_NAMESPACE
Shared container for the string value and its hash.
ConstantStringValue(const std::string &value)
A ConstantString which contains a std::string and its hash.
ConstantString(const std::string &value)
bool operator==(const ConstantString &other) const
void operator=(const ConstantString &other)
ConstantString(const ConstantString &other)
bool operator<(const ConstantString &other) const
const std::string & toString() const
#define ML_UTILS_EXPORT
Defines platform dependent DLL export macro for mlUtils.
std::size_t hash_value(ConstantString const &b)