activemq-cpp-3.6.0
Main Page
Namespaces
Data Structures
Files
File List
Globals
Short.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_SHORT_H_
19
#define _DECAF_LANG_SHORT_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
Short
:
public
Number
,
31
public
Comparable
<Short>,
32
public
Comparable
<short> {
33
private
:
34
35
// The short value
36
short
value;
37
38
public
:
39
41
static
const
int
SIZE = 16;
42
44
static
const
short
MAX_VALUE = (short)0x7FFF;
45
47
static
const
short
MIN_VALUE = (short)0x8000;
48
49
public
:
50
54
Short
(
short
value );
55
62
Short
(
const
std::string& value );
63
64
virtual
~Short
() {}
65
74
virtual
int
compareTo(
const
Short
& s )
const
;
75
79
bool
equals
(
const
Short
& s )
const
{
80
return
this->value == s.value;
81
}
82
88
virtual
bool
operator==
(
const
Short
& s )
const
{
89
return
this->value == s.value;
90
}
91
98
virtual
bool
operator<
(
const
Short
& s )
const
{
99
return
this->value < s.value;
100
}
101
110
virtual
int
compareTo(
const
short
& s )
const
;
111
115
bool
equals
(
const
short
& s )
const
{
116
return
this->value == s;
117
}
118
124
virtual
bool
operator==
(
const
short
& s )
const
{
125
return
this->value == s;
126
}
127
134
virtual
bool
operator<
(
const
short
& s )
const
{
135
return
this->value < s;
136
}
137
141
std::string toString()
const
;
142
147
virtual
double
doubleValue
()
const
{
148
return
(
double
)this->value;
149
}
150
155
virtual
float
floatValue
()
const
{
156
return
(
float
)this->value;
157
}
158
163
virtual
unsigned
char
byteValue
()
const
{
164
return
(
unsigned
char
)this->value;
165
}
166
171
virtual
short
shortValue
()
const
{
172
return
this->value;
173
}
174
179
virtual
int
intValue
()
const
{
180
return
(
int
)this->value;
181
}
182
187
virtual
long
long
longValue
()
const
{
188
return
(
long
long
)this->value;
189
}
190
191
public
:
// statics
192
196
static
std::string toString(
short
value );
197
213
static
Short
decode(
const
std::string& value );
214
221
static
short
reverseBytes(
short
value );
222
246
static
short
parseShort(
const
std::string& s,
int
radix );
247
260
static
short
parseShort(
const
std::string& s );
261
267
static
Short
valueOf(
short
value );
268
279
static
Short
valueOf(
const
std::string& value );
280
293
static
Short
valueOf(
const
std::string& value,
int
radix );
294
295
};
296
297
}}
298
299
#endif
/*_DECAF_LANG_SHORT_H_*/
src
main
decaf
lang
Short.h
Generated on Mon Mar 4 2013 10:25:46 for activemq-cpp-3.6.0 by
1.8.1.2