template<int SIZE>
eckit::FixedString class

FixedString<SIZE> manages a SIZE-byte char array as a relatively thin utility wrapper.

  • Strings <= the given SIZE may be stored
  • Strings shorter than the given SIZE are null-character terminated
  • All relevant overflow and termination safety is handled internally inside the class when interacting with C library functions.

Public static functions

static auto static_size() -> size_t

Constructors, destructors, conversion operators

FixedString()
FixedString(const std::string&)
FixedString(const FixedString&)
FixedString(const char*)
operator std::string() const

Public functions

auto operator=(const FixedString&) -> FixedString&
auto operator=(const std::string&) -> FixedString&
auto operator<(const FixedString& other) const -> bool
auto operator>(const FixedString& other) const -> bool
auto operator==(const FixedString& other) const -> bool
auto operator!=(const FixedString& other) const -> bool
auto operator>=(const FixedString& other) const -> bool
auto operator<=(const FixedString& other) const -> bool
auto length() const -> size_t
auto empty() const -> bool
auto asString() const -> std::string
auto data() -> char*
auto data() const -> const char*
auto size() const -> size_t
The number of bytes in the managed array (always equal to SIZE).

Friends

auto operator<<(std::ostream& s, const FixedString& p) -> std::ostream&

Function documentation

template<int SIZE>
eckit::FixedString<SIZE>::FixedString()

Constructors

template<int SIZE>
size_t eckit::FixedString<SIZE>::length() const

The number of characters in the stored string, excluding the termination character if the string is shorter than SIZE.