|
activemq-cpp-3.3.0
|
00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef _DECAF_LANG_BOOLEAN_H_ 00019 #define _DECAF_LANG_BOOLEAN_H_ 00020 00021 #include <string> 00022 #include <decaf/lang/Comparable.h> 00023 #include <decaf/util/Config.h> 00024 00025 namespace decaf{ 00026 namespace lang{ 00027 00028 class DECAF_API Boolean : public Comparable<Boolean>, 00029 public Comparable<bool> { 00030 private: 00031 00032 // This objects boolean value 00033 bool value; 00034 00035 public: 00036 00040 static const Boolean _FALSE; 00041 00045 static const Boolean _TRUE; 00046 00047 public: 00048 00052 Boolean( bool value ); 00053 00057 Boolean( const std::string& value ); 00058 00059 virtual ~Boolean() {} 00060 00064 bool booleanValue() const { 00065 return value; 00066 } 00067 00071 std::string toString() const; 00072 00081 virtual int compareTo( const Boolean& b ) const; 00082 00088 virtual bool operator==( const Boolean& value ) const; 00089 00096 virtual bool operator<( const Boolean& value ) const; 00097 00101 bool equals( const Boolean& b ) const { 00102 return this->value == b.value; 00103 } 00104 00113 virtual int compareTo( const bool& b ) const; 00114 00120 virtual bool operator==( const bool& value ) const; 00121 00128 virtual bool operator<( const bool& value ) const; 00129 00133 bool equals( const bool& b ) const { 00134 return this->value == b; 00135 } 00136 00137 public: // Statics 00138 00145 static Boolean valueOf( bool value ); 00146 00153 static Boolean valueOf( const std::string& value ); 00154 00162 static bool parseBoolean( const std::string& value ); 00163 00171 static std::string toString( bool value ); 00172 00173 }; 00174 00175 }} 00176 00177 #endif /*_DECAF_LANG_BOOLEAN_H_*/