blocxx
Public Member Functions | Private Member Functions | Private Attributes | Friends

BLOCXX_NAMESPACE::Bool Class Reference

The Bool class is an abstraction for the boolean data type. More...

#include <Bool.hpp>

List of all members.

Public Member Functions

 Bool ()
 Create an Bool object initialized to false.
 Bool (bool val)
 Create an Bool object initialized to a given boolean value.
 Bool (const Bool &arg)
 Copy constructor.
Booloperator= (const Bool &arg)
 Assignment operator.
bool operator== (const bool arg) const
 Equality operator.
bool operator== (const Bool &arg) const
 Equality operator.
bool operator!= (const bool arg) const
 Inequality operator.
bool operator!= (const Bool &arg) const
 Inequality operator.
 operator bool () const
bool operator! () const
 Negation operator.
String toString () const
void writeObject (std::streambuf &ostrm) const
 Write this object to an output stream.
void readObject (std::streambuf &istrm)
 Read this object from an input stream.

Private Member Functions

 Bool (const void *)
 Bool (void *)
 Bool (volatile const void *)
 Bool (volatile void *)

Private Attributes

bool m_val

Friends

bool operator< (const Bool &b1, const Bool &b2)
 Less than operator (friend function)
bool operator!= (bool b1, Bool b2)
 Not equal operator (friend function)

Detailed Description

The Bool class is an abstraction for the boolean data type.

It's not meant to be a replacement for bool. Use it if you need a type that supports toString(), readObject(), or writeObject(). It's also useful for preventing implicit conversion of char*->bool. Using it can make overloading functions safer (ie it'll be less likely the compiler will pick the wrong overload.)

Definition at line 56 of file Bool.hpp.


Constructor & Destructor Documentation

BLOCXX_NAMESPACE::Bool::Bool ( ) [inline]

Create an Bool object initialized to false.

Definition at line 63 of file Bool.hpp.

BLOCXX_NAMESPACE::Bool::Bool ( bool  val) [inline]

Create an Bool object initialized to a given boolean value.

Parameters:
valThe boolean value to initialize this Bool to

Definition at line 68 of file Bool.hpp.

BLOCXX_NAMESPACE::Bool::Bool ( const Bool arg) [inline]

Copy constructor.

Parameters:
argThe Bool to make this object a copy of.

Definition at line 73 of file Bool.hpp.

BLOCXX_NAMESPACE::Bool::Bool ( const void *  ) [private]
BLOCXX_NAMESPACE::Bool::Bool ( void *  ) [private]
BLOCXX_NAMESPACE::Bool::Bool ( volatile const void *  ) [private]
BLOCXX_NAMESPACE::Bool::Bool ( volatile void *  ) [private]

Member Function Documentation

BLOCXX_NAMESPACE::Bool::operator bool ( ) const [inline]
Returns:
The bool value of this Bool object.

Definition at line 111 of file Bool.hpp.

bool BLOCXX_NAMESPACE::Bool::operator! ( ) const [inline]

Negation operator.

Returns:
true if this Bool operator has a value of false.

Definition at line 116 of file Bool.hpp.

bool BLOCXX_NAMESPACE::Bool::operator!= ( const Bool arg) const [inline]

Inequality operator.

Parameters:
argThe Bool object to compare this one with.
Returns:
true If the given Bool object is not equal to this one. Otherwise false

Definition at line 107 of file Bool.hpp.

References m_val.

bool BLOCXX_NAMESPACE::Bool::operator!= ( const bool  arg) const [inline]

Inequality operator.

Parameters:
argbool value to compare this Bool object against.
Returns:
true If the given bool value is not equal to this one. Otherwise false

Definition at line 100 of file Bool.hpp.

Bool& BLOCXX_NAMESPACE::Bool::operator= ( const Bool arg) [inline]

Assignment operator.

Parameters:
argThe Bool to assign to this one.
Returns:
A reference to this object after the assignment has been made.

Definition at line 79 of file Bool.hpp.

References m_val.

bool BLOCXX_NAMESPACE::Bool::operator== ( const bool  arg) const [inline]

Equality operator.

Parameters:
argbool value to compare this Bool object against.
Returns:
true If the given bool value is equal to this one. Otherwise false

Definition at line 86 of file Bool.hpp.

bool BLOCXX_NAMESPACE::Bool::operator== ( const Bool arg) const [inline]

Equality operator.

Parameters:
argThe Bool object to compare this one with.
Returns:
true If the given Bool object is equal to this one. Otherwise false

Definition at line 93 of file Bool.hpp.

References m_val.

void BLOCXX_NAMESPACE::Bool::readObject ( std::streambuf &  istrm)

Read this object from an input stream.

Parameters:
istrmThe input stream to read this object from.

Referenced by BLOCXX_NAMESPACE::BinarySerialization::readBool().

String BLOCXX_NAMESPACE::Bool::toString ( ) const
Returns:
The string representation of this object. If this object contains a true value, the "true" is returned. Otherwise "false" is returned.

Definition at line 71 of file Bool.cpp.

References m_val.

Referenced by BLOCXX_NAMESPACE::StringBuffer::operator+=().

void BLOCXX_NAMESPACE::Bool::writeObject ( std::streambuf &  ostrm) const

Write this object to an output stream.

Parameters:
ostrmThe output stream to write this object to.

Referenced by BLOCXX_NAMESPACE::BinarySerialization::writeBool().


Friends And Related Function Documentation

bool operator!= ( bool  b1,
Bool  b2 
) [friend]

Not equal operator (friend function)

Parameters:
b1The first Bool object to use in the comparison.
b2The second Bool object to use in the comparison.
Returns:
true if b1 is not equal to b2. Otherwise false.

Definition at line 148 of file Bool.hpp.

bool operator< ( const Bool b1,
const Bool b2 
) [friend]

Less than operator (friend function)

Parameters:
b1The first Bool object to use in the comparison.
b2The second Bool object to use in the comparison.
Returns:
true if b1 is less than b2. Otherwise false.

Definition at line 138 of file Bool.hpp.


Member Data Documentation


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