ACE_String_Base_Const_Iterator< CHAR > Class Template Reference

Const iterator class for the ACE_String_Base class. More...

#include <String_Base.h>

List of all members.

Public Types

typedef
std::bidirectional_iterator_tag 
iterator_category
typedef const CHAR value_type
typedef const CHAR & reference
typedef const CHAR * pointer
typedef ptrdiff_t difference_type

Public Member Functions

 ACE_String_Base_Const_Iterator (const ACE_String_Base< CHAR > &str, int end=0)
 ACE_String_Base_Const_Iterator (const ACE_String_Base_Const_Iterator< CHAR > &iter)
 ~ACE_String_Base_Const_Iterator (void)
 Destructor.
int done (void) const
int next (const CHAR *&ch) const
int advance (void)
const
ACE_String_Base_Const_Iterator
< CHAR > & 
operator= (const ACE_String_Base_Const_Iterator< CHAR > &iter)
const CHAR & operator* (void)
ACE_String_Base_Const_Iterator
< CHAR > & 
operator++ (void)
ACE_String_Base_Const_Iterator
< CHAR > 
operator++ (int)
ACE_String_Base_Const_Iterator
< CHAR > & 
operator-- (void)
ACE_String_Base_Const_Iterator
< CHAR > 
operator-- (int)
bool operator== (const ACE_String_Base_Const_Iterator< CHAR > &rhs) const
bool operator!= (const ACE_String_Base_Const_Iterator< CHAR > &rhs) const
bool operator< (const ACE_String_Base_Const_Iterator< CHAR > &rhs) const
bool operator> (const ACE_String_Base_Const_Iterator< CHAR > &rhs) const
bool operator<= (const ACE_String_Base_Const_Iterator< CHAR > &rhs) const
bool operator>= (const ACE_String_Base_Const_Iterator< CHAR > &rhs) const

Private Attributes

const ACE_String_Base< CHAR > * str_
 Target string to iterate over.
size_t index_
 Current location in the string.

Detailed Description

template<class CHAR>
class ACE_String_Base_Const_Iterator< CHAR >

Const iterator class for the ACE_String_Base class.

This class is an implementation of an iterator that allows client applications it iterator over the contents of a string. Currently, now this iterator fall under the std::bidirectional_iterator_tag category. Future versions of the class will support the operations of std::random_access_iterator_tag.

Definition at line 734 of file String_Base.h.


Member Typedef Documentation

template<class CHAR>
typedef ptrdiff_t ACE_String_Base_Const_Iterator< CHAR >::difference_type

Definition at line 742 of file String_Base.h.

template<class CHAR>
typedef std::bidirectional_iterator_tag ACE_String_Base_Const_Iterator< CHAR >::iterator_category

Definition at line 738 of file String_Base.h.

template<class CHAR>
typedef const CHAR* ACE_String_Base_Const_Iterator< CHAR >::pointer

Definition at line 741 of file String_Base.h.

template<class CHAR>
typedef const CHAR& ACE_String_Base_Const_Iterator< CHAR >::reference

Definition at line 740 of file String_Base.h.

template<class CHAR>
typedef const CHAR ACE_String_Base_Const_Iterator< CHAR >::value_type

Definition at line 739 of file String_Base.h.


Constructor & Destructor Documentation

template<class CHAR >
ACE_String_Base_Const_Iterator< CHAR >::ACE_String_Base_Const_Iterator ( const ACE_String_Base< CHAR > &  str,
int  end = 0 
) [inline]

Initializing constructor

Parameters:
[in] str Target string for iterator.

Definition at line 313 of file String_Base.inl.

00314 : str_ (&str),
00315   index_ (0 == end ? 0 : str.length ())
00316 {
00317   ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::ACE_String_Base_Const_Iterator");
00318 }

template<class CHAR >
ACE_String_Base_Const_Iterator< CHAR >::ACE_String_Base_Const_Iterator ( const ACE_String_Base_Const_Iterator< CHAR > &  iter  )  [inline]

Copy constructor

Parameters:
[in] iter Iterator to copy.

Definition at line 322 of file String_Base.inl.

00323 : str_ (iter.str_),
00324   index_ (iter.index_)
00325 {
00326   ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::ACE_String_Base_Const_Iterator");
00327 }

template<class CHAR >
ACE_String_Base_Const_Iterator< CHAR >::~ACE_String_Base_Const_Iterator ( void   )  [inline]

Destructor.

Definition at line 330 of file String_Base.inl.

00331 {
00332   ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::~ACE_String_Base_Const_Iterator");
00333 }


Member Function Documentation

template<class CHAR >
int ACE_String_Base_Const_Iterator< CHAR >::advance ( void   )  [inline]

Move to the next character in the string.

Return values:
0 All characters have been seen.
1 Items still remain to be seen.

Definition at line 547 of file String_Base.cpp.

00548 {
00549   ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::advance");
00550 
00551   if (this->index_ < this->str_->length ())
00552   {
00553     ++ this->index_;
00554     return 1;
00555   }
00556   else
00557   {
00558     return 0;
00559   }
00560 }

template<class CHAR >
int ACE_String_Base_Const_Iterator< CHAR >::done ( void   )  const [inline]

Test if the iterator has seen all characters.

Return values:
0 Characters still remain.
1 All characters have been seen.

Definition at line 336 of file String_Base.inl.

00337 {
00338   ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::done");
00339 
00340   return this->index_ >= this->str_->length () ? 1 : 0;
00341 }

template<class CHAR >
int ACE_String_Base_Const_Iterator< CHAR >::next ( const CHAR *&  ch  )  const [inline]

Get the current character.

