Struct PropertyParser

Struct Documentation

struct PropertyParser

Public Static Functions

template<typename exception_t>
static inline int as_int(const Property &property, const bool &check_upper_bound, const int &upper_bound, const bool &check_lower_bound, const int &lower_bound, const exception_t &exception)

Parse a property value as an integer.

Warning

May throw an exception_t if the value is not a valid integer or if it is out of bounds.

Parameters:
  • propertyProperty to parse

  • check_upper_bound – If true, check that the value is lower than upper_bound

  • upper_bound – Upper bound to check

  • check_lower_bound – If true, check that the value is greater than lower_bound

  • lower_bound – Lower bound to check

  • exceptionException to throw if the value is not a valid integer or if it is out of bounds

Returns:

The parsed integer value

template<typename exception_t>
static inline double as_double(const Property &property, const bool &check_upper_bound, const double &upper_bound, const bool &check_lower_bound, const double &lower_bound, const exception_t &exception)

Parse a property value as a double.

Warning

May throw an exception_t if the value is not a valid double or if it is out of bounds.

Parameters:
  • propertyProperty to parse

  • check_upper_bound – If true, check that the value is lower than upper_bound

  • upper_bound – Upper bound to check

  • check_lower_bound – If true, check that the value is greater than lower_bound

  • lower_bound – Lower bound to check

  • exceptionException to throw if the value is not a valid double or if it is out of bounds

Returns:

The parsed double value