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>
39 boost::hash<std::string>
hasher;
78 _value->incRefCount();
84 _value =
other._value;
86 _value->incRefCount();
91 if (_value !=
other._value) {
93 _value->decRefCount();
95 _value =
other._value;
97 _value->incRefCount();
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();
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
size_t hash_value(MLGlobalFunctionKey const &key)
Calculates the has key from last string segment.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
#define ML_UTILS_EXPORT
Defines platform dependent DLL export macro for mlUtils.