122 #define OPENIMAGEIO_USTRING_H
124 #if defined(_MSC_VER)
130 # pragma warning(disable : 4251 4996)
167 m_chars = str ? make_unique(str) :
nullptr;
175 m_chars = str.
data() ? make_unique(str) :
nullptr;
181 : m_chars(make_unique(std::
string(str, pos, n).c_str()))
195 : m_chars(make_unique(std::
string(n, c).c_str()))
205 m_chars = make_unique(sref);
211 : m_chars(str.m_chars)
221 m_chars = make_unique(sref);
235 m_chars = str.m_chars;
268 m_chars = str ? make_unique(str) :
nullptr;
291 m_chars = str.
length() ? make_unique(str) :
nullptr;
324 const char*
c_str()
const {
return m_chars; }
328 const char*
data()
const {
return c_str(); }
338 return empty_std_string;
343 void clear(
void) { m_chars =
nullptr; }
398 if (m_chars ==
nullptr) {
402 char*
c = strncpy(s, c_str() + pos, n);
422 return string().find(str, pos);
427 return string().find(s, pos, n);
432 return string().find(s, pos);
437 return string().find(c, pos);
447 return string().rfind(str, pos);
452 return string().rfind(s, pos, n);
457 return string().rfind(s, pos);
462 return string().rfind(c, pos);
472 return string().find_first_of(str, pos);
477 return string().find_first_of(s, pos, n);
482 return string().find_first_of(s, pos);
487 return string().find_first_of(c, pos);
497 return string().find_last_of(str, pos);
502 return string().find_last_of(s, pos, n);
507 return string().find_last_of(s, pos);
512 return string().find_last_of(c, pos);
522 return string().find_first_not_of(str, pos);
527 return string().find_first_not_of(s, pos, n);
532 return string().find_first_not_of(s, pos);
537 return string().find_first_not_of(c, pos);
548 return string().find_last_not_of(str, pos);
553 return string().find_last_not_of(s, pos, n);
558 return string().find_last_not_of(s, pos);
563 return string().find_last_not_of(c, pos);
572 return (c_str() == str.
c_str())
574 : strcmp(c_str() ? c_str() :
"",
583 return strcmp(c_str() ? c_str() :
"", str.c_str());
599 return strcmp(c_str() ? c_str() :
"", str ? str :
"");
697 template<
typename... Args>
709 template<
typename... Args>
718 template<
typename... Args>
728 if (str.
c_str() && out.good())
739 static size_t memory();
753 return str ==
nullptr || make_unique(str) == str;
786 const char*
c_str()
const {
return (
const char*)(
this + 1); }
821 return size_t(a.
data()) <
size_t(b.
data());
const ustring & assign(const char *str)
std::string::const_iterator const_iterator
friend bool operator!=(const char *a, const ustring &b)
const char * c_str() const
std::string sprintf(const char *fmt, const Args &...args)
size_type find_last_of(const char *s, size_type pos, size_type n) const
size_type find_first_of(const std::string &str, size_type pos=0) const
size_type find(const char *s, size_type pos=0) const
friend bool operator==(const char *a, const ustring &b)
size_type copy(char *s, size_type n, size_type pos=0) const
const_reference operator[](size_type pos) const
const ustring & assign(string_view str)
Assign a string_view to *this.
bool operator!=(string_view x) const
const value_type & const_reference
size_type find_first_of(const char *s, size_type pos, size_type n) const
int compare(const std::string &str) const
const_reverse_iterator rend() const
friend bool operator==(const std::string &a, const ustring &b)
size_type rfind(const char *s, size_type pos=npos) const
static bool is_unique(const char *str)
GLboolean GLboolean GLboolean GLboolean a
std::string format(const char *fmt, const Args &...args)
const ustring & operator=(const char *str)
std::string to_string(const T &value)
size_type find_first_not_of(const std::string &str, size_type pos=0) const
const std::string & string() const
ustring(size_type n, char c)
const ustring & operator=(char c)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
ustring substr(size_type pos=0, size_type n=npos) const
friend bool operator==(string_view a, const ustring &b)
const ustring & assign(const std::string &str, size_type pos, size_type n=npos)
String-related utilities, all in namespace Strutil.
const ustring & operator=(string_view str)
int compare(const char *str) const
ustring(const std::string &str, size_type pos, size_type n=npos)
int compare(string_view str) const
const charT * data() const
int compare(const ustring &str) const
size_type find_last_of(const std::string &str, size_type pos=npos) const
CompareResults OIIO_API compare(const ImageBuf &A, const ImageBuf &B, float failthresh, float warnthresh, ROI roi={}, int nthreads=0)
size_type find_last_not_of(const char *s, size_type pos, size_type n) const
friend bool operator!=(string_view a, const ustring &b)
static ustring fmtformat(const char *fmt, const Args &...args)
size_type rfind(char c, size_type pos=npos) const
GLint GLint GLint GLint GLint x
ustring(const char *str, size_type pos, size_type n)
size_type find_first_of(const char *s, size_type pos=0) const
friend std::ostream & operator<<(std::ostream &out, const ustring &str)
size_type find_first_not_of(const char *s, size_type pos, size_type n) const
size_type find_first_of(const ustring &str, size_type pos=0) const
size_type rfind(const char *s, size_type pos, size_type n) const
const ustring & assign(const char *str, size_type n)
size_type find(const char *s, size_type pos, size_type n) const
static ustring sprintf(const char *fmt, const Args &...args)
basic_string_view< char > string_view
const_iterator begin() const
const ustring & assign(size_type n, char c)
GLuint GLsizei GLsizei * length
size_type rfind(const ustring &str, size_type pos=npos) const
size_type find_last_not_of(char c, size_type pos=npos) const
size_t length(void) const
friend int compare(const std::string &a, const ustring &b)
size_type find_last_of(char c, size_type pos=npos) const
ustring(const ustring &str, size_type pos, size_type n=npos)
bool OIIO_API iequals(string_view a, string_view b)
bool operator==(const char *x) const
Test a ustring (this) for lexicographic equality with char x.
size_type rfind(const std::string &str, size_type pos=npos) const
const ustring & assign(const ustring &str)
const_iterator end() const
const ustring & assign(const std::string &str)
size_type find_first_not_of(const ustring &str, size_type pos=0) const
size_type find_last_of(const ustring &str, size_type pos=npos) const
GLdouble GLdouble GLdouble b
ustring(const char *str, size_type n)
GLsizei const GLchar *const * string
const ustring & assign(const ustring &str, size_type pos, size_type n=npos)
bool operator<(const ustring &x) const
size_type find_last_of(const char *s, size_type pos=npos) const
size_t operator()(ustring a, ustring b) const
size_t operator()(const ustring &s) const
friend bool operator!=(const std::string &a, const ustring &b)
size_type find(const std::string &str, size_type pos=0) const
static ustring format(const char *fmt, const Args &...args)
const char * data() const
ustring(const ustring &str)
bool iequals(ustring a, ustring b)
bool operator==(const ustring &str) const
size_type find_last_not_of(const ustring &str, size_type pos=npos) const
size_t operator()(ustring a, ustring b) const
string_view substr(size_type pos, size_type n=npos) const
bool operator!=(const ustring &str) const
int compare(basic_string_view other) const
size_type find_first_of(char c, size_type pos=0) const
bool operator!=(const std::string &x) const
static ustring from_unique(const char *unique)
size_type find_first_not_of(char c, size_type pos=0) const
bool operator!=(const char *x) const
const_reverse_iterator rbegin() const
#define OIIO_NAMESPACE_END
size_type find(const ustring &str, size_type pos=0) const
size_type find_first_not_of(const char *s, size_type pos=0) const
size_type find_last_not_of(const char *s, size_type pos=npos) const
std::string::const_reverse_iterator const_reverse_iterator
bool operator==(string_view x) const
OIIO_API float stof(string_view s, size_t *pos=0)
GLsizei const GLfloat * value
size_type find(char c, size_type pos=0) const
const char * c_str() const
size_type find_last_not_of(const std::string &str, size_type pos=npos) const
bool operator==(const std::string &x) const
const ustring & operator=(const ustring &str)
const ustring & operator=(const std::string &str)
#define OIIO_NAMESPACE_BEGIN