00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #if !defined(_XRB_CHARACTERFILTER_HPP_)
00012 #define _XRB_CHARACTERFILTER_HPP_
00013
00014 #include "xrb.hpp"
00015
00016 #include <string>
00017
00018 namespace Xrb
00019 {
00020
00034 class CharacterFilter
00035 {
00036 public:
00037
00040 enum FilterType
00041 {
00042 ALLOW = 0,
00043 DENY
00044 };
00045
00050 inline CharacterFilter ()
00051 {
00052 m_filter_type = DENY;
00053 }
00058 inline CharacterFilter (
00059 FilterType const filter_type,
00060 std::string const &filter)
00061 {
00062 m_filter_type = filter_type;
00063 m_filter = filter;
00064 }
00067 inline ~CharacterFilter () { }
00068
00071 inline FilterType GetFilterType () const
00072 {
00073 return m_filter_type;
00074 }
00077 inline std::string const &Filter () const
00078 {
00079 return m_filter;
00080 }
00085 char FilteredCharacter (char c) const;
00086
00090 inline void SetFilterType (FilterType const filter_type)
00091 {
00092 m_filter_type = filter_type;
00093 }
00097 inline void SetFilter (std::string const &filter)
00098 {
00099 m_filter = filter;
00100 }
00101
00102 private:
00103
00104
00105 FilterType m_filter_type;
00106
00107 std::string m_filter;
00108 };
00109
00110
00111 #define SIGNED_INTEGER_CHARACTER_FILTER "0123456789-"
00112 #define SIGNED_INTEGER_CHARACTER_FILTER_TYPE (CharacterFilter::ALLOW)
00113 #define UNSIGNED_INTEGER_CHARACTER_FILTER "0123456789"
00114 #define UNSIGNED_INTEGER_CHARACTER_FILTER_TYPE (CharacterFilter::ALLOW)
00115 #define DECIMAL_NOTATION_CHARACTER_FILTER "0123456789-."
00116 #define DECIMAL_NOTATION_CHARACTER_FILTER_TYPE (CharacterFilter::ALLOW)
00117 #define SCIENTIFIC_NOTATION_CHARACTER_FILTER "0123456789-.eE+"
00118 #define SCIENTIFIC_NOTATION_CHARACTER_FILTER_TYPE (CharacterFilter::ALLOW)
00119
00120 }
00121
00122 #endif // !defined(_XRB_CHARACTERFILTER_HPP_)
00123