activemq-cpp-3.6.0
Main Page
Namespaces
Data Structures
Files
File List
Globals
Byte.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_BYTE_H_
19
#define _DECAF_LANG_BYTE_H_
20
21
#include <
decaf/util/Config.h
>
22
#include <
decaf/lang/Number.h
>
23
#include <
decaf/lang/Comparable.h
>
24
#include <
decaf/lang/exceptions/NumberFormatException.h
>
25
#include <string>
26
27
namespace
decaf{
28
namespace
lang{
29
30
class
DECAF_API
Byte
:
public
Number
,
31
public
Comparable
<Byte>,
32
public
Comparable
<unsigned char> {
33
private
:
34
35
unsigned
char
value;
36
37
public
:
38
40
static
const
unsigned
char
MIN_VALUE = 0x7F;
41
43
static
const
unsigned
char
MAX_VALUE = 0x80;
44
46
static
const
int
SIZE = 8;
47
48
public
:
49
53
Byte
(
unsigned
char
value);
54
63
Byte
(
const
std::string& value);
64
65
virtual
~Byte
() {}
66
75
virtual
int
compareTo
(
const
Byte
& c)
const
{
76
return
this->value < c.value ? -1 : (this->value > c.value) ? 1 : 0;
77
}
78
84
virtual
bool
operator==
(
const
Byte
& c)
const
{
85
return
this->value == c.value;
86
}
87
94
virtual
bool
operator<
(
const
Byte
& c)
const
{
95
return
this->value < c.value;
96
}
97
106
virtual
int
compareTo
(
const
unsigned
char
& c)
const
{
107
return
this->value < c ? -1 : (this->value > c) ? 1 : 0;
108
}
109
115
virtual
bool
operator==
(
const
unsigned
char
& c)
const
{
116
return
this->value == c;
117
}
118
125
virtual
bool
operator<
(
const
unsigned
char
& c)
const
{
126
return
this->value < c;
127
}
128
132
bool
equals
(
const
Byte
& c)
const
{
133
return
this->value == c.value;
134
}
135
139
bool
equals
(
const
unsigned
char
& c)
const
{
140
return
this->value == c;
141
}
142
146
std::string toString()
const
;
147
152
virtual
double
doubleValue
()
const
{
153
return
(
double
) this->value;
154
}
155
160
virtual
float
floatValue
()
const
{
161
return
(
float
) this->value;
162
}
163
168
virtual
unsigned
char
byteValue
()
const
{
169
return
this->value;
170
}
171
176
virtual
short
shortValue
()
const
{
177
return
(
short
) this->value;
178
}
179
184
virtual
int
intValue
()
const
{
185
return
(
int
) this->value;
186
}
187
192
virtual
long
long
longValue
()
const
{
193
return
(
long
long
) this->value;
194
}
195
196
public
:
// statics
197
201
static
std::string toString(
unsigned
char
value);
202
218
static
Byte
decode(
const
std::string& value);
219
245
static
unsigned
char
parseByte(
const
std::string& s,
int
radix);
246
258
static
unsigned
char
parseByte(
const
std::string& s);
259
265
static
Byte
valueOf
(
unsigned
char
value) {
266
return
Byte
(value);
267
}
268
279
static
Byte
valueOf(
const
std::string& value);
280
294
static
Byte
valueOf(
const
std::string& value,
int
radix);
295
296
};
297
298
}}
299
300
#endif
/*_DECAF_LANG_BYTE_H_*/
src
main
decaf
lang
Byte.h
Generated on Mon Mar 4 2013 10:25:46 for activemq-cpp-3.6.0 by
1.8.1.2