HDK
|
#include <ustring.h>
Public Types | |
using | rep_t = ustring::hash_t |
The underlying representation type. More... | |
using | hash_t = ustring::hash_t |
The hash type. More... | |
Public Member Functions | |
OIIO_HOSTDEVICE constexpr | ustringhash () noexcept |
~ustringhash () noexcept=default | |
ustringhash destructor. More... | |
OIIO_HOSTDEVICE constexpr | ustringhash (const ustringhash &str) noexcept |
Copy construct a ustringhash from another ustringhash. More... | |
ustringhash (const ustring &str) noexcept | |
Construct from a ustring. More... | |
OIIO_DEVICE_CONSTEXPR | ustringhash (const char *str) |
Construct a ustringhash from a null-terminated C string (char *). More... | |
OIIO_DEVICE_CONSTEXPR | ustringhash (const char *str, size_t len) |
OIIO_DEVICE_CONSTEXPR | ustringhash (string_view str) |
OIIO_HOSTDEVICE constexpr | ustringhash (hash_t hash) noexcept |
operator string_view () const noexcept | |
Conversion to an OIIO::string_view. More... | |
operator std::string () const noexcept | |
Conversion to std::string (explicit only!). More... | |
OIIO_HOSTDEVICE constexpr const ustringhash & | operator= (const ustringhash &str) |
Assign from a ustringhash. More... | |
const ustringhash & | operator= (const ustring &str) |
Assign from a ustring. More... | |
OIIO_HOSTDEVICE void | clear () noexcept |
Reset to an empty string. More... | |
const char * | c_str () const noexcept |
Return a pointer to the characters. More... | |
const char * | data () const noexcept |
Return a C string representation of a ustring. More... | |
const std::string & | string () const noexcept |
Return a C++ std::string representation of a ustring. More... | |
size_t | length () const noexcept |
Return the number of characters in the string. More... | |
OIIO_HOSTDEVICE constexpr hash_t | hash () const noexcept |
Return a hashed version of the string. More... | |
size_t | size () const noexcept |
Return the number of characters in the string. More... | |
OIIO_HOSTDEVICE constexpr bool | empty () const noexcept |
OIIO_HOSTDEVICE constexpr bool | operator== (const ustringhash &str) const noexcept |
Test for equality with another ustringhash. More... | |
OIIO_HOSTDEVICE constexpr bool | operator!= (const ustringhash &str) const noexcept |
Test for inequality with another ustringhash. More... | |
OIIO_CONSTEXPR17 bool | operator== (const char *str) const noexcept |
Test for equality with a char*. More... | |
OIIO_CONSTEXPR17 bool | operator!= (const char *str) const noexcept |
Test for inequality with a char*. More... | |
bool | operator== (const ustring &str) const noexcept |
Test for equality with a ustring. More... | |
bool | operator!= (const ustring &str) const noexcept |
Test for inequality with a ustring. More... | |
OIIO_HOSTDEVICE constexpr bool | operator< (const ustringhash &x) const noexcept |
Static Public Member Functions | |
static OIIO_NODISCARD constexpr ustringhash | from_hash (hash_t hash) |
Friends | |
class | ustring |
bool | operator== (const ustring &a, const ustringhash &b) noexcept |
bool | operator!= (const ustring &a, const ustringhash &b) noexcept |
std::ostream & | operator<< (std::ostream &out, const ustringhash &str) |
A ustringhash holds the hash of a ustring in a type-safe way.
It has a nearly identical interface to a ustring, and still refers to a string in the internal ustring table. But whereas the representation of a ustring is the pointer to the characters, the representation of a ustringhash is the hash of the string.
For some uses where you don't need access to the characters in any performance-critical paths, this may be a more convenient representation. In particular, it's well suited to a GPU that doesn't have access to the character memory. Another interesting difference is that from run to run, a ustring may have a different literal value, since there's no reason to expect that the pointer to a string like "foo" will refer to the same memory location every time the program executes, but in contrast, the hash is guaranteed to be identical from run to run.
using ustringhash::hash_t = ustring::hash_t |
using ustringhash::rep_t = ustring::hash_t |
|
inlinenoexcept |
|
defaultnoexcept |
ustringhash destructor.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicitnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinestatic |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineexplicitnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
friend |
|
friend |
|
friend |