7 #define OPENIMAGEIO_USTRING_H 
   15 #    pragma warning(disable : 4251 4996) 
   31 #define OIIO_USTRING_HAS_USTRINGHASH 1 
   32 #define OIIO_USTRING_HAS_CTR_FROM_USTRINGHASH 1 
   33 #define OIIO_USTRING_HAS_STDHASH 1 
   34 #define OIIO_HAS_USTRINGHASH_FORMATTER 1 
  148         m_chars = str ? make_unique(str) : 
nullptr;
 
  156         m_chars = str.
data() ? make_unique(str) : 
nullptr;
 
  162         : m_chars(make_unique(std::
string(str, pos, n).
c_str()))
 
  183         m_chars = make_unique(sref);
 
  188         : m_chars(str.m_chars)
 
  197         m_chars = make_unique(sref);
 
  200 #ifndef __CUDA_ARCH__ 
  212     explicit operator std::string() const noexcept { 
return string(); }
 
  217         m_chars = str.m_chars;
 
  246         m_chars = str ? make_unique(str) : 
nullptr;
 
  267         m_chars = str.
length() ? make_unique(str) : 
nullptr;
 
  290     const char* 
c_str() const noexcept { 
return m_chars; }
 
  296     const std::string& 
string() const noexcept
 
  302             return empty_std_string;
 
  306     void clear() noexcept { m_chars = 
nullptr; }
 
  364         if (m_chars == 
nullptr) {
 
  368         char* 
c = strncpy(s, 
c_str() + pos, n);  
 
  386         return string().find(str, pos);
 
  391         return string().find(s, pos, n);
 
  396         return string().find(s, pos);
 
  401         return string().find(c, pos);
 
  411         return string().rfind(str, pos);
 
  416         return string().rfind(s, pos, n);
 
  421         return string().rfind(s, pos);
 
  426         return string().rfind(c, pos);
 
  438         return string().find_first_of(str, pos);
 
  443         return string().find_first_of(s, pos, n);
 
  448         return string().find_first_of(s, pos);
 
  453         return string().find_first_of(c, pos);
 
  465         return string().find_last_of(str, pos);
 
  470         return string().find_last_of(s, pos, n);
 
  475         return string().find_last_of(s, pos);
 
  480         return string().find_last_of(c, pos);
 
  492         return string().find_first_not_of(str, pos);
 
  497         return string().find_first_not_of(s, pos, n);
 
  502         return string().find_first_not_of(s, pos);
 
  507         return string().find_first_not_of(c, pos);
 
  519         return string().find_last_not_of(str, pos);
 
  524         return string().find_last_not_of(s, pos, n);
 
  529         return string().find_last_not_of(s, pos);
 
  534         return string().find_last_not_of(c, pos);
 
  550         return strcmp(
c_str() ? 
c_str() : 
"", str ? str : 
"");
 
  567         return c_str() == str.c_str();
 
  576         return c_str() != str.c_str();
 
  597         return b.compare(
a) == 0;
 
  604         return b.compare(
a) == 0;
 
  611         return b.compare(
a) == 0;
 
  633         return b.compare(
a) != 0;
 
  640         return b.compare(
a) != 0;
 
  647         return b.compare(
a) != 0;
 
  660     template<
typename... Args>
 
  672     template<
typename... Args>
 
  682     template<
typename... Args>
 
  696         if (str.
c_str() && out.good())
 
  702     static std::string getstats(
bool verbose = 
true);
 
  708     static size_t total_ustrings();
 
  713     static size_t hash_collisions(std::vector<ustring>* collisions = 
nullptr);
 
  727         return str == 
nullptr || make_unique(str) == str;
 
  766         const char* 
c_str() const noexcept { 
return (
const char*)(
this + 1); }
 
  770     static std::string empty_std_string;
 
  837         : m_hash(
ustring(str, len).hash())
 
  867     explicit operator std::string() const noexcept
 
  890 #ifndef __CUDA_ARCH__ 
  901     const std::string& 
string() const noexcept
 
  916 #ifndef __CUDA_ARCH__ 
  932         return m_hash == str.m_hash;
 
  939         return m_hash != str.m_hash;
 
  943     OIIO_CONSTEXPR17 
bool operator==(
const char* str) 
const noexcept
 
  949     OIIO_CONSTEXPR17 
bool operator!=(
const char* str) 
const noexcept
 
  954 #ifndef __CUDA_ARCH__ 
  958         return m_hash == str.hash();
 
  969         return m_hash != str.hash();
 
  979         return hash() < 
x.hash();
 
 1008 static_assert(
sizeof(
ustringhash) == 
sizeof(uint64_t),
 
 1009               "ustringhash should be the same size as a uint64_t");
 
 1010 static_assert(
sizeof(
ustring) == 
sizeof(
const char*),
 
 1011               "ustring should be the same size as a const char*");
 
 1023 #ifndef __CUDA_ARCH__ 
 1036 operator""_us(
const char* str, std::size_t len)
 
 1044 operator""_ush(
const char* str, std::size_t len)
 
 1051 #if OIIO_VERSION_LESS(3, 0, 0) 
 1055 using ustringHash = std::hash<ustring>;
 
 1077         return size_t(
a.data()) < 
size_t(
b.data());
 
 1108 #ifndef __CUDA_ARCH__ 
 1142         return static_cast<std::size_t
>(u.hash());
 
 1152         return static_cast<std::size_t
>(u.hash());
 
 1163     template<
typename FormatContext>
 
 1174     template<
typename FormatContext>
 
GLsizei GLenum GLsizei GLsizei GLuint memory
 
const ustring & assign(const char *str)
Assign a null-terminated C string (char*) to *this. 
 
bool operator==(const ustring &str) const noexcept
 
static OIIO_FORMAT_DEPRECATED ustring format(const char *fmt, const Args &...args)
 
OIIO_HOSTDEVICE constexpr bool operator==(const ustringhash &str) const noexcept
Test for equality with another ustringhash. 
 
size_type find_last_of(const char *s, size_type pos, size_type n) const 
 
bool OIIO_UTIL_API iequals(string_view a, string_view b)
 
size_type find_last_of(const std::string &str, size_type pos=npos) const noexcept
 
bool operator==(const char *x) const noexcept
Test a ustring (this) for lexicographic equality with char x. 
 
ustringhash(const ustring &str) noexcept
Construct from a ustring. 
 
bool operator==(const ustring &str) const noexcept
Test for equality with a ustring. 
 
size_type find(const char *s, size_type pos=0) const 
 
OIIO_CONSTEXPR17 bool operator!=(const char *str) const noexcept
Test for inequality with a char*. 
 
size_type copy(char *s, size_type n, size_type pos=0) const 
 
size_type find_first_not_of(char c, size_type pos=0) const noexcept
 
friend bool operator!=(string_view a, const ustring &b) noexcept
 
OIIO_HOSTDEVICE constexpr hash_t hash() const noexcept
Return a hashed version of the string. 
 
const ustring & assign(string_view str)
Assign a string_view to *this. 
 
OIIO_HOSTDEVICE constexpr bool operator!=(const ustringhash &str) const noexcept
Test for inequality with another ustringhash. 
 
size_type find_first_of(const char *s, size_type pos, size_type n) const 
 
size_type rfind(char c, size_type pos=npos) const noexcept
 
size_type find_last_not_of(char c, size_type pos=npos) const noexcept
 
OIIO_CONSTEXPR14 basic_string_view substr(size_type pos, size_type n=npos) const noexcept
 
const ustringhash & operator=(const ustring &str)
Assign from a ustring. 
 
size_t length() const noexcept
Return the number of characters in the string. 
 
size_type rfind(const char *s, size_type pos=npos) const 
 
GLsizei const GLchar *const * string
 
GLsizei const GLfloat * value
 
static bool is_unique(const char *str)
 
CompareResults OIIO_API compare(const ImageBuf &A, const ImageBuf &B, float failthresh, float warnthresh, float failrelative, float warnrelative, ROI roi={}, int nthreads=0)
 
bool operator!=(const char *x) const noexcept
 
static OIIO_NODISCARD ustring fmtformat(const char *fmt, const Args &...args)
 
const ustring & operator=(const char *str)
Assign a null-terminated C string (char *) to a ustring. 
 
std::string to_string(const T &value)
 
OIIO_NODISCARD std::string format(const Str &fmt, Args &&...args)
 
GLboolean GLboolean GLboolean GLboolean a
 
ustring::hash_t rep_t
The underlying representation type. 
 
GLuint GLsizei GLsizei * length
 
size_type find_last_of(char c, size_type pos=npos) const noexcept
 
ustring(size_type n, char c)
Construct a ustring from n copies of character c. 
 
const ustring & operator=(char c)
Assign a single char to a ustring. 
 
friend std::ostream & operator<<(std::ostream &out, const ustringhash &str)
 
bool operator!=(const std::string &x) const noexcept
 
bool operator!=(string_view x) const noexcept
 
ustring substr(size_type pos=0, size_type n=npos) const 
 
const ustring & assign(const std::string &str, size_type pos, size_type n=npos)
Assign a substring of a std::string to *this. 
 
String-related utilities, all in namespace Strutil. 
 
bool operator==(const std::string &x) const noexcept
 
friend bool operator!=(const std::string &a, const ustring &b) noexcept
 
const ustring & operator=(string_view str)
Assign a string_view to a ustring. 
 
ustring(const std::string &str, size_type pos, size_type n=npos)
Construct a ustring from an indexed substring of a std::string. 
 
hash_t hash() const noexcept
Return a hashed version of the string. 
 
#define FMT_END_NAMESPACE
 
OIIO_DEVICE_CONSTEXPR ustringhash(const char *str)
Construct a ustringhash from a null-terminated C string (char *). 
 
OIIO_UTIL_API float stof(string_view s, size_t *pos=0)
 
basic_string_view< char > string_view
 
static OIIO_NODISCARD constexpr ustringhash from_hash(hash_t hash)
 
size_t operator()(ustring a, ustring b) const noexcept
 
const_iterator begin() const noexcept
 
friend bool operator!=(const ustring &a, const ustringhash &b) noexcept
 
OIIO_CONSTEXPR17 bool operator==(const char *str) const noexcept
Test for equality with a char*. 
 
constexpr size_t strhash(size_t len, const char *s)
 
size_type find_last_not_of(const char *s, size_type pos, size_type n) const 
 
const_reverse_iterator rend() const noexcept
 
size_type find_last_not_of(const ustring &str, size_type pos=npos) const noexcept
 
size_type find(const ustring &str, size_type pos=0) const noexcept
 
FMT_CONSTEXPR_CHAR_TRAITS auto compare(basic_string_view other) const -> int
 
const_reverse_iterator rbegin() const noexcept
 
ustring(const char *str, size_type pos, size_type n)
 
size_type find_first_of(const char *s, size_type pos=0) const 
 
const_reference operator[](size_type pos) const noexcept
 
friend std::ostream & operator<<(std::ostream &out, const ustring &str)
Generic stream output of a ustring. 
 
size_type find_first_not_of(const ustring &str, size_type pos=0) const noexcept
 
size_t operator()(ustring a, ustring b) const noexcept
 
size_type find_first_not_of(const char *s, size_type pos, size_type n) const 
 
~ustring() noexcept
ustring destructor. 
 
static OIIO_NODISCARD ustring sprintf(const char *fmt, const Args &...args)
 
size_type rfind(const char *s, size_type pos, size_type n) const 
 
const ustring & assign(const char *str, size_type n)
Assign the first n characters of str to *this. 
 
size_type find(const char *s, size_type pos, size_type n) const 
 
GLint GLint GLsizei GLint GLenum format
 
uint64_t hash_t
The hash type. 
 
const ustring & assign(size_type n, char c)
Assign n copies of c to *this. 
 
static OIIO_NODISCARD ustring from_hash(hash_t hash)
 
int compare(string_view str) const noexcept
 
const std::string & string() const noexcept
Return a C++ std::string representation of a ustring. 
 
ustring(const ustring &str, size_type pos, size_type n=npos)
Construct a ustring from an indexed substring of a ustring. 
 
size_t length() const noexcept
Return the number of characters in the string. 
 
std::string::const_reverse_iterator const_reverse_iterator
 
ustring(const char *str)
Construct a ustring from a null-terminated C string (char *). 
 
std::size_t operator()(OIIO::ustring u) const noexcept
 
GLboolean GLboolean GLboolean b
 
const ustring & assign(const ustring &str)
Assign a ustring to *this. 
 
bool operator<(const ustring &x) const noexcept
 
ustringhash uhash() const noexcept
Return a hashed version of the string. 
 
const ustring & assign(const std::string &str)
Assign a std::string to *this. 
 
friend bool operator==(const std::string &a, const ustring &b) noexcept
 
OIIO_HOSTDEVICE constexpr ustringhash(hash_t hash) noexcept
 
const_iterator end() const noexcept
 
const char * c_str() const noexcept
Return a pointer to the characters. 
 
bool operator!=(const ustring &str) const noexcept
 
constexpr ustring() noexcept
Default ctr for ustring – make an empty string. 
 
const char * data() const noexcept
Return a C string representation of a ustring. 
 
friend bool operator==(const ustring &a, const ustringhash &b) noexcept
 
size_type rfind(const std::string &str, size_type pos=npos) const noexcept
 
OIIO_DEVICE_CONSTEXPR ustringhash(string_view str)
 
size_type find(const std::string &str, size_type pos=0) const noexcept
 
ustring(const char *str, size_type n)
Construct a ustring from the first n characters of str. 
 
GLfloat GLfloat GLfloat GLfloat h
 
size_type find_first_not_of(const std::string &str, size_type pos=0) const noexcept
 
std::string::const_iterator const_iterator
 
void clear() noexcept
Reset to an empty string. 
 
const ustring & assign(const ustring &str, size_type pos, size_type n=npos)
Assign a substring of a ustring to *this. 
 
size_type find_last_of(const char *s, size_type pos=npos) const 
 
OIIO_HOSTDEVICE constexpr ustringhash() noexcept
 
size_type find_last_not_of(const std::string &str, size_type pos=npos) const noexcept
 
#define OIIO_FMT_CUSTOM_FORMATTER_CONST
 
OIIO_HOSTDEVICE constexpr const ustringhash & operator=(const ustringhash &str)
Assign from a ustringhash. 
 
bool operator==(string_view x) const noexcept
 
size_type find_first_of(char c, size_type pos=0) const noexcept
 
size_t size() const noexcept
Return the number of characters in the string. 
 
size_t size() const noexcept
Return the number of characters in the string. 
 
size_type find_first_of(const ustring &str, size_type pos=0) const noexcept
 
operator std::string() const noexcept
Conversion to std::string (explicit only!). 
 
size_type rfind(const ustring &str, size_type pos=npos) const noexcept
 
OIIO_HOSTDEVICE constexpr std::size_t operator()(OIIO::ustringhash u) const noexcept
 
ustring(const ustring &str) noexcept
Copy construct a ustring from another ustring. 
 
bool iequals(ustring a, ustring b)
 
ustring::hash_t hash_t
The hash type. 
 
const value_type & const_reference
 
**If you just want to fire and args
 
constexpr auto data() const noexcept-> const Char *
 
friend bool operator==(const char *a, const ustring &b) noexcept
 
size_type find_last_of(const ustring &str, size_type pos=npos) const noexcept
 
size_type find(char c, size_type pos=0) const noexcept
 
int compare(const char *str) const noexcept
 
OIIO_UTIL_API const char * c_str(string_view str)
 
bool operator!=(const ustring &str) const noexcept
Test for inequality with a ustring. 
 
friend bool operator!=(const char *a, const ustring &b) noexcept
 
#define OIIO_FORMAT_DEPRECATED
 
static ustring from_unique(const char *unique)
 
#define FMT_BEGIN_NAMESPACE
 
#define OIIO_NAMESPACE_END
 
auto sprintf(const S &fmt, const T &...args) -> std::basic_string< Char >
 
PUGI__FN I unique(I begin, I end)
 
size_type find_first_not_of(const char *s, size_type pos=0) const 
 
OIIO_HOSTDEVICE constexpr bool empty() const noexcept
 
OIIO_HOSTDEVICE constexpr bool operator<(const ustringhash &x) const noexcept
 
size_type find_last_not_of(const char *s, size_type pos=npos) const 
 
const char * data() const noexcept
Return a C string representation of a ustring. 
 
const char * c_str() const noexcept
 
const std::string & string() const noexcept
Return a C++ std::string representation of a ustring. 
 
bool empty() const noexcept
 
OIIO_HOSTDEVICE void clear() noexcept
Reset to an empty string. 
 
std::string OIIO_UTIL_API concat(string_view s, string_view t)
 
const char * c_str() const noexcept
Return a C string representation of a ustring. 
 
OIIO_DEVICE_CONSTEXPR ustringhash(const char *str, size_t len)
 
constexpr size_type length() const noexcept
 
const ustring & operator=(const ustring &str)
Assign a ustring to another ustring. 
 
friend bool operator==(string_view a, const ustring &b) noexcept
 
const char * rep_t
The underlying representation type. 
 
const ustring & operator=(const std::string &str)
Assign a C++ std::string to a ustring. 
 
#define OIIO_NAMESPACE_BEGIN
 
size_type find_first_of(const std::string &str, size_type pos=0) const noexcept
 
friend int compare(const std::string &a, const ustring &b) noexcept