Xrb::CharacterFilter Class Reference

Facility for filtering characters (e.g. for Xrb::LineEdit). More...

#include <xrb_characterfilter.hpp>

List of all members.

Public Types

enum  FilterType {
  ALLOW = 0,
  DENY
}
 Enumerates the two filter types. More...

Public Member Functions

 CharacterFilter ()
 Default constructor.
 CharacterFilter (FilterType const filter_type, std::string const &filter)
 Construct a filter with the given type and filter string.
 ~CharacterFilter ()
 Boring old destructor.
FilterType GetFilterType () const
 Returns the filter type.
std::string const & Filter () const
 Returns the string containing the filter characters.
char FilteredCharacter (char c) const
 Returns the filtered version of the given character.
void SetFilterType (FilterType const filter_type)
 Sets the filter type.
void SetFilter (std::string const &filter)
 Sets the string containing the filter chars.


Detailed Description

Facility for filtering characters (e.g. for Xrb::LineEdit).

The filtering functionality operates by allowing or denying characters on a character-by-character basis. If a character is allowed, its value is returned unchanged by FilteredCharacter. If it is denied, then '' is returned.

There are two types of operation for the filter; allow-only-chars and deny-only-chars. Allow-only-chars indicates that only the characters found in the filter string should be passed through the filter. Deny-only-chars indicates only the characters not found in the filter string should be passed through the filter.

Definition at line 34 of file xrb_characterfilter.hpp.


Member Enumeration Documentation

Enumerates the two filter types.

Enumerator:
ALLOW  Allow-only-chars - pass only the chars found in the filter string.
DENY  Deny-only-chars - pass only the chars not found in the filter string.

Definition at line 40 of file xrb_characterfilter.hpp.


Constructor & Destructor Documentation

Xrb::CharacterFilter::CharacterFilter (  )  [inline]

Default constructor.

The default filter mode is deny-only-chars, with the filter string being empty, meaning that no characters are filtered out.

Definition at line 50 of file xrb_characterfilter.hpp.

References DENY.

Xrb::CharacterFilter::CharacterFilter ( FilterType const   filter_type,
std::string const &  filter 
) [inline]

Construct a filter with the given type and filter string.

Parameters:
filter_type The filter type to use.
filter The string containing the filter characters.

Definition at line 58 of file xrb_characterfilter.hpp.


Member Function Documentation

char Xrb::CharacterFilter::FilteredCharacter ( char  c  )  const

Returns the filtered version of the given character.

If the given character is filtered out, '' will be returned.

Parameters:
c The character to filter.

Definition at line 16 of file xrb_characterfilter.cpp.

References ALLOW, DENY, Filter(), and GetFilterType().

void Xrb::CharacterFilter::SetFilterType ( FilterType const   filter_type  )  [inline]

Sets the filter type.

param filter_type The filter type to use.

Definition at line 90 of file xrb_characterfilter.hpp.

void Xrb::CharacterFilter::SetFilter ( std::string const &  filter  )  [inline]

Sets the string containing the filter chars.

Parameters:
filter The new filter string to use.

Definition at line 97 of file xrb_characterfilter.hpp.


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

Hosted by SourceForge.net Logo -- Generated on Fri Aug 21 21:46:39 2009 for XuqRijBuh by doxygen 1.5.8