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

A signed long integer. More...

#include <base/LongInteger.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

 LongInteger () noexcept
 
 LongInteger (long long value) noexcept
 
 LongInteger (const LongInteger &copy) noexcept
 
LongIntegeroperator= (const LongInteger &assign) noexcept
 
long long getValue () const noexcept
 
void setValue (long long value) noexcept
 
 operator long long () const noexcept
 

Static Public Member Functions

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

Static Public Attributes

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

Protected Attributes

long long value = 0
 

Detailed Description

A signed long integer.

Signed and long integer (64 bits or more).

Version
1.1

Constructor & Destructor Documentation

◆ LongInteger() [1/3]

LongInteger::LongInteger ( )
inlinenoexcept

Initializes the long integer as zero.

◆ LongInteger() [2/3]

LongInteger::LongInteger ( long long  value)
inlinenoexcept

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

Parameters
valueThe desired value.

◆ LongInteger() [3/3]

LongInteger::LongInteger ( const LongInteger copy)
inlinenoexcept

Initializes integer by copying from other integer.

Member Function Documentation

◆ getValue()

long long LongInteger::getValue ( ) const
inlinenoexcept

Gets the value of the integer.

◆ operator long long()

LongInteger::operator long long ( ) const
inlinenoexcept

Casts integer to native type.

◆ operator=()

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

Assignment of integer to this integer.

◆ parse() [1/2]

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

Returns the value of the integer string representation.

Parameters
stringThe string representation.
flagsThe parsing flags.

◆ parse() [2/2]

static long long LongInteger::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 LongInteger::setValue ( long long  value)
inlinenoexcept

Sets the value of the integer.

Parameters
valueThe desired value.

Member Data Documentation

◆ MAXIMUM

const long long LongInteger::MAXIMUM = PrimitiveTraits<long long>::MAXIMUM
static

Specifies the maximum value.

◆ MINIMUM

const long long LongInteger::MINIMUM = PrimitiveTraits<long long>::MINIMUM
static

Specifies the minimum value.

◆ SIGNED

const bool LongInteger::SIGNED = true
static

True if the integer type is signed.

◆ value

long long LongInteger::value = 0
protected

The value.