NVIDIA Iray: Math API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::base::String Class Reference

String class with char character type. More...

Public Types

typedef char  value_type
  Character type. More...
 
typedef Size  size_type
  Size type. More...
 
typedef Difference  difference_type
  Difference type. More...
 
typedef char &  reference
  Reference type. More...
 
typedef const char &  const_reference
  Const-reference type. More...
 
typedef char *  pointer
  Pointer type. More...
 
typedef const char *  const_pointer
  Const-pointer type. More...
 
typedef pointer  iterator
  Random-access iterator type. More...
 
typedef const_pointer  const_iterator
  Random-access const-iterator type. More...
 

Public Member Functions

  String ()
  Default constructor initializes to the empty string. More...
 
  String (const char *str)
  Constructor that copies the string str. More...
 
  String (const String &str)
  Copy constructor that copies the string str. More...
 
String operator= (const String &str)
  Assignment, assign str to this string. More...
 
  ~String ()
  Destructor. More...
 
bool  empty () const
  Returns true if this string is empty. More...
 
Size  size () const
  Returns the number of characters in the string (excluding the '\0' terminator) More...
 
Size  length () const
  Returns the number of characters in the string (excluding the '\0' terminator) More...
 
const char *  c_str () const
  Returns a non-null pointer to the C-style terminated string representation of this string. More...
 
const char &  operator[] (Size i) const
  Returns the i-th character of the string. More...
 
char &  operator[] (Size i)
  Returns the i-th character of the string. More...
 
String operator+= (const String &str)
  Appends str to this string. More...
 

Static Public Attributes

static const Size  npos = Size(-1)
  Null position. More...
 
static const Size  SHORT_SIZE = 24
  Maximum length of strings (including trailing '\0' ) stored without additional dynamic memory allocation. More...
 

Detailed Description

String class with char character type.

The string class provides basic construction and conversion from and to const char* C-type strings and concatenation. The operations provided follow the definition for a std::string class.

The string class contains an optimization for short strings. It does not contain optimizations for copying strings, such as reference counting.

Member Typedef Documentation

Random-access const-iterator type.

typedef const char* mi::base::String::const_pointer

Const-pointer type.

typedef const char& mi::base::String::const_reference

Const-reference type.

Random-access iterator type.

Pointer type.

Reference type.

Size type.

Character type.

Constructor & Destructor Documentation

mi::base::String::String ( )
inline

Default constructor initializes to the empty string.

mi::base::String::String ( const char *  str)
inline

Constructor that copies the string str.

mi::base::String::String ( const String str)
inline

Copy constructor that copies the string str.

mi::base::String::~String ( )
inline

Destructor.

Member Function Documentation

const char* mi::base::String::c_str ( ) const
inline

Returns a non-null pointer to the C-style terminated string representation of this string.

bool mi::base::String::empty ( ) const
inline

Returns true if this string is empty.

A string is empty if size()==0 .

Size mi::base::String::length ( ) const
inline

Returns the number of characters in the string (excluding the '\0' terminator)

String& mi::base::String::operator+= ( const String str)
inline

Appends str to this string.

String& mi::base::String::operator= ( const String str)
inline

Assignment, assign str to this string.

const char& mi::base::String::operator[] ( Size  i) const
inline

Returns the i-th character of the string.

The character at position size() is always '\0'.

Precondition
i <= size().
char& mi::base::String::operator[] ( Size  i)
inline

Returns the i-th character of the string.

The character at position size() is always '\0'; it is not permissible to write to that position.

Precondition
i <= size().
Size mi::base::String::size ( ) const
inline

Returns the number of characters in the string (excluding the '\0' terminator)

Member Data Documentation

const Size mi::base::String::npos = Size(-1)
static

Null position.

const Size mi::base::String::SHORT_SIZE = 24
static

Maximum length of strings (including trailing '\0' ) stored without additional dynamic memory allocation.