AtString class for fast comparisons.
More...
|
| | AtString::AtString (const char *str) |
| | Creating an AtString from a char* is an expensive operation. More...
|
| |
|
AI_DEVICE bool | AtString::operator== (const AtString &rhs) const |
| | Comparing two AtString objects is an extremely fast pointer comparison.
|
| |
|
AI_DEVICE bool | AtString::operator!= (const AtString &rhs) const |
| |
|
size_t | AtString::length () const |
| | Computing the length is a fast constant time operation.
|
| |
|
bool | AtString::empty () const |
| | Returns true if underlying char* is NULL or "".
|
| |
| | AtString::operator const char * () const |
| | AtString will automatically call c_str() in most situations and so can be automatically used in places that expect a char*. More...
|
| |
| AI_DEVICE const char * | AtString::c_str () const |
| | Returns the string as a const char*. More...
|
| |
|
AI_DEVICE void | AtString::clear () |
| |
| AI_DEVICE size_t | AtString::hash () const |
| | Returns a hashed version of the string. More...
|
| |
|
size_t | AtStringHash::operator() (const AtString &s) const |
| |
AtString class for fast comparisons.
◆ AtString()
| AtString::AtString |
( |
const char * |
str | ) |
|
|
inlineexplicit |
Creating an AtString from a char* is an expensive operation.
Try not to do this often. Copying AtString is just a fast pointer copy, so passing AtString by value is fine. Passing NULL to the AtString constructor is valid and c_str() will then return NULL.
◆ operator const char *()
| AtString::operator const char * |
( |
| ) |
const |
|
inline |
AtString will automatically call c_str() in most situations and so can be automatically used in places that expect a char*.
However, functions with a variable number of arguments (printf, AiMsg, ...) will require manually converting to char* with the c_str() member function.
void Bar(const char* str);
Bar(astr);
const char* cstr = astr;
printf(
"calling printf must use c_str() method: %s", astr.
c_str());
}
Arnold String allows for fast string comparisons.
Definition: ai_string.h:54
AI_DEVICE const char * c_str() const
Returns the string as a const char*.
Definition: ai_string.h:105
◆ c_str()
| AI_DEVICE const char * AtString::c_str |
( |
| ) |
const |
|
inline |
Returns the string as a const char*.
Calling this directly is not normally needed and instead an AtString can be directly used as if it was a const char*.
◆ hash()
| AI_DEVICE size_t AtString::hash |
( |
| ) |
const |
|
inline |
Returns a hashed version of the string.
This hash is not guaranteed to stay the same across Arnold versions, it should not be written to file or used to influence the look of a shader.