libUTL++
Char.h
1 #pragma once
2 
4 
5 #include <libutl/Integer.h>
6 
8 
9 UTL_NS_BEGIN;
10 
12 
20 
22 class Char : public Integer<char>
23 {
26 
27 public:
32  Char(char c)
33  : Integer<char>(c)
34  {
35  }
36 
41  Char(int c)
42  : Integer<char>((char)c)
43  {
44  }
45 
46  virtual void serialize(Stream& stream, uint_t io, uint_t mode = ser_default);
47 
49  bool
50  isAlnum() const
51  {
52  return isalnum(_n);
53  }
54 
56  bool
57  isAlpha() const
58  {
59  return isalpha(_n);
60  }
61 
63  bool
64  isAscii() const
65  {
66  return isascii(_n);
67  }
68 
70  bool
71  isCntrl() const
72  {
73  return iscntrl(_n);
74  }
75 
77  bool
78  isDigit() const
79  {
80  return isdigit(_n);
81  }
82 
84  bool
85  isGraph() const
86  {
87  return isgraph(_n);
88  }
89 
91  bool
92  isLower() const
93  {
94  return islower(_n);
95  }
96 
98  bool
99  isPrint() const
100  {
101  return isprint(_n);
102  }
103 
108  bool
109  isPunct() const
110  {
111  return ispunct(_n);
112  }
113 
115  bool
116  isSpace() const
117  {
118  return isspace(_n);
119  }
120 
122  bool
123  isUpper() const
124  {
125  return isupper(_n);
126  }
127 
129  bool
130  isHexDigit() const
131  {
132  return isxdigit(_n);
133  }
134 };
135 
137 
138 UTL_NS_END;
#define UTL_CLASS_DEFID
Default init() and deInit() (which are merely place-holders).
Definition: macros.h:532
void serialize(bool &b, Stream &stream, uint_t io, uint_t mode=ser_default)
Serialize a boolean.
Char(char c)
Constructor.
Definition: Char.h:32
bool isCntrl() const
Determine whether character is a control character.
Definition: Char.h:71
default representation (via getSerializeMode())
Definition: util.h:75
#define UTL_CLASS_DECL(DC, BC)
Declaration of standard UTL++ functionality for a non-template class.
Definition: macros.h:688
bool isAlpha() const
Determine whether character is alphabetic: [a-zA-Z].
Definition: Char.h:57
bool isDigit() const
Determine whether character is a digit: [0-9].
Definition: Char.h:78
Integer value.
Definition: Integer.h:23
Char(int c)
Constructor.
Definition: Char.h:41
bool isLower() const
Determine whether character is lowercase: [a-z].
Definition: Char.h:92
bool isAlnum() const
Determine whether character is alpha-numeric: [a-zA-Z0-9].
Definition: Char.h:50
unsigned int uint_t
Unsigned integer.
Definition: types.h:59
bool isPunct() const
Determine whether character is printable, but not a space or alpha-numeric.
Definition: Char.h:109
bool isSpace() const
Determine whether character is white-space.
Definition: Char.h:116
bool isGraph() const
Determine whether character is printable (excluding space).
Definition: Char.h:85
Stream I/O abstraction.
Definition: Stream.h:68
bool isAscii() const
Determine whether character is 7-bit ASCII.
Definition: Char.h:64
bool isHexDigit() const
Determine whether character is a hex digit: [0-9a-fA-F].
Definition: Char.h:130
bool isPrint() const
Determine whether character is printable (including space).
Definition: Char.h:99
bool isUpper() const
Determine whether character is upper-case: [A-Z].
Definition: Char.h:123
Character value.
Definition: Char.h:22