12#ifndef OPENVDB_AX_CODEGEN_STRING_HAS_BEEN_INCLUDED
13#define OPENVDB_AX_CODEGEN_STRING_HAS_BEEN_INCLUDED
15#include <openvdb/version.h>
36 static_assert(
SSO_LENGTH >= 2,
"SSO should be greater than or equal to 2");
54 const std::string
str()
const {
return std::string(this->
ptr, this->
len); }
55 const char*
c_str()
const {
return this->
ptr; }
56 int64_t
size()
const {
return this->
len; }
62 inline operator const char*()
const {
return this->
ptr; }
78 return std::strcmp(this->
ptr, other.
ptr) == 0;
90 std::memcpy(s.
ptr, this->c_str(), this->size());
91 std::memcpy(s.
ptr + this->size(), other.
c_str(), other.
size());
112 else this->
ptr = this->
SSO;
#define OPENVDB_ASSERT(X)
Definition Assert.h:41
constexpr T zeroVal()
Return the value of type T that corresponds to zero.
Definition Math.h:70
Definition Exceptions.h:13
An extremely basic but native representation of a string class with SSO support. This exists to provi...
Definition String.h:34
static constexpr int64_t SSO_LENGTH
Definition String.h:35
const char * c_str() const
Definition String.h:55
bool operator==(const String &other) const
Definition String.h:76
String(const String &other)
Definition String.h:50
const String & operator=(const String &other)
Definition String.h:70
void reset(const char *str, const int64_t size)
Definition String.h:102
bool operator!=(const String &other) const
Definition String.h:81
String operator+(const String &other) const
Definition String.h:86
void alloc(const size_t size)
Definition String.h:108
char SSO[SSO_LENGTH]
Definition String.h:118
String()
Definition String.h:38
char * ptr
Definition String.h:117
const std::string str() const
Definition String.h:54
~String()
Definition String.h:48
int64_t size() const
Definition String.h:56
const String & operator=(const std::string &str)
Definition String.h:64
String(const std::string &str)
Definition String.h:41
void clear()
Definition String.h:58
bool isLocal() const
Definition String.h:57
String(const char *str)
Construct from null terminated character string.
Definition String.h:40
String(const char *str, const int64_t size)
Definition String.h:42
int64_t len
Definition String.h:119
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218