Parameters:
[out] ch The current character.
Return values:
0 All characters have been seen.
1 Items still remain to be seen.

Definition at line 530 of file String_Base.cpp.

00531 {
00532   ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::next");
00533 
00534   if (0 == this->done ())
00535   {
00536     ch = &this->str_->rep_[this->index_];
00537     return 1;
00538   }
00539   else
00540   {
00541     ch = 0;
00542     return 0;
00543   }
00544 }

template<class CHAR >
bool ACE_String_Base_Const_Iterator< CHAR >::operator!= ( const ACE_String_Base_Const_Iterator< CHAR > &  rhs  )  const [inline]

Ineqaulity comparison operator

Parameters:
[in] rhs Right-hand side of operator.

Definition at line 412 of file String_Base.inl.

00413 {
00414   return this->index_ != rhs.index_;
00415 }

template<class CHAR >
const CHAR & ACE_String_Base_Const_Iterator< CHAR >::operator* ( void   )  [inline]

Dereference operator

Returns:
Reference to current character seen by iterator.

Definition at line 344 of file String_Base.inl.

00345 {
00346   ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::operator *");
00347 
00348   return this->str_->rep_[this->index_];
00349 }

template<class CHAR >
ACE_String_Base_Const_Iterator< CHAR > ACE_String_Base_Const_Iterator< CHAR >::operator++ ( int   )  [inline]

Postfix operator

Definition at line 365 of file String_Base.inl.

00366 {
00367   ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::operator ++ (int)");
00368 
00369   ACE_String_Base_Const_Iterator <CHAR> temp (*this);
00370 
00371   if (0 == this->done ())
00372     ++ this->index_;
00373 
00374   return temp;
00375 }

template<class CHAR >
ACE_String_Base_Const_Iterator< CHAR > & ACE_String_Base_Const_Iterator< CHAR >::operator++ ( void   )  [inline]

Prefix operator

Definition at line 353 of file String_Base.inl.

00354 {
00355   ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::operator ++");
00356 
00357   if (0 == this->done ())
00358     ++ this->index_;
00359 
00360   return *this;
00361 }

template<class CHAR >
ACE_String_Base_Const_Iterator< CHAR > ACE_String_Base_Const_Iterator< CHAR >::operator-- ( int   )  [inline]

Postfix operator

Definition at line 391 of file String_Base.inl.

00392 {
00393   ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::operator -- (int)");
00394 
00395   ACE_String_Base_Const_Iterator <CHAR> temp (*this);
00396 
00397   if (0 < this->index_)
00398     -- this->index_;
00399 
00400   return temp;
00401 }

template<class CHAR >
ACE_String_Base_Const_Iterator< CHAR > & ACE_String_Base_Const_Iterator< CHAR >::operator-- ( void   )  [inline]

Prefix operator

Definition at line 379 of file String_Base.inl.

00380 {
00381   ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::operator --");
00382 
00383   if (0 < this->index_)
00384     -- this->index_;
00385 
00386   return *this;
00387 }

template<class CHAR >
bool ACE_String_Base_Const_Iterator< CHAR >::operator< ( const ACE_String_Base_Const_Iterator< CHAR > &  rhs  )  const [inline]

Definition at line 419 of file String_Base.inl.

00420 {
00421   return this->index_ < rhs.index_;
00422 }

template<class CHAR >
bool ACE_String_Base_Const_Iterator< CHAR >::operator<= ( const ACE_String_Base_Const_Iterator< CHAR > &  rhs  )  const [inline]

Definition at line 440 of file String_Base.inl.

00441 {
00442   return this->index_ <= rhs.index_;
00443 }

template<class CHAR >
const ACE_String_Base_Const_Iterator< CHAR > & ACE_String_Base_Const_Iterator< CHAR >::operator= ( const ACE_String_Base_Const_Iterator< CHAR > &  iter  )  [inline]

Assignment operator

Parameters:
[in] iter Right-hand side of operator.
Returns:
Reference to self.

Definition at line 565 of file String_Base.cpp.

00566 {
00567   ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::operator =");
00568 
00569   if (this == &rhs)
00570     return *this;
00571 
00572   this->str_ = rhs.str_;
00573   this->index_ = rhs.index_;
00574   return *this;
00575 }

template<class CHAR >
bool ACE_String_Base_Const_Iterator< CHAR >::operator== ( const ACE_String_Base_Const_Iterator< CHAR > &  rhs  )  const [inline]

Eqaulity comparison operator

Parameters:
[in] rhs Right-hand side of operator.

Definition at line 405 of file String_Base.inl.

00406 {
00407   return this->index_ == rhs.index_;
00408 }

template<class CHAR >
bool ACE_String_Base_Const_Iterator< CHAR >::operator> ( const ACE_String_Base_Const_Iterator< CHAR > &  rhs  )  const [inline]

Definition at line 426 of file String_Base.inl.

00427 {
00428   return this->index_ > rhs.index_;
00429 }

template<class CHAR >
bool ACE_String_Base_Const_Iterator< CHAR >::operator>= ( const ACE_String_Base_Const_Iterator< CHAR > &  rhs  )  const [inline]

Definition at line 433 of file String_Base.inl.

00434 {
00435   return this->index_ >= rhs.index_;
00436 }


Member Data Documentation

template<class CHAR>
size_t ACE_String_Base_Const_Iterator< CHAR >::index_ [private]

Current location in the string.

Definition at line 846 of file String_Base.h.

template<class CHAR>
const ACE_String_Base<CHAR>* ACE_String_Base_Const_Iterator< CHAR >::str_ [private]

Target string to iterate over.

Definition at line 843 of file String_Base.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Sun Nov 22 23:16:38 2009 for ACE by  doxygen 1.6.1