activemq-cpp-3.4.0

decaf::lang::Byte Class Reference

#include <src/main/decaf/lang/Byte.h>

Inheritance diagram for decaf::lang::Byte:

Public Member Functions

 Byte (unsigned char value)
 Byte (const std::string &value)
 Creates a new Byte instance from the given string.
virtual ~Byte ()
virtual int compareTo (const Byte &c) const
 Compares this Byte instance with another.
virtual bool operator== (const Byte &c) const
 Compares equality between this object and the one passed.
virtual bool operator< (const Byte &c) const
 Compares this object to another and returns true if this object is considered to be less than the one passed.
virtual int compareTo (const unsigned char &c) const
 Compares this Byte instance with a char type.
virtual bool operator== (const unsigned char &c) const
 Compares equality between this object and the one passed.
virtual bool operator< (const unsigned char &c) const
 Compares this object to another and returns true if this object is considered to be less than the one passed.
bool equals (const Byte &c) const
bool equals (const unsigned char &c) const
std::string toString () const
virtual double doubleValue () const
 Answers the double value which the receiver represents.
virtual float floatValue () const
 Answers the float value which the receiver represents.
virtual unsigned char byteValue () const
 Answers the byte value which the receiver represents.
virtual short shortValue () const
 Answers the short value which the receiver represents.
virtual int intValue () const
 Answers the int value which the receiver represents.
virtual long long longValue () const
 Answers the long value which the receiver represents.

Static Public Member Functions

static std::string toString (unsigned char value)
static Byte decode (const std::string &value)
 Decodes a String into a Byte.
static unsigned char parseByte (const std::string &s, int radix)
 Parses the string argument as a signed unsigned char in the radix specified by the second argument.
static unsigned char parseByte (const std::string &s)
 Parses the string argument as a signed decimal unsigned char.
static Byte valueOf (unsigned char value)
 Returns a Character instance representing the specified char value.
static Byte valueOf (const std::string &value)
 Returns a Byte object holding the value given by the specified std::string.
static Byte valueOf (const std::string &value, int radix)
 Returns a Byte object holding the value extracted from the specified std::string when parsed with the radix given by the second argument.

Static Public Attributes

static const unsigned char MIN_VALUE = 0x7F
 The minimum value that a unsigned char can take on.
static const unsigned char MAX_VALUE = 0x80
 The maximum value that a unsigned char can take on.
static const int SIZE = 8
 The size of the primitive charactor in bits.

Constructor & Destructor Documentation

decaf::lang::Byte::Byte ( unsigned char  value)
Parameters:
value- the primitive value to wrap
decaf::lang::Byte::Byte ( const std::string &  value)

Creates a new Byte instance from the given string.

Parameters:
valueThe string to convert to an unsigned char
Exceptions:
NumberFormatExceptionif the string is not a valid byte.
virtual decaf::lang::Byte::~Byte ( ) [inline, virtual]

Member Function Documentation

virtual unsigned char decaf::lang::Byte::byteValue ( ) const [inline, virtual]

Answers the byte value which the receiver represents.

Returns:
byte the value of the receiver.

Reimplemented from decaf::lang::Number.

virtual int decaf::lang::Byte::compareTo ( const unsigned char &  c) const [inline, virtual]

Compares this Byte instance with a char type.

Parameters:
c- the char instance to be compared
Returns:
zero if this object represents the same char value as the argument; a positive value if this object represents a value greater than the passed in value, and -1 if this object repesents a value less than the passed in value.

Implements decaf::lang::Comparable< unsigned char >.

virtual int decaf::lang::Byte::compareTo ( const Byte c) const [inline, virtual]

Compares this Byte instance with another.

Parameters:
c- the Byte instance to be compared
Returns:
zero if this object represents the same char value as the argument; a positive value if this object represents a value greater than the passed in value, and -1 if this object repesents a value less than the passed in value.

Implements decaf::lang::Comparable< Byte >.

static Byte decaf::lang::Byte::decode ( const std::string &  value) [static]

Decodes a String into a Byte.

Accepts decimal, hexadecimal, and octal numbers given by the following grammar:

The sequence of characters following an (optional) negative sign and/or radix specifier ("0x", "0X", "#", or leading zero) is parsed as by the Byte::parseByte method with the indicated radix (10, 16, or 8). This sequence of characters must represent a positive value or a NumberFormatException will be thrown. The result is negated if first character of the specified String is the minus sign. No whitespace characters are permitted in the string.

Parameters:
value- The string to decode
Returns:
a Byte object containing the decoded value
Exceptions:
NumberFomatExceptionif the string is not formatted correctly.
virtual double decaf::lang::Byte::doubleValue ( ) const [inline, virtual]

Answers the double value which the receiver represents.

Returns:
double the value of the receiver.

Implements decaf::lang::Number.

bool decaf::lang::Byte::equals ( const unsigned char &  c) const [inline, virtual]
Returns:
true if the two Bytes have the same value.

Implements decaf::lang::Comparable< unsigned char >.

bool decaf::lang::Byte::equals ( const Byte c) const [inline, virtual]
Returns:
true if the two Byte Objects have the same value.

Implements decaf::lang::Comparable< Byte >.

virtual float decaf::lang::Byte::floatValue ( ) const [inline, virtual]

Answers the float value which the receiver represents.

