Vault  4.1
Public Member Functions | Static Public Member Functions | Friends
VChar Class Reference

VChar is a simple wrapper for C char values. More...

#include <vchar.h>

List of all members.

Public Member Functions

 VChar ()
 Constructs a character with value zero.
 VChar (char c)
 Constructs a character from a char.
 VChar (int i)
 Constructs a character from an int for conversion purposes.
VCharoperator= (char c)
 Assigns the character from a C char.
VCharoperator= (int i)
 Assigns the character from an int specifying the 8-bit char value.
bool isLowerCase () const
 Returns true if the character is a lower case character.
VChar lowerCase () const
 Returns a lower-case version of the character.
void toLowerCase ()
 Converts the character to lower-case.
bool isUpperCase () const
 Returns true if the character is an upper case character.
VChar upperCase () const
 Returns an upper-case version of the character.
void toUpperCase ()
 Converts the character to upper-case.
char charValue () const
 Returns the char value of the character.
int intValue () const
 Returns the int value of the character.
void set (char c)
 Sets the character from a char, as in the char constructor.
void set (int i)
 Sets the character from an int, as in the int constructor.
 operator char () const
 Coerces the character to a char.
bool isAlpha () const
 Returns true if the character is A-Z or a-z.
bool isNumeric () const
 Returns true if the character is a digit.
bool isAlphaNumeric () const
 Returns true if the character is alpha or numeric.
bool isWhitespace () const
 Returns true if the character is non-printing.
bool isHexadecimal () const
 Returns true if the character is 0-9, A-F, or a-f.

Static Public Member Functions

static const VCharNULL_CHAR ()
 Returns a reference to the read-only null character value.
static bool equalsIgnoreCase (const VChar &c1, const VChar &c2)
 Returns true if two characters are equal regardless of case.
static bool equalsIgnoreCase (const VChar &c1, char c2)
 Returns true if two characters are equal regardless of case.
static bool equalsIgnoreCase (char c1, const VChar &c2)
 Returns true if two characters are equal regardless of case.
static bool equalsIgnoreCase (char c1, char c2)
 Returns true if two characters are equal regardless of case.

Friends

bool operator== (const VChar &lhs, const VChar &rhs)
 Compares lhs and rhs.
bool operator== (const VChar &lhs, char rhs)
 Compares lhs and rhs.
bool operator== (char lhs, const VChar &rhs)
 Compares lhs and rhs.
bool operator!= (const VChar &lhs, const VChar &rhs)
 Compares lhs and rhs.
bool operator!= (const VChar &lhs, char rhs)
 Compares lhs and rhs.
bool operator!= (char lhs, const VChar &rhs)
 Compares lhs and rhs.
bool operator< (const VChar &lhs, const VChar &rhs)
 Compares lhs and rhs.
bool operator< (const VChar &lhs, char rhs)
 Compares lhs and rhs.
bool operator< (char lhs, const VChar &rhs)
 Compares lhs and rhs.
bool operator<= (const VChar &lhs, const VChar &rhs)
 Compares lhs and rhs.
bool operator<= (const VChar &lhs, char rhs)
 Compares lhs and rhs.
bool operator<= (char lhs, const VChar &rhs)
 Compares lhs and rhs.
bool operator>= (const VChar &lhs, const VChar &rhs)
 Compares lhs and rhs.
bool operator>= (const VChar &lhs, char rhs)
 Compares lhs and rhs.
bool operator>= (char lhs, const VChar &rhs)
 Compares lhs and rhs.
bool operator> (const VChar &lhs, const VChar &rhs)
 Compares lhs and rhs.
bool operator> (const VChar &lhs, char rhs)
 Compares lhs and rhs.
bool operator> (char lhs, const VChar &rhs)
 Compares lhs and rhs.

Detailed Description

VChar is a simple wrapper for C char values.

It provides easier and safer ways of setting, converting, comparing, and modifying characters.

This class does not attempt to do lexical comparisons or deal with Unicode or character set issues. It is simply a lightweight object replacement for using char values directly in source code.

See also:
VString

Definition at line 35 of file vchar.h.


Constructor & Destructor Documentation

VChar::VChar ( char  c)

Constructs a character from a char.

Parameters:
cthe char

Definition at line 28 of file vchar.cpp.

VChar::VChar ( int  i)

Constructs a character from an int for conversion purposes.

The integer value is cast to char.

Parameters:
ithe int

Definition at line 33 of file vchar.cpp.


Member Function Documentation

VChar & VChar::operator= ( char  c)

Assigns the character from a C char.

Parameters:
cthe char

Definition at line 38 of file vchar.cpp.

VChar & VChar::operator= ( int  i)

