Loading...
Searching...
No Matches
Catch::StringRef Class Reference

`#include <catch_amalgamated.hpp>`

## Public Types

using | size_type = std::size_t
using | const_iterator = const char*

## Public Member Functions

constexpr | StringRef () noexcept=default
| StringRef (char const *rawChars) noexcept
constexpr | StringRef (char const *rawChars, size_type size) noexcept
| StringRef (std::string const &stdString) noexcept
| operator std::string () const
auto | operator== (StringRef other) const noexcept -> bool
auto | operator!= (StringRef other) const noexcept -> bool
constexpr auto | operator[] (size_type index) const noexcept -> char
bool | operator< (StringRef rhs) const noexcept
constexpr auto | empty () const noexcept -> bool
constexpr auto | size () const noexcept -> size_type
constexpr StringRef | substr (size_type start, size_type length) const noexcept
constexpr char const * | data () const noexcept
constexpr const_iterator | begin () const
constexpr const_iterator | end () const
int | compare (StringRef rhs) const

## Static Public Attributes

static constexpr size_type | npos { static_cast<size_type>( -1 ) }

## Private Attributes

char const * | m_start = s_empty
size_type | m_size = 0

## Static Private Attributes

static constexpr char const *const | s_empty = ""

## Friends

std::string & | operator+= (std::string &lhs, StringRef rhs)
std::ostream & | operator<< (std::ostream &os, StringRef str)
std::string | operator+ (StringRef lhs, StringRef rhs)

## Detailed Description

A non-owning string class (similar to the forthcoming std::string_view) Note that, because a StringRef may be a substring of another string, it may not be null terminated.

## Member Typedef Documentation

## const_iterator

using Catch::StringRef::const_iterator = const char*

## size_type

using Catch::StringRef::size_type = std::size_t

## Constructor & Destructor Documentation

## StringRef() [1/4]

Catch::StringRef::StringRef | ( |  | ) |

constexprdefaultnoexcept

Here is the call graph for this function:
Here is the caller graph for this function:

## StringRef() [2/4]

Catch::StringRef::StringRef | ( | char const * | rawChars | ) |

noexcept

Here is the call graph for this function:

## StringRef() [3/4]

Catch::StringRef::StringRef | ( | char const * | rawChars,
|  | size_type | size )

inlineconstexprnoexcept

Here is the call graph for this function:

## StringRef() [4/4]

Catch::StringRef::StringRef | ( | std::string const & | stdString | ) |

inlinenoexcept

## Member Function Documentation

## begin()

const_iterator Catch::StringRef::begin | ( |  | ) | const

inlineconstexpr

## compare()

int Catch::StringRef::compare | ( | StringRef | rhs | ) | const

Provides a three-way comparison with rhs

Returns negative number if lhs < rhs, 0 if lhs == rhs, and a positive number if lhs > rhs

Here is the call graph for this function:
Here is the caller graph for this function:

## data()

char const * Catch::StringRef::data | ( |  | ) | const

inlineconstexprnoexcept

## empty()

auto Catch::StringRef::empty | ( |  | ) | const -> bool

inlineconstexprnoexcept

Here is the caller graph for this function:

## end()

const_iterator Catch::StringRef::end | ( |  | ) | const

inlineconstexpr

## operator std::string()

Catch::StringRef::operator std::string | ( |  | ) | const

inlineexplicit

## operator!=()

auto Catch::StringRef::operator!= | ( | StringRef | other | ) | const -> bool

inlinenoexcept

Here is the call graph for this function:

## operator<()

bool Catch::StringRef::operator< | ( | StringRef | rhs | ) | const

noexcept

Here is the call graph for this function:

## operator==()

auto Catch::StringRef::operator== | ( | StringRef | other | ) | const -> bool

inlinenoexcept

Here is the call graph for this function:

## operator[]()

auto Catch::StringRef::operator[] | ( | size_type | index | ) | const -> char

inlineconstexprnoexcept

## size()

auto Catch::StringRef::size | ( |  | ) | const -> size_type

inlineconstexprnoexcept

Here is the caller graph for this function:

## substr()

StringRef Catch::StringRef::substr | ( | size_type | start,
|  | size_type | length ) const

inlineconstexprnoexcept

Here is the call graph for this function:
Here is the caller graph for this function:

## Friends And Related Symbol Documentation

## operator+

std::string operator+ | ( | StringRef | lhs,
|  | StringRef | rhs )

friend

## operator+=

std::string & operator+= | ( | std::string & | lhs,
|  | StringRef | rhs )

friend

## operator<<

std::ostream & operator<< | ( | std::ostream & | os,
|  | StringRef | str )

friend

## Member Data Documentation

## m_size

size_type Catch::StringRef::m_size = 0

private

## m_start

char const* Catch::StringRef::m_start = s_empty

private

## npos

size_type Catch::StringRef::npos { static_cast<size_type>( -1 ) }

staticconstexpr

## s_empty

char const* const Catch::StringRef::s_empty = ""

staticconstexprprivate

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

- tests/vendor/catch_amalgamated.hpp
- tests/vendor/catch_amalgamated.cpp