3ds Max C++ API Reference
CharIterator< ChType > Class Template Reference

Iterate intelligently inside a string. More...

#include <maxchar.h>

+ Inheritance diagram for CharIterator< ChType >:

Public Member Functions

 CharIterator ()
 Construct this iterator with a NULL pointer. More...
 
 CharIterator (ChType *ptr)
 Construct this iterator with a string pointer. More...
 
 CharIterator (const CharIterator< ChType > &p)
 Copy an existing character iterator. More...
 
int CharLength () const
 Gets the number of elements of the current template type, for the current character pointed to by the iterator. More...
 
CharIterator< ChType > & operator= (const CharIterator< ChType > &p)
 Assignment operator. More...
 
CharIterator< ChType > & operator= (ChType *ptr)
 Assignment operator. More...
 
CharIterator< ChType > & operator++ ()
 Move to the next character. More...
 
CharIterator< ChType > operator++ (int)
 
CharIterator< ChType > & operator+= (size_t s)
 Move the iterator character forward by a specified amount. More...
 
CharIterator< ChType > operator+ (size_t s) const
 Move the iterator character forward by a specified amount. More...
 
const Char operator* () const
 Return the current character. More...
 
const Char operator[] (size_t index) const
 Return the nth character from the iterator. More...
 
bool AtEnd () const
 Determine if the iterator has reached the end of the string. More...
 
ChType * Get () const
 Obtain the current string pointer. More...
 
const Char Get (size_t index) const
 Return the nth character from the iterator. More...
 
 operator ChType * () const
 Obtain the current string pointer. More...
 
UtilExport int CharLength () const
 
UtilExport CharIterator< char > & operator++ ()
 
UtilExport CharIterator< char > operator++ (int)
 
UtilExport CharIterator< char > & operator+= (size_t s)
 
UtilExport CharIterator< char > operator+ (size_t s) const
 
UtilExport const Char operator* () const
 
UtilExport int CharLength () const
 
UtilExport CharIterator< const char > & operator++ ()
 
UtilExport CharIterator< const char > operator++ (int)
 
UtilExport CharIterator< const char > & operator+= (size_t s)
 
UtilExport CharIterator< const char > operator+ (size_t s) const
 
UtilExport const Char operator* () const
 
UtilExport int CharLength () const
 
UtilExport CharIterator< wchar_t > & operator++ ()
 
UtilExport CharIterator< wchar_t > operator++ (int)
 
UtilExport CharIterator< wchar_t > & operator+= (size_t s)
 
UtilExport CharIterator< wchar_t > operator+ (size_t s) const
 
UtilExport const Char operator* () const
 
UtilExport int CharLength () const
 
UtilExport CharIterator< const wchar_t > & operator++ ()
 
UtilExport CharIterator< const wchar_t > operator++ (int)
 
UtilExport CharIterator< const wchar_t > & operator+= (size_t s)
 
UtilExport CharIterator< const wchar_t > operator+ (size_t s) const
 
UtilExport const Char operator* () const
 

Protected Attributes

ChType * _ptr
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Detailed Description

template<typename ChType>
class MaxSDK::Util::CharIterator< ChType >

Iterate intelligently inside a string.

This class should be used to iterate through characters of a string. It guarantees that the string pointer never points to the end of a character. The template parameter should be either char, wchar_t, const wchar_t etc.

Constructor & Destructor Documentation

◆ CharIterator() [1/3]

CharIterator ( )
inline

Construct this iterator with a NULL pointer.

266  : _ptr(NULL)
267  { }
#define NULL
Definition: autoptr.h:18
ChType * _ptr
Definition: maxchar.h:261

◆ CharIterator() [2/3]

CharIterator ( ChType *  ptr)
inline

Construct this iterator with a string pointer.

271  : _ptr(ptr)
272  { }

◆ CharIterator() [3/3]

CharIterator ( const CharIterator< ChType > &  p)
inline

Copy an existing character iterator.

276  : _ptr(p._ptr)
277  { }

Member Function Documentation

◆ CharLength() [1/5]

int CharLength ( ) const

Gets the number of elements of the current template type, for the current character pointed to by the iterator.

◆ operator=() [1/2]

CharIterator<ChType>& operator= ( const CharIterator< ChType > &  p)
inline

