rapidyaml  0.11.1
parse and emit YAML, and do it fast
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::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
 
struct  c4::is_string< T >
 a traits class to mark a type as a string type (meaning c4::to_csubstr() can be used directly). 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). More...
 
struct  c4::is_string< basic_substring< C > >
 
struct  c4::is_writeable_string< basic_substring< char > >
 
struct  c4::is_writeable_string< basic_substring< const char > >
 
struct  c4::is_string< const char * >
 
struct  c4::is_writeable_string< const char * >
 
struct  c4::is_string< char * >
 
struct  c4::is_writeable_string< char * >
 
struct  c4::is_string< const char(&)[N]>
 
struct  c4::is_writeable_string< const char(&)[N]>
 
struct  c4::is_string< char(&)[N]>
 
struct  c4::is_writeable_string< char(&)[N]>
 
struct  c4::is_string< const char[N]>
 
struct  c4::is_writeable_string< const char[N]>
 
struct  c4::is_string< char[N]>
 
struct  c4::is_writeable_string< char[N]>
 

Namespaces

 c4
 (Undefined by default) Use shorter error message from checks/asserts: do not show the check condition in the error message.
 

Macros

#define _c4append(first, last)
 

Functions

substr c4::to_substr (substr s) noexcept
 neutral version for use in generic code More...
 
csubstr c4::to_csubstr (substr s) noexcept
 neutral version for use in generic code More...
 
csubstr c4::to_csubstr (csubstr s) noexcept
 neutral version for use in generic code More...
 
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< std::is_same< U, char * >::value, substr >::type
 
template<class U >
auto c4::to_csubstr (U s) noexcept -> typename std::enable_if< std::is_same< U, const char * >::value||std::is_same< U, char * >::value, csubstr >::type
 
template<typename C , size_t N>
bool c4::operator== (const char(&s)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool c4::operator!= (const char(&s)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool c4::operator< (const char(&s)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool c4::operator> (const char(&s)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool c4::operator<= (const char(&s)[N], basic_substring< C > const that) noexcept
 
template<typename C , size_t N>
bool c4::operator>= (const char(&s)[N], 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 >
bool c4::operator>= (const char c, basic_substring< C > const that) noexcept
 
template<class OStream , class C >
OStream & c4::operator<< (OStream &os, basic_substring< C > s)
 output the string to a stream More...
 

Detailed Description

read+write string views

Definition in file substr.hpp.

Macro Definition Documentation

◆ _c4append

#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; \
}