Template Class StringStrict

Inheritance Relationships

Base Type

Class Documentation

template<::size64_t STRING_BUFFER_SIZE>
class StringStrict : public apex::BaseString<STRING_BUFFER_SIZE>

StringStrict defines a string class with constant memory footprint. The internal buffer size is defined by STRING_BUFFER_SIZE template parameter. The maximum length for a string is (STRING_BUFFER_SIZE - 1ULL). One character is reserved for terminating zero.

Template Parameters:

STRING_BUFFER_SIZE – defines the size of static string including its terminating zero.

Public Types

iterator = typename apex::template BaseString< STRING_BUFFER_SIZE >::template abs_iterator<::char8_t >
const_iterator = typename apex::template BaseString< STRING_BUFFER_SIZE >::template abs_iterator< const ::char8_t >

Public Functions

inline StringStrict(void)

default constructor

inline  StringStrict (const ::size64_t n, const ::char8_t c)

fill constructor Fills the string with n consecutive copies of character c. param[in] n is number of characters to copy. If n grater than the maximum capacity, std::overflow_error is thrown If n is npos, only maximum capacity is filled param[in] c is number of characters to copy.

Throws:

std::overflow_error

inline StringStrict< STRING_BUFFER_SIZE > & operator+= (const ::char8_t *const src)

operator+=

Parameters:

src[in] is the source string to add

Throws:
  • std::invalid_argument

  • std::overflow_error

Returns:

return the result of concatenation with the source string

inline StringStrict< STRING_BUFFER_SIZE > & operator+= (const ::char8_t chr)

operator += chr

Parameters:

chr[in] is the character to add

Throws:

std::overflow_error

Returns:

return the result of concatenation with the character

inline  StringStrict (const ::char8_t *const str)

constructor from an input string

Parameters:

str[in] is the source string

Throws:
  • std::invalid_argument

  • std::overflow_error

inline explicit StringStrict(const ::apex_string_t &str)

constructor from an Apex.OS string

Parameters:

str[in] is initializing string

Throws:
  • std::invalid_argument

  • std::overflow_error

template<::size64_t LEN>
inline StringStrict(const apex::BaseString<LEN> &src)

copy constructor

Parameters:

src[in] is initializing Apex.OS string

Throws:
  • std::invalid_argument

  • std::overflow_error

inline explicit StringStrict(const BaseString<STRING_BUFFER_SIZE> &src)

copy constructor See MISRA C++:2008 14-5-2

Parameters:

src[in] is initializing Apex.OS string

Throws:
  • std::invalid_argument

  • std::overflow_error

template<::size64_t LEN>
inline const StringStrict<STRING_BUFFER_SIZE + LEN> operator+(const StringStrict<LEN> &rhs) const

operator+

Parameters:

rhs[in] is the right hand addend

Throws:
  • std::invalid_argument

  • std::overflow_error

Returns:

the result of concatenation with right hand addend

template<::size64_t LEN>
inline auto operator+(const char (&rhs)[LEN]) const noexcept

operator+

Parameters:

rhs[in] is the right hand addend

Throws:
  • std::invalid_argument

  • std::overflow_error

Returns:

the result of concatenation with right hand addend

inline const apex::StringStrict<STRING_BUFFER_SIZE + APEX_STRING_SIZE> operator+(const ::apex_string_t &rhs) const

operator+

template<::size64_t LEN>
inline StringStrict &operator+=(const StringStrict<LEN> &rhs)

operator+=

Parameters:

rhs[in] is the right hand addend

Throws:
  • std::invalid_argument

  • std::overflow_error

Returns:

the result of concatenation with right hand addend

inline StringStrict<STRING_BUFFER_SIZE> &operator+=(const apex_string_t &src)

operator+=

Parameters:

src[in] is addend strng

Throws:
  • std::invalid_argument

  • std::overflow_error

Returns:

result of concatenation with addend string

inline StringStrict<STRING_BUFFER_SIZE> &operator=(const BaseString<STRING_BUFFER_SIZE> &rhs)

Assignment operator. See MISRA C++:2008 14-5-3.

Parameters:

rhs[in] is the source initializer

Throws:
  • std::invalid_argument

  • std::overflow_error

Returns:

return final string initialized with the source initializer

template<::size64_t LEN>
inline StringStrict<STRING_BUFFER_SIZE> &operator=(const BaseString<LEN> &rhs)

Assignment operator.

Parameters:

rhs[in] is the source initializer

Throws:
  • std::invalid_argument

  • std::overflow_error

Returns:

return final string initialized with the source initializer

inline StringStrict<STRING_BUFFER_SIZE> &operator=(const char8_t *const src)

Assignment operator.

Parameters:

src[in] is the source initializer

Throws:
  • std::invalid_argument

  • std::overflow_error

Returns:

return final string initialized with the source initializer

inline StringStrict<STRING_BUFFER_SIZE> &operator=(const apex_string_t &src)

Assignment operator.

Parameters:

src[in] is the source initializer

Throws:
  • std::invalid_argument

  • std::overflow_error

Returns:

return final string initialized with the source initializer

inline iterator begin() noexcept

Retrieves the begin iterator for this string.

Returns:

the begin iterator

inline iterator end() noexcept

Retrieves the end iterator for this string.

Returns:

the end iterator

inline const_iterator cbegin() const noexcept

Retrieves the begin constant iterator for this string.

Returns:

the begin iterator

inline const_iterator cend() const noexcept

Retrieves the end constant iterator for this string.

Returns:

the end iterator

Public Static Functions

static inline apex::StringStrict<STRING_BUFFER_SIZE> to_string(const uint32_t value)

Convert 32-bit unsigned integer in base 10 into an Apex.OS string. The method will throw std::overflow_error exception if the string’s capacity is insufficient.

Parameters:

value[in] is input 32-bit unsigned integer value to convert

Throws:

std::overflow_error

Returns:

return Apex.OS string that contains text representation of the input value in base 10.