Assigns the character from an int specifying the 8-bit char value.

Parameters:
ithe integer value of the char

Definition at line 43 of file vchar.cpp.

bool VChar::isLowerCase ( ) const

Returns true if the character is a lower case character.

Returns:
true if the character is a lower case character

Definition at line 51 of file vchar.cpp.

VChar VChar::lowerCase ( ) const

Returns a lower-case version of the character.

Returns:
the lower-case value

Definition at line 55 of file vchar.cpp.

References VChar().

bool VChar::isUpperCase ( ) const

Returns true if the character is an upper case character.

Returns:
true if the character is an upper case character

Definition at line 63 of file vchar.cpp.

VChar VChar::upperCase ( ) const

Returns an upper-case version of the character.

Returns:
the upper-case value

Definition at line 67 of file vchar.cpp.

References VChar().

char VChar::charValue ( ) const

Returns the char value of the character.

Returns:
the char value

Definition at line 75 of file vchar.cpp.

int VChar::intValue ( ) const

Returns the int value of the character.

Returns:
the int value

Definition at line 79 of file vchar.cpp.

void VChar::set ( char  c)

Sets the character from a char, as in the char constructor.

Parameters:
cthe char

Definition at line 85 of file vchar.cpp.

void VChar::set ( int  i)

Sets the character from an int, as in the int constructor.

Parameters:
ithe int

Definition at line 89 of file vchar.cpp.

VChar::operator char ( ) const

Coerces the character to a char.

Returns:
the char value

Definition at line 93 of file vchar.cpp.


Friends And Related Function Documentation

bool operator== ( const VChar lhs,
const VChar rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa VChar
rhsa VChar
Returns:
true if lhs == rhs

Definition at line 170 of file vchar.h.

bool operator== ( const VChar lhs,
char  rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa VChar
rhsa char
Returns:
true if lhs == rhs

Definition at line 172 of file vchar.h.

bool operator== ( char  lhs,
const VChar rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa char
rhsa VChar
Returns:
true if lhs == rhs

Definition at line 173 of file vchar.h.

bool operator!= ( const VChar lhs,
const VChar rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa VChar
rhsa VChar
Returns:
true if lhs != rhs

Definition at line 176 of file vchar.h.

bool operator!= ( const VChar lhs,
char  rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa VChar
rhsa char
Returns:
true if lhs != rhs

Definition at line 178 of file vchar.h.

bool operator!= ( char  lhs,
const VChar rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa char
rhsa VChar
Returns:
true if lhs != rhs

Definition at line 179 of file vchar.h.

bool operator< ( const VChar lhs,
const VChar rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa VChar
rhsa VChar
Returns:
true if lhs < rhs

Definition at line 182 of file vchar.h.

bool operator< ( const VChar lhs,
char  rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa VChar
rhsa char
Returns:
true if lhs < rhs

Definition at line 183 of file vchar.h.

bool operator< ( char  lhs,
const VChar rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa char
rhsa VChar
Returns:
true if lhs < rhs

Definition at line 184 of file vchar.h.

bool operator<= ( const VChar lhs,
const VChar rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa VChar
rhsa VChar
Returns:
true if lhs <= rhs

Definition at line 186 of file vchar.h.

bool operator<= ( const VChar lhs,
char  rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa VChar
rhsa char
Returns:
true if lhs <= rhs

Definition at line 187 of file vchar.h.

bool operator<= ( char  lhs,
const VChar rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa char
rhsa VChar
Returns:
true if lhs <= rhs

Definition at line 188 of file vchar.h.

bool operator>= ( const VChar lhs,
const VChar rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa VChar
rhsa VChar
Returns:
true if lhs >= rhs

Definition at line 190 of file vchar.h.

bool operator>= ( const VChar lhs,
char  rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa VChar
rhsa char
Returns:
true if lhs >= rhs

Definition at line 191 of file vchar.h.

bool operator>= ( char  lhs,
const VChar rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa char
rhsa VChar
Returns:
true if lhs >= rhs

Definition at line 192 of file vchar.h.

bool operator> ( const VChar lhs,
const VChar rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa VChar
rhsa VChar
Returns:
true if lhs > rhs

Definition at line 194 of file vchar.h.

bool operator> ( const VChar lhs,
char  rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa VChar
rhsa char
Returns:
true if lhs > rhs

Definition at line 195 of file vchar.h.

bool operator> ( char  lhs,
const VChar rhs 
) [friend]

Compares lhs and rhs.

Parameters:
lhsa char
rhsa VChar
Returns:
true if lhs > rhs

Definition at line 196 of file vchar.h.


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

Copyright ©1997-2014 Trygve Isaacson. All rights reserved. This documentation was generated with Doxygen.