Base Framework
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
ShortInteger Class Reference

A signed short integer. More...

#include <base/ShortInteger.h>

Inherits Object.

Public Types

enum  { FLAG_ALLOW_SPACES = 1 << 0, FLAG_ALLOW_SIGN = 1 << 1, FLAG_DEFAULT = FLAG_ALLOW_SPACES | FLAG_ALLOW_SIGN }
 

Public Member Functions

 ShortInteger () noexcept
 
 ShortInteger (short value) noexcept
 
 ShortInteger (const ShortInteger &copy) noexcept
 
ShortIntegeroperator= (const ShortInteger &assign) noexcept
 
short getValue () const noexcept
 
void setValue (short value) noexcept
 
 operator short () const noexcept
 

Static Public Member Functions

static short parse (const char *src, const char *end, unsigned int flags=FLAG_DEFAULT)
 
static short parse (const String &string, unsigned int flags=FLAG_DEFAULT)
 

Static Public Attributes

static const bool SIGNED = true
 
static const short MAXIMUM = PrimitiveTraits<short>::MAXIMUM
 
static const short MINIMUM = PrimitiveTraits<short>::MINIMUM
 

Protected Attributes

short value = 0
 

Detailed Description

A signed short integer.

Signed and short integer (16 bits or more).

Version
1.1

Constructor & Destructor Documentation

◆ ShortInteger() [1/3]

ShortInteger::ShortInteger ( )
inlinenoexcept

Initializes the short integer as zero.

◆ ShortInteger() [2/3]

ShortInteger::ShortInteger ( short  value)
inlinenoexcept

Initializes the short integer with the specified value. Implicit initialization allowed.

Parameters
valueThe desired value.

◆ ShortInteger() [3/3]

ShortInteger::ShortInteger ( const ShortInteger copy)
inlinenoexcept

Copy constructor. Initializes a new ShortInteger from other ShortInteger object.

Member Function Documentation

◆ getValue()

short ShortInteger::getValue ( ) const
inlinenoexcept

Gets the value of the integer.

◆ operator short()

ShortInteger::operator short ( ) const
inlinenoexcept

Casts integer to native type.

◆ operator=()

ShortInteger& ShortInteger::operator= ( const ShortInteger assign)
inlinenoexcept

Assignment operator.

◆ parse() [1/2]

static short ShortInteger::parse ( const char *  src,
const char *  end,
unsigned int  flags = FLAG_DEFAULT 
)
static

Returns the value of the integer string representation.

Parameters
srcThe string representation.
endThe string representation.
flagsThe parsing flags.

◆ parse() [2/2]

static short ShortInteger::parse ( const String string,
unsigned int  flags = FLAG_DEFAULT 
)
inlinestatic

Returns the value of the integer string representation.

Parameters
stringThe string representation.
flagsThe parsing flags.

◆ setValue()

void ShortInteger::setValue ( short  value)
inlinenoexcept

Sets the value of the integer.

Parameters
valueThe desired value.

Member Data Documentation

◆ MAXIMUM

const short ShortInteger::MAXIMUM = PrimitiveTraits<short>::MAXIMUM
static

Specifies the maximum value.

◆ MINIMUM

const short ShortInteger::MINIMUM = PrimitiveTraits<short>::MINIMUM
static

Specifies the minimum value.

◆ SIGNED

const bool ShortInteger::SIGNED = true
static

True if the integer type is signed.

◆ value

short ShortInteger::value = 0
protected

The value.