Keyple C++  0.9.0
Keyple, an Open Source SDK for Ticketing
Public Member Functions | Static Public Member Functions | List of all members
keyple::common::Integer Class Reference

#include <Integer.h>

Public Member Functions

 Integer (int value)
 
std::string toString ()
 

Static Public Member Functions

static std::string toString (int i, int radix)
 
static std::string toString (int i)
 
static int parseInt (const std::string &str, const int radix)
 
static int parseInt (const std::string &str, int radix, const bool decode)
 

Constructor & Destructor Documentation

◆ Integer()

keyple::common::Integer::Integer ( int  value)
inlineexplicit

Member Function Documentation

◆ parseInt() [1/2]

static int keyple::common::Integer::parseInt ( const std::string &  str,
const int  radix 
)
inlinestatic

Converts the specified String into an int using the specified radix (base). The string must not be null or empty. It may begin with an optional '-', which will negate the answer, provided that there are also valid digits. Each digit is parsed as if by Character.digit(d, radix), and must be in the range 0 to radix - 1. Finally, the result must be within MIN_VALUE to MAX_VALUE, inclusive. Unlike Double.parseDouble, you may not have a leading '+'.

Parameters
strthe String to convert
radixthe radix (base) to use in the conversion
Returns
the String argument converted to int
Exceptions
NumberFormatExceptionif s cannot be parsed as an int

◆ parseInt() [2/2]

static int keyple::common::Integer::parseInt ( const std::string &  str,
int  radix,
const bool  decode 
)
inlinestatic

Helper for parsing ints, used by Integer, Short, and Byte.

Parameters
strthe string to parse
radixthe radix to use, must be 10 if decode is true
decodeif called from decode
Returns
the parsed int value
Exceptions
NumberFormatExceptionif there is an error
NullPointerExceptionif decode is true and str if null
See also
parseInt()
decode()
parseByte()
parseShort()

◆ toString() [1/3]

std::string keyple::common::Integer::toString ( )
inline

◆ toString() [2/3]

static std::string keyple::common::Integer::toString ( int  i)
inlinestatic

◆ toString() [3/3]

static std::string keyple::common::Integer::toString ( int  i,
int  radix 
)
inlinestatic

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