Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Private Attributes | Friends
nsWritingIterator< CharT > Class Template Reference

#include <nsStringIterator.h>

List of all members.

Public Types

typedef nsWritingIterator< CharTself_type
typedef ptrdiff_t difference_type
typedef CharT value_type
typedef CharTpointer
typedef CharTreference

Public Member Functions

 nsWritingIterator ()
void normalize_forward ()
void normalize_backward ()
pointer start () const
pointer end () const
pointer get () const
reference operator* () const
self_typeoperator++ ()
self_type operator++ (int)
self_typeoperator-- ()
self_type operator-- (int)
difference_type size_forward () const
difference_type size_backward () const
self_typeadvance (difference_type n)
PRUint32 write (const value_type *s, PRUint32 n)

Private Attributes

CharTmStart
CharTmEnd
CharTmPosition

Friends

class nsAString
class nsACString

Detailed Description

template<class CharT>
class nsWritingIterator< CharT >

See also:
nsTAString

Definition at line 197 of file nsStringIterator.h.


Member Typedef Documentation

template<class CharT>
typedef ptrdiff_t nsWritingIterator< CharT >::difference_type

Definition at line 201 of file nsStringIterator.h.

template<class CharT>
typedef CharT* nsWritingIterator< CharT >::pointer

Definition at line 203 of file nsStringIterator.h.

template<class CharT>
typedef CharT& nsWritingIterator< CharT >::reference

Definition at line 204 of file nsStringIterator.h.

template<class CharT>
typedef nsWritingIterator<CharT> nsWritingIterator< CharT >::self_type

Definition at line 200 of file nsStringIterator.h.

template<class CharT>
typedef CharT nsWritingIterator< CharT >::value_type

Definition at line 202 of file nsStringIterator.h.


Constructor & Destructor Documentation

template<class CharT>
nsWritingIterator< CharT >::nsWritingIterator ( ) [inline]

Definition at line 224 of file nsStringIterator.h.

{ }

Member Function Documentation

template<class CharT>
self_type& nsWritingIterator< CharT >::advance ( difference_type  n) [inline]

Definition at line 308 of file nsStringIterator.h.

        {
          if (n > 0)
            {
              difference_type step = NS_MIN(n, size_forward());

              NS_ASSERTION(step>0, "can't advance a writing iterator beyond the end of a string");

              mPosition += step;
            }
          else if (n < 0)
            {
              difference_type step = NS_MAX(n, -size_backward());

              NS_ASSERTION(step<0, "can't advance (backward) a writing iterator beyond the end of a string");

              mPosition += step;
            }
          return *this;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class CharT>
pointer nsWritingIterator< CharT >::end ( ) const [inline]

Definition at line 238 of file nsStringIterator.h.

        {
          return mEnd;
        }
template<class CharT>
pointer nsWritingIterator< CharT >::get ( ) const [inline]

Definition at line 244 of file nsStringIterator.h.

        {
          return mPosition;
        }

Here is the caller graph for this function:

template<class CharT>
void nsWritingIterator< CharT >::normalize_backward ( ) [inline]

Definition at line 229 of file nsStringIterator.h.

{}
template<class CharT>
void nsWritingIterator< CharT >::normalize_forward ( ) [inline]

Definition at line 228 of file nsStringIterator.h.

{}
template<class CharT>
reference nsWritingIterator< CharT >::operator* ( ) const [inline]

Definition at line 250 of file nsStringIterator.h.

        {
          return *get();
        }
template<class CharT>
self_type& nsWritingIterator< CharT >::operator++ ( ) [inline]

Definition at line 266 of file nsStringIterator.h.

        {
          ++mPosition;
          return *this;
        }
template<class CharT>
self_type nsWritingIterator< CharT >::operator++ ( int  ) [inline]

Definition at line 273 of file nsStringIterator.h.

        {
          self_type result(*this);
          ++mPosition;
          return result;
        }
template<class CharT>
self_type& nsWritingIterator< CharT >::operator-- ( ) [inline]

Definition at line 281 of file nsStringIterator.h.

        {
          --mPosition;
          return *this;
        }
template<class CharT>
self_type nsWritingIterator< CharT >::operator-- ( int  ) [inline]

Definition at line 288 of file nsStringIterator.h.

        {
          self_type result(*this);
          --mPosition;
          return result;
        }
template<class CharT>
difference_type nsWritingIterator< CharT >::size_backward ( ) const [inline]

Definition at line 302 of file nsStringIterator.h.

        {
          return mPosition - mStart;
        }

Here is the caller graph for this function:

template<class CharT>
difference_type nsWritingIterator< CharT >::size_forward ( ) const [inline]

Definition at line 296 of file nsStringIterator.h.

        {
          return mEnd - mPosition;
        }

Here is the caller graph for this function:

template<class CharT>
pointer nsWritingIterator< CharT >::start ( ) const [inline]

Definition at line 232 of file nsStringIterator.h.

        {
          return mStart;
        }
template<class CharT>
PRUint32 nsWritingIterator< CharT >::write ( const value_type s,
PRUint32  n 
) [inline]

Definition at line 330 of file nsStringIterator.h.

        {
          NS_ASSERTION(size_forward() > 0, "You can't |write| into an |nsWritingIterator| with no space!");

          nsCharTraits<value_type>::move(mPosition, s, n);
          advance( difference_type(n) );
          return n;
        }

Here is the call graph for this function:


Friends And Related Function Documentation

template<class CharT>
friend class nsACString [friend]

Definition at line 208 of file nsStringIterator.h.

template<class CharT>
friend class nsAString [friend]

Definition at line 207 of file nsStringIterator.h.


Member Data Documentation

template<class CharT>
CharT* nsWritingIterator< CharT >::mEnd [private]

Definition at line 220 of file nsStringIterator.h.

template<class CharT>
CharT* nsWritingIterator< CharT >::mPosition [private]

Definition at line 221 of file nsStringIterator.h.

template<class CharT>
CharT* nsWritingIterator< CharT >::mStart [private]

Definition at line 219 of file nsStringIterator.h.


The documentation for this class was generated from the following file: