Horizon
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
Catch::StringRef Class Reference

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. More...

#include <catch_amalgamated.hpp>

Public Types

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

Public Member Functions

 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
 Provides a three-way comparison with rhs.
 

Friends

std::string & operator+= (std::string &lhs, StringRef sr)
 
std::ostream & operator<< (std::ostream &os, StringRef sr)
 
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 Function Documentation

◆ 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


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