Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
Catch::StringRef Class Reference

#include <catch.hpp>

Public Types

using size_type = std::size_t
 

Public Member Functions

auto c_str () const -> char const *
 
auto currentData () const noexcept -> char const *
 
auto empty () const noexcept -> bool
 
auto numberOfCharacters () const noexcept -> size_type
 
 operator std::string () const
 
auto operator!= (StringRef const &other) const noexcept -> bool
 
auto operator= (StringRef const &other) noexcept -> StringRef &
 
auto operator== (StringRef const &other) const noexcept -> bool
 
auto operator[] (size_type index) const noexcept -> char
 
auto size () const noexcept -> size_type
 
 StringRef () noexcept
 
 StringRef (StringRef const &other) noexcept
 
 StringRef (StringRef &&other) noexcept
 
 StringRef (char const *rawChars) noexcept
 
 StringRef (char const *rawChars, size_type size) noexcept
 
 StringRef (std::string const &stdString) noexcept
 
auto substr (size_type start, size_type size) const noexcept -> StringRef
 
void swap (StringRef &other) noexcept
 
 ~StringRef () noexcept
 

Private Member Functions

auto isOwned () const noexcept -> bool
 
auto isSubstring () const noexcept -> bool
 
void takeOwnership ()
 

Private Attributes

char * m_data = nullptr
 
size_type m_size
 
char const * m_start
 

Static Private Attributes

static constexpr char const *const s_empty = ""
 

Friends

struct StringRefTestAccess
 

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. c_str() must return a null terminated string, however, and so the StringRef will internally take ownership (taking a copy), if necessary. In theory this ownership is not externally visible - but it does mean (substring) StringRefs should not be shared between threads.

Definition at line 522 of file catch.hpp.

Member Typedef Documentation

◆ size_type

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

Definition at line 524 of file catch.hpp.

Constructor & Destructor Documentation

◆ StringRef() [1/6]

Catch::StringRef::StringRef ( )
inlinenoexcept

Definition at line 539 of file catch.hpp.

◆ StringRef() [2/6]

Catch::StringRef::StringRef ( StringRef const &  other)
inlinenoexcept

Definition at line 543 of file catch.hpp.

◆ StringRef() [3/6]

Catch::StringRef::StringRef ( StringRef &&  other)
inlinenoexcept

Definition at line 548 of file catch.hpp.

◆ StringRef() [4/6]

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

◆ StringRef() [5/6]

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

Definition at line 558 of file catch.hpp.

◆ StringRef() [6/6]

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

Definition at line 563 of file catch.hpp.

◆ ~StringRef()

Catch::StringRef::~StringRef ( )
inlinenoexcept

Definition at line 568 of file catch.hpp.

Member Function Documentation

◆ c_str()

auto Catch::StringRef::c_str ( ) const -> char const *

◆ currentData()

auto Catch::StringRef::currentData ( ) const -> char const *
noexcept

◆ empty()

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

Definition at line 591 of file catch.hpp.

◆ isOwned()

auto Catch::StringRef::isOwned ( ) const -> bool
privatenoexcept

◆ isSubstring()

auto Catch::StringRef::isSubstring ( ) const -> bool
privatenoexcept

◆ numberOfCharacters()

auto Catch::StringRef::numberOfCharacters ( ) const -> size_type
noexcept

◆ operator std::string()

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

◆ operator!=()

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

◆ operator=()

auto Catch::StringRef::operator= ( StringRef const &  other) -> StringRef&
inlinenoexcept

Definition at line 572 of file catch.hpp.

◆ operator==()

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

◆ operator[]()

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

◆ size()

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

Definition at line 594 of file catch.hpp.

◆ substr()

auto Catch::StringRef::substr ( size_type  start,
size_type  size 
) const -> StringRef
noexcept

◆ swap()

void Catch::StringRef::swap ( StringRef other)
noexcept

◆ takeOwnership()

void Catch::StringRef::takeOwnership ( )
private

Friends And Related Function Documentation

◆ StringRefTestAccess

friend struct StringRefTestAccess
friend

Definition at line 527 of file catch.hpp.

Member Data Documentation

◆ m_data

char* Catch::StringRef::m_data = nullptr
private

Definition at line 532 of file catch.hpp.

◆ m_size

size_type Catch::StringRef::m_size
private

Definition at line 530 of file catch.hpp.

◆ m_start

char const* Catch::StringRef::m_start
private

Definition at line 529 of file catch.hpp.

◆ s_empty

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

Definition at line 536 of file catch.hpp.


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


inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:10