rapidyaml  0.16.0
parseandemitYAML,anddoitfast
substr.hpp File Reference

read+write string views More...

#include <string.h>
#include <ctype.h>
#include <type_traits>
#include "c4/export.hpp"
#include "c4/language.hpp"
#include "c4/error.hpp"
#include "c4/substr_fwd.hpp"

Go to the source code of this file.

Classes

struct  c4::is_string< T >
 a traits class to mark a type as a string type, meaning c4::to_csubstr() can be used directly instead of c4::to_chars() when formatting the string. More...
 
struct  c4::is_writeable_string< T >
 a traits class to mark a type as a writeable string type, meaning c4::to_substr() can be used directly instead of c4::from_chars() when reading the string. More...
 
struct  c4::is_string< basic_substring< C > >
 
struct  c4::is_string< const basic_substring< char > >
 
struct  c4::is_string< const basic_substring< const char > >
 
struct  c4::is_writeable_string< basic_substring< char > >
 
struct  c4::is_writeable_string< const basic_substring< char > >
 
struct  c4::is_compatible_char_ptr< FromPointerType, ToValueType >
 
struct  c4::can_borrow_char_ptr< FromPointerType, ToValueType >
 
struct  c4::basic_substring< C >
 a non-owning string-view, consisting of a character pointer and a length. More...
 
struct  c4::basic_substring< C >::first_of_any_result
 
struct  c4::basic_substring< C >::split_proxy_impl::split_iterator_impl
 

Namespaces

 c4
 

Macros

#define _c4append(first, last)
 

Typedefs

using c4::substr = basic_substring< char >
 a mutable string view More...
 
using c4::csubstr = basic_substring< const char >
 an immutable string view More...
 

Functions

template<size_t N>
substr c4::to_substr (char(&s)[N]) noexcept
 
template<size_t N>
csubstr c4::to_csubstr (const char(&s)[N]) noexcept
 
template<class U >
auto c4::to_substr (U s) noexcept-> typename std::enable_if< is_compatible_char_ptr< U, char >::value, substr >::type
 Create a substring from a C-string (char*-like pointer) More...
 
template<class U >
auto c4::to_csubstr (U s) noexcept-> typename std::enable_if< is_compatible_char_ptr< U, const char >::value, csubstr >::type
 Create a substring from a const char*-like pointer. More...
 
substr c4::to_substr (substr s) noexcept
 
csubstr c4::to_csubstr (substr s) noexcept
 
csubstr c4::to_csubstr (csubstr s) noexcept
 
template<typename C >
bool c4::operator== (const char c, basic_substring< C > const that) noexcept
 
template<typename C >
bool c4::operator!= (const char c, basic_substring< C > const that) noexcept
 
template<typename C >
bool c4::operator< (const char c, basic_substring< C > const that) noexcept
 
template<typename C >
bool c4::operator> (const char c, basic_substring< C > const that) noexcept
 
template<typename C >
bool c4::operator<= (const char c, basic_substring< C > const that) noexcept
 
template<typename C >
bool c4::operator>= (const char c, basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool c4::operator== (const char(&arr)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool c4::operator!= (const char(&arr)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool c4::operator< (const char(&arr)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool c4::operator> (const char(&arr)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool c4::operator<= (const char(&arr)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool c4::operator>= (const char(&arr)[N], basic_substring< C > const that) noexcept
 
template<typename U , typename C >
auto c4::operator== (U c_str, basic_substring< C > const that) noexcept-> typename std::enable_if< is_compatible_char_ptr< U, C >::value, bool >::type
 
template<typename U , typename C >
auto c4::operator!= (U c_str, basic_substring< C > const that) noexcept-> typename std::enable_if< is_compatible_char_ptr< U, C >::value, bool >::type
 
template<typename U , typename C >
auto c4::operator< (U c_str, basic_substring< C > const that) noexcept-> typename std::enable_if< is_compatible_char_ptr< U, C >::value, bool >::type
 
template<typename U , typename C >
auto c4::operator> (U c_str, basic_substring< C > const that) noexcept-> typename std::enable_if< is_compatible_char_ptr< U, C >::value, bool >::type
 
template<typename U , typename C >
auto c4::operator<= (U c_str, basic_substring< C > const that) noexcept-> typename std::enable_if< is_compatible_char_ptr< U, C >::value, bool >::type
 
template<typename U , typename C >
auto c4::operator>= (U c_str, basic_substring< C > const that) noexcept-> typename std::enable_if< is_compatible_char_ptr< U, C >::value, bool >::type
 
template<class OStream , class C >
OStream & c4::operator<< (OStream &os, basic_substring< C > s)
 output the string to an ostream-like type More...
 

Detailed Description

read+write string views

Definition in file substr.hpp.

Macro Definition Documentation

#define _c4append (   first,
  last 
)
Value:
{ \
C4_ASSERT((last) >= (first)); \
size_t num = static_cast<size_t>((last) - (first)); \
if(num > 0 && sz + num <= dst.len) \
{ \
memcpy(dst.str + sz, first, num * sizeof(C)); \
} \
sz += num; \
}

Referenced by c4::basic_substring< char >::replace_all().