Assignment operator.

Copies an existing character iterator.

289  {
290  _ptr = p._ptr;
291  return *this;
292  }

◆ operator=() [2/2]

CharIterator<ChType>& operator= ( ChType *  ptr)
inline

Assignment operator.

Copies another character as the templated type as this iterator.

296  {
297  _ptr = ptr;
298  return *this;
299  }

◆ operator++() [1/10]

CharIterator<ChType>& operator++ ( )

Move to the next character.

◆ operator++() [2/10]

CharIterator<ChType> operator++ ( int  )

◆ operator+=() [1/5]

CharIterator<ChType>& operator+= ( size_t  s)

Move the iterator character forward by a specified amount.

(It will stop at the first null character.)

◆ operator+() [1/5]

CharIterator<ChType> operator+ ( size_t  s) const

Move the iterator character forward by a specified amount.

(It will stop at the first null character.)

◆ operator*() [1/5]

const Char operator* ( ) const

Return the current character.

◆ operator[]()

const Char operator[] ( size_t  index) const
inline

Return the nth character from the iterator.

Parameters
index- The index of the character to retrieve from the string
319  {
320  CharIterator<ChType> it(*this);
321 
322  it += index;
323  return *it;
324  }

◆ AtEnd()

bool AtEnd ( ) const
inline

Determine if the iterator has reached the end of the string.

328  {
329  return *_ptr == 0;
330  }

◆ Get() [1/2]

ChType* Get ( ) const
inline

Obtain the current string pointer.

334  {
335  return _ptr;
336  }

◆ Get() [2/2]

const Char Get ( size_t  index) const
inline

Return the nth character from the iterator.

Parameters
index- The index of the character to retrieve from the string
342  {
343  CharIterator<ChType> it(*this);
344 
345  it += index;
346  return *it;
347  }

◆ operator ChType *()

operator ChType * ( ) const
inline

Obtain the current string pointer.

351  {
352  return _ptr;
353  }

◆ CharLength() [2/5]

UtilExport int CharLength ( ) const

◆ operator++() [3/10]

UtilExport CharIterator< char > & operator++ ( )

◆ operator++() [4/10]

UtilExport CharIterator< char > operator++ ( int  )

◆ operator+=() [2/5]

UtilExport CharIterator< char > & operator+= ( size_t  s)

◆ operator+() [2/5]

UtilExport CharIterator< char > operator+ ( size_t  s) const

◆ operator*() [2/5]

UtilExport const Char operator* ( ) const

◆ CharLength() [3/5]

UtilExport int CharLength ( ) const

◆ operator++() [5/10]

UtilExport CharIterator< const char > & operator++ ( )

◆ operator++() [6/10]

UtilExport CharIterator< const char > operator++ ( int  )

◆ operator+=() [3/5]

UtilExport CharIterator< const char > & operator+= ( size_t  s)

◆ operator+() [3/5]

UtilExport CharIterator< const char > operator+ ( size_t  s) const

◆ operator*() [3/5]

UtilExport const Char operator* ( ) const

◆ CharLength() [4/5]

UtilExport int CharLength ( ) const

◆ operator++() [7/10]

UtilExport CharIterator< wchar_t > & operator++ ( )

◆ operator++() [8/10]

UtilExport CharIterator< wchar_t > operator++ ( int  )

◆ operator+=() [4/5]

UtilExport CharIterator< wchar_t > & operator+= ( size_t  s)

◆ operator+() [4/5]

UtilExport CharIterator< wchar_t > operator+ ( size_t  s) const

◆ operator*() [4/5]

UtilExport const Char operator* ( ) const

◆ CharLength() [5/5]

UtilExport int CharLength ( ) const

◆ operator++() [9/10]

UtilExport CharIterator< const wchar_t > & operator++ ( )

◆ operator++() [10/10]

UtilExport CharIterator< const wchar_t > operator++ ( int  )

◆ operator+=() [5/5]

UtilExport CharIterator< const wchar_t > & operator+= ( size_t  s)

◆ operator+() [5/5]

UtilExport CharIterator< const wchar_t > operator+ ( size_t  s) const

◆ operator*() [5/5]

UtilExport const Char operator* ( ) const

Member Data Documentation

◆ _ptr

ChType* _ptr
protected