Pigweed
 
Loading...
Searching...
No Matches
string.h File Reference

pw::InlineBasicString and pw::InlineString are safer alternatives to std::basic_string and std::string. More...

#include <cstddef>
#include <initializer_list>
#include <iterator>
#include <type_traits>
#include "pw_assert/assert.h"
#include "pw_preprocessor/compiler.h"
#include "pw_string/internal/string_impl.h"
#include "pw_string/internal/string_common_functions.inc"

Go to the source code of this file.

Classes

class  pw::InlineBasicString< T, kCapacity >
 pw::InlineBasicString is a fixed-capacity version of std::basic_string. In brief: More...
 
class  pw::InlineBasicString< T, string_impl::kGeneric >
 

Namespaces

namespace  pw
 Provides basic helpers for reading and writing UTF-8 encoded strings.
 

Macros

#define _PW_STRING_CAPACITY_TOO_SMALL_FOR_ARRAY
 
#define _PW_STRING_CAPACITY_TOO_SMALL_FOR_STRING
 

Typedefs

template<size_t kCapacity = string_impl::kGeneric>
using pw::InlineString = InlineBasicString< char, kCapacity >
 pw::InlineString is an alias of pw::InlineBasicString<char> and is equivalent to std::string.
 
template<size_t kCapacity = string_impl::kGeneric>
using pw::InlineByteString = InlineBasicString< std::byte, kCapacity >
 pw::InlineByteString is an alias of pw::InlineBasicString<std::byte>. InlineByteString may be used as a simple, efficient byte container.
 

Functions

template<typename T , size_t kLhsCapacity, size_t kRhsCapacity>
constexpr bool pw::operator== (const InlineBasicString< T, kLhsCapacity > &lhs, const InlineBasicString< T, kRhsCapacity > &rhs) noexcept
 
template<typename T , size_t kLhsCapacity, size_t kRhsCapacity>
constexpr bool pw::operator!= (const InlineBasicString< T, kLhsCapacity > &lhs, const InlineBasicString< T, kRhsCapacity > &rhs) noexcept
 
template<typename T , size_t kLhsCapacity, size_t kRhsCapacity>
constexpr bool pw::operator< (const InlineBasicString< T, kLhsCapacity > &lhs, const InlineBasicString< T, kRhsCapacity > &rhs) noexcept
 
template<typename T , size_t kLhsCapacity, size_t kRhsCapacity>
constexpr bool pw::operator<= (const InlineBasicString< T, kLhsCapacity > &lhs, const InlineBasicString< T, kRhsCapacity > &rhs) noexcept
 
template<typename T , size_t kLhsCapacity, size_t kRhsCapacity>
constexpr bool pw::operator> (const InlineBasicString< T, kLhsCapacity > &lhs, const InlineBasicString< T, kRhsCapacity > &rhs) noexcept
 
template<typename T , size_t kLhsCapacity, size_t kRhsCapacity>
constexpr bool pw::operator>= (const InlineBasicString< T, kLhsCapacity > &lhs, const InlineBasicString< T, kRhsCapacity > &rhs) noexcept
 
template<typename T , size_t kLhsCapacity>
constexpr bool pw::operator== (const InlineBasicString< T, kLhsCapacity > &lhs, const T *rhs)
 
template<typename T , size_t kRhsCapacity>
constexpr bool pw::operator== (const T *lhs, const InlineBasicString< T, kRhsCapacity > &rhs)
 
template<typename T , size_t kLhsCapacity>
constexpr bool pw::operator!= (const InlineBasicString< T, kLhsCapacity > &lhs, const T *rhs)
 
template<typename T , size_t kRhsCapacity>
constexpr bool pw::operator!= (const T *lhs, const InlineBasicString< T, kRhsCapacity > &rhs)
 
template<typename T , size_t kLhsCapacity>
constexpr bool pw::operator< (const InlineBasicString< T, kLhsCapacity > &lhs, const T *rhs)
 
template<typename T , size_t kRhsCapacity>
constexpr bool pw::operator< (const T *lhs, const InlineBasicString< T, kRhsCapacity > &rhs)
 
template<typename T , size_t kLhsCapacity>
constexpr bool pw::operator<= (const InlineBasicString< T, kLhsCapacity > &lhs, const T *rhs)
 
template<typename T , size_t kRhsCapacity>
constexpr bool pw::operator<= (const T *lhs, const InlineBasicString< T, kRhsCapacity > &rhs)
 
template<typename T , size_t kLhsCapacity>
constexpr bool pw::operator> (const InlineBasicString< T, kLhsCapacity > &lhs, const T *rhs)
 
template<typename T , size_t kRhsCapacity>
constexpr bool pw::operator> (const T *lhs, const InlineBasicString< T, kRhsCapacity > &rhs)
 
template<typename T , size_t kLhsCapacity>
constexpr bool pw::operator>= (const InlineBasicString< T, kLhsCapacity > &lhs, const T *rhs)
 
template<typename T , size_t kRhsCapacity>
constexpr bool pw::operator>= (const T *lhs, const InlineBasicString< T, kRhsCapacity > &rhs)
 

Detailed Description

pw::InlineBasicString and pw::InlineString are safer alternatives to std::basic_string and std::string.

Macro Definition Documentation

◆ _PW_STRING_CAPACITY_TOO_SMALL_FOR_ARRAY

#define _PW_STRING_CAPACITY_TOO_SMALL_FOR_ARRAY
Value:
"The pw::InlineString's capacity is too small to hold the assigned string " \
"literal or character array. When assigning a literal or array to a " \
"pw::InlineString, the pw::InlineString's capacity must be large enough " \
"for the entire string, not counting the null terminator."

◆ _PW_STRING_CAPACITY_TOO_SMALL_FOR_STRING

#define _PW_STRING_CAPACITY_TOO_SMALL_FOR_STRING
Value:
"When assigning one pw::InlineString with known capacity to another, the " \
"capacity of the destination pw::InlineString must be at least as large as " \
"the source string."