Keyple C++  0.9.0
Keyple, an Open Source SDK for Ticketing
Public Member Functions | Static Public Member Functions | List of all members
keyple::core::util::KeypleAssert Class Referencefinal

#include <KeypleAssert.h>

Public Member Functions

const KeypleAssertnotNull (void *obj, const std::string &name) const
 
const KeypleAssertnotEmpty (const std::string &obj, const std::string &name) const
 
const KeypleAssertnotEmpty (const std::vector< uint8_t > &obj, const std::string &name) const
 
const KeypleAssertisTrue (const bool condition, const std::string &name) const
 
const KeypleAssertgreaterOrEqual (const int number, const int minValue, const std::string &name) const
 
const KeypleAssertisEqual (const int number, const int value, const std::string &name) const
 
const KeypleAssertisInRange (const int number, const int minValue, const int maxValue, const std::string &name) const
 

Static Public Member Functions

static const KeypleAssertgetInstance ()
 

Detailed Description

The utility class KeypleAssert exposes very useful methods for testing method call parameters and raising a keyple::common::exception::IllegalArgumentException unchecked exception.

Since
0.9

Member Function Documentation

◆ getInstance()

const KeypleAssert & keyple::core::util::KeypleAssert::getInstance ( )
static

Gets the unique instance.

Returns
the instance

◆ greaterOrEqual()

const KeypleAssert & keyple::core::util::KeypleAssert::greaterOrEqual ( const int  number,
const int  minValue,
const std::string &  name 
) const

Assert that an integer is not null and is greater than or equal to minValue.

Parameters
numberthe number to check
minValuethe min accepted value
namethe object name
Returns
the current instance
Exceptions
IllegalArgumentExceptionif number is null or has a value less than minValue.
Since
0.9

◆ isEqual()

const KeypleAssert & keyple::core::util::KeypleAssert::isEqual ( const int  number,
const int  value,
const std::string &  name 
) const

Assert that an integer is equal to value.

Parameters
numberthe number to check
valuethe expected value
namethe object name
Returns
the current instance
Exceptions
IllegalArgumentExceptionif number is null or has a value less than minValue.
Since
0.9

◆ isInRange()

const KeypleAssert & keyple::core::util::KeypleAssert::isInRange ( const int  number,
const int  minValue,
const int  maxValue,
const std::string &  name 
) const

Assert that an integer is not null and is in the range minValue, maxValue.

Parameters
numberthe number to check
minValuethe min accepted value
maxValuethe max accepted value
namethe object name
Returns
the current instance
Exceptions
IllegalArgumentExceptionif number is null or is out of range.
Since
0.9

◆ isTrue()

const KeypleAssert & keyple::core::util::KeypleAssert::isTrue ( const bool  condition,
const std::string &  name 
) const

Assert that a condition is true.

Parameters
conditionthe condition to check
namethe object name
Returns
the current instance
Exceptions
IllegalArgumentExceptionif condition is null or false
Since
0.9

◆ notEmpty() [1/2]

const KeypleAssert & keyple::core::util::KeypleAssert::notEmpty ( const std::string &  obj,
const std::string &  name 
) const

Assert that the input string is not null and not empty.

Parameters
objthe object to check
namethe object name
Returns
the current instance
Exceptions
IllegalArgumentExceptionif object is null or empty
Since
0.9

◆ notEmpty() [2/2]

const KeypleAssert & keyple::core::util::KeypleAssert::notEmpty ( const std::vector< uint8_t > &  obj,
const std::string &  name 
) const

Assert that a byte array is not null and not empty.

Parameters
objthe object to check
namethe object name
Returns
the current instance
Exceptions
IllegalArgumentExceptionif object is null or empty
Since
0.9

◆ notNull()

const KeypleAssert & keyple::core::util::KeypleAssert::notNull ( void *  obj,
const std::string &  name 
) const

Assert that the input object is not null.

Parameters
objthe object to check
namethe object name
Returns
the current instance
Exceptions
IllegalArgumentExceptionif object is null
Since
0.9

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