activemq-cpp-3.9.5
Boolean.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _DECAF_LANG_BOOLEAN_H_
19 #define _DECAF_LANG_BOOLEAN_H_
20 
21 #include <string>
22 #include <decaf/lang/String.h>
23 #include <decaf/lang/Comparable.h>
24 #include <decaf/util/Config.h>
25 
26 namespace decaf{
27 namespace lang{
28 
29  class DECAF_API Boolean : public Comparable<Boolean>,
30  public Comparable<bool> {
31  private:
32 
33  // This objects boolean value
34  bool value;
35 
36  public:
37 
41  static const Boolean _FALSE;
42 
46  static const Boolean _TRUE;
47 
48  public:
49 
53  Boolean(bool value);
54 
58  Boolean(const String& value);
59 
60  virtual ~Boolean() {}
61 
65  bool booleanValue() const {
66  return value;
67  }
68 
72  std::string toString() const;
73 
82  virtual int compareTo(const Boolean& b) const;
83 
89  virtual bool operator==(const Boolean& value) const;
90 
97  virtual bool operator<(const Boolean& value) const;
98 
102  bool equals(const Boolean& b) const {
103  return this->value == b.value;
104  }
105 
114  virtual int compareTo(const bool& b) const;
115 
121  virtual bool operator==(const bool& value) const;
122 
129  virtual bool operator<(const bool& value) const;
130 
134  bool equals(const bool& b) const {
135  return this->value == b;
136  }
137 
138  public:
139 
146  static Boolean valueOf(bool value);
147 
154  static Boolean valueOf(const String& value);
155 
163  static bool parseBoolean(const String& value);
164 
172  static std::string toString(bool value);
173 
174  };
175 
176 }}
177 
178 #endif /*_DECAF_LANG_BOOLEAN_H_*/
static const Boolean _FALSE
The Class object representing the primitive false boolean.
Definition: Boolean.h:41
static const Boolean _TRUE
The Class object representing the primitive type boolean.
Definition: Boolean.h:46
Definition: Boolean.h:29
bool booleanValue() const
Definition: Boolean.h:65
bool equals(const bool &b) const
Definition: Boolean.h:134
virtual ~Boolean()
Definition: Boolean.h:60
An immutable sequence of characters.
Definition: String.h:57
#define DECAF_API
Definition: Config.h:29
bool equals(const Boolean &b) const
Definition: Boolean.h:102
bool operator==(const ArrayPointer< T > &left, const U *right)
Definition: ArrayPointer.h:379
This interface imposes a total ordering on the objects of each class that implements it...
Definition: Comparable.h:33
bool operator<(const std::string &left, const String &right)