#include <Boolean.h>
Inheritance diagram for Core::Boolean:
Public Member Functions | |
Boolean (bool val) | |
operator bool (void) | |
Answer value converted to C++ type bool. | |
virtual String * | className (void) const |
Answer receiver class name. | |
virtual long | hash (void) const |
Answer object hash value. | |
virtual bool | isEqual (const Object *object) const |
Compare receiver with given object. | |
virtual bool | isEqual (const Object &object) const |
Compare receiver with given object. | |
virtual bool | isEqual (bool cBool) const |
virtual void | printOn (Stream *stream) const |
Print object identification into the stream. | |
virtual bool | isBoolean (void) const |
Answer if the receiver is a Boolean. | |
virtual void | visitBy (Visitor *visitor) |
Static Public Attributes | |
static Boolean | True |
static Boolean | False |
Protected Attributes | |
bool | value |
Value of Boolean object. |
Definition at line 36 of file Boolean.h.
|
Definition at line 34 of file Boolean.cc. References value. 00035 { 00036 value = val; 00037 }
|
|
Answer receiver class name. Because there isn't any standard way to obtain class name this method comes to place. Every class should rewrite this method but many didn't (yet). Reimplemented from Core::Object. Definition at line 45 of file Boolean.cc. 00046 { 00047 return new String("Boolean"); 00048 }
|
|
Answer object hash value. The value should be same for objects found equal with isEqual() method. So if you rewrite this method you should rewrite isEqual() method too. Reimplemented from Core::Object. Definition at line 51 of file Boolean.cc. References value. 00052 { 00053 return value ? 1 : 0; 00054 }
|
|
Answer if the receiver is a Boolean.
Reimplemented from Core::Object. Definition at line 74 of file Boolean.cc. 00075 { 00076 return true; 00077 }
|
|
Definition at line 62 of file Boolean.cc. References value. 00063 { 00064 return value == cBool; 00065 }
|
|
Compare receiver with given object. Do not rewrite this method. It just a sugar for Object::isEqual(Object *).
Reimplemented from Core::Object. Definition at line 60 of file Boolean.h. References Core::Object::isEqual(). 00061 { return Object::isEqual(object); }
|
|
Compare receiver with given object. This method could compare objects with more sophisticated algorithm (eg. based on instance variables comparing or so). If you rewrite this method you should rewrite hash() too.
Reimplemented from Core::Object. Definition at line 56 of file Boolean.cc. References Core::Object::isBoolean(), and value.
|
|
Answer value converted to C++ type bool.
Definition at line 39 of file Boolean.cc. References value. 00040 { 00041 return value; 00042 }
|
|
Print object identification into the stream. Object identification is formed from its className() by default. But complicated classes (eg. collections) may print some other information.
Reimplemented from Core::Object. Definition at line 68 of file Boolean.cc. References Core::Stream::nextPutAll(), and value. 00069 { 00070 stream->nextPutAll(value ? "true" : "false"); 00071 }
|
|
Reimplemented from Core::Object. Definition at line 80 of file Boolean.cc. References Core::Visitor::visitBoolean(). 00081 { 00082 visitor->visitBoolean(this); 00083 }
|
|
|
|
|
|
Value of Boolean object. The value must not be equal to Boolean::True or Boolean::False. So identity comparation can fail. Use isEqual() instead. Definition at line 43 of file Boolean.h. Referenced by Boolean(), hash(), isEqual(), operator bool(), and printOn(). |