proj home

Files   Classes   Functions   Hierarchy  

spacerdelete< SPC > Class Template Reference

The functional object identifies an empty string. More...

#include <stringspace.h>

Collaboration diagram for spacerdelete< SPC >:

List of all members.

Public Member Functions

boolc operator() (stringc &s) const
 All characters must be space or an empty string for the string to be interpreted as full of spaces.
boolc operator[] (string &str)
 If the string is empty delete it.

Public Attributes

SPC spacer
 Functional object to test if a character is a space.


Detailed Description

template<typename SPC = myisspace>
class spacerdelete< SPC >

The functional object identifies an empty string.

  Identifying empty strings
    spacerdelete<> space;
    ... if (space(some_string)) ...
  For deleting empty strings
    spacedelete<>()[some_string];
  Linux needed cast for
    assertreturnOS( (bool)spacerdelete<>()[s] );

Definition at line 52 of file stringspace.h.


Member Function Documentation

template<typename SPC >
boolc spacerdelete< SPC >::operator() ( stringc s  )  const [inline]

All characters must be space or an empty string for the string to be interpreted as full of spaces.

Definition at line 83 of file stringspace.h.

References spacerdelete< SPC >::spacer.

00084 {
00085   if (s.empty())
00086     return true;
00087   uintc sz = s.size();
00088   uint i=0;
00089   for ( ; i<sz; ++i)
00090   {
00091     if (spacer(s[i])==false)
00092       return false;
00093   }
00094 
00095   return true;
00096 }

template<typename SPC >
boolc spacerdelete< SPC >::operator[] ( string &  str  )  [inline]

If the string is empty delete it.

Definition at line 72 of file stringspace.h.

00073 {
00074   if (spacerdelete<SPC>()(str))
00075   {
00076     str="";
00077     return true;
00078   }
00079   return false;
00080 }


Member Data Documentation

template<typename SPC = myisspace>
SPC spacerdelete< SPC >::spacer

Functional object to test if a character is a space.

Definition at line 57 of file stringspace.h.

Referenced by spacerdelete< SPC >::operator()().


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

Generated on Fri Mar 4 00:50:18 2011 for Chelton Evans Source by  doxygen 1.5.8