Returns:
float the value of the receiver.

Implements decaf::lang::Number.

virtual int decaf::lang::Byte::intValue ( ) const [inline, virtual]

Answers the int value which the receiver represents.

Returns:
int the value of the receiver.

Implements decaf::lang::Number.

virtual long long decaf::lang::Byte::longValue ( ) const [inline, virtual]

Answers the long value which the receiver represents.

Returns:
long long the value of the receiver.

Implements decaf::lang::Number.

virtual bool decaf::lang::Byte::operator< ( const unsigned char &  c) const [inline, virtual]

Compares this object to another and returns true if this object is considered to be less than the one passed.

This

Parameters:
c- the value to be compared to this one.
Returns:
true if this object is equal to the one passed.

Implements decaf::lang::Comparable< unsigned char >.

virtual bool decaf::lang::Byte::operator< ( const Byte c) const [inline, virtual]

Compares this object to another and returns true if this object is considered to be less than the one passed.

This

Parameters:
c- the value to be compared to this one.
Returns:
true if this object is equal to the one passed.

Implements decaf::lang::Comparable< Byte >.

virtual bool decaf::lang::Byte::operator== ( const Byte c) const [inline, virtual]

Compares equality between this object and the one passed.

Parameters:
c- the value to be compared to this one.
Returns:
true if this object is equal to the one passed.

Implements decaf::lang::Comparable< Byte >.

virtual bool decaf::lang::Byte::operator== ( const unsigned char &  c) const [inline, virtual]

Compares equality between this object and the one passed.

Parameters:
c- the value to be compared to this one.
Returns:
true if this object is equal to the one passed.

Implements decaf::lang::Comparable< unsigned char >.

static unsigned char decaf::lang::Byte::parseByte ( const std::string &  s) [static]

Parses the string argument as a signed decimal unsigned char.

The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' to indicate a negative value. The resulting unsigned char value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseByte( const std::string, int ) method.

Parameters:
s- String to convert to a unsigned char
Returns:
the converted unsigned char value
Exceptions:
NumberFormatExceptionif the string is not a unsigned char.
static unsigned char decaf::lang::Byte::parseByte ( const std::string &  s,
int  radix 
) [static]

Parses the string argument as a signed unsigned char in the radix specified by the second argument.

The characters in the string must all be digits, of the specified radix (as determined by whether Character.digit(char, int) returns a nonnegative value) except that the first character may be an ASCII minus sign '-' to indicate a negative value. The resulting byte value is returned.

An exception of type NumberFormatException is thrown if any of the following situations occurs: * The first argument is null or is a string of length zero. * The radix is either smaller than Character.MIN_RADIX or larger than Character::MAX_RADIX. * Any character of the string is not a digit of the specified radix, except that the first character may be a minus sign '-' provided that the string is longer than length 1. * The value represented by the string is not a value of type unsigned char.

Parameters:
s- the String containing the unsigned char to be parsed
radix- the radix to be used while parsing s
Returns:
the unsigned char represented by the string argument in the specified radix.
Exceptions:
NumberFormatException- If String does not contain a parsable unsigned char.
virtual short decaf::lang::Byte::shortValue ( ) const [inline, virtual]

Answers the short value which the receiver represents.

Returns:
short the value of the receiver.

Reimplemented from decaf::lang::Number.

static std::string decaf::lang::Byte::toString ( unsigned char  value) [static]
Returns:
a string representing the primitive value as Base 10
std::string decaf::lang::Byte::toString ( ) const
Returns:
this Byte Object as a String Representation
static Byte decaf::lang::Byte::valueOf ( unsigned char  value) [inline, static]

Returns a Character instance representing the specified char value.

Parameters:
value- the primitive char to wrap.
Returns:
a new Character instance that wraps this value.
static Byte decaf::lang::Byte::valueOf ( const std::string &  value,
int  radix 
) [static]

Returns a Byte object holding the value extracted from the specified std::string when parsed with the radix given by the second argument.

The first argument is interpreted as representing a signed unsigned char in the radix specified by the second argument, exactly as if the argument were given to the parseByte( std::string, int ) method. The result is a Byte object that represents the unsigned char value specified by the string.

Parameters:
value- std::string to parse as base ( radix )
radix- base of the string to parse.
Returns:
new Byte Object wrapping the primitive
Exceptions:
NumberFormatExceptionif the string is not a valid unsigned char.
static Byte decaf::lang::Byte::valueOf ( const std::string &  value) [static]

Returns a Byte object holding the value given by the specified std::string.

The argument is interpreted as representing a signed decimal unsigned char, exactly as if the argument were given to the parseByte( std::string ) method. The result is a Byte object that represents the unsigned char value specified by the string.

Parameters:
value- std::string to parse as base 10
Returns:
new Byte Object wrapping the primitive
Exceptions:
NumberFormatExceptionif the string is not a decimal unsigned char.

Field Documentation

const unsigned char decaf::lang::Byte::MAX_VALUE = 0x80 [static]

The maximum value that a unsigned char can take on.

const unsigned char decaf::lang::Byte::MIN_VALUE = 0x7F [static]

The minimum value that a unsigned char can take on.

const int decaf::lang::Byte::SIZE = 8 [static]

The size of the primitive charactor in bits.


The documentation for this class was generated from the following file: