Class ModLength

Inheritance Relationships

Base Type

Class Documentation

class URI::Template::ModLength : public URI::Template::Modifier

Length modifier.

This class represents length modifier for a variable.

Public Functions

ModLength() = default

Constructor.

virtual ~ModLength() = default

Destructor.

virtual ModifierType Type() const override

Get type of the modifier.

Returns

ModifierType::LENGTH.

virtual char Start() const override

Get starting character of the modifier.

Returns

‘:’.

Public Static Functions

static bool IsDigit(char c)

Fast and limited alternative to std::isdigit.

This function is used to parse length modifier in URI-template.

Parameters

[in] c – Character to test.

Returns

If c in [0..9] range.

static unsigned ToNumber(const std::string &num_str)

Fast and limited alternative to std::atoi.

This function is used to parse length modifier in URI-template.

  • num_str can contain only [0..9] digits.

  • Does not support signed notation.

Parameters

[in] num_str – Character to test.

Throws

std::runtime_error – if num_str length greater than 10.

Returns

Number num_str represents.