libpqxx
7.3.0
|
Marker-type wrapper: zero-terminated std::string_view
.
More...
#include <zview.hxx>
Public Member Functions | |
constexpr | zview () noexcept=default |
constexpr | zview (char const text[], std::ptrdiff_t len) |
Convenience overload: construct using pointer and signed length. More... | |
constexpr | zview (char text[], std::ptrdiff_t len) |
Convenience overload: construct using pointer and signed length. More... | |
template<typename... Args> | |
constexpr | zview (Args &&...args) |
Construct from any initialiser you might use for std::string_view . More... | |
zview (std::string const &str) | |
constexpr | zview (char const str[]) |
Construct a zview from a C-style string. More... | |
template<size_t size> | |
constexpr | zview (char const (&literal)[size]) |
constexpr char const * | c_str () const noexcept |
Either a null pointer, or a zero-terminated text buffer. More... | |
Marker-type wrapper: zero-terminated std::string_view
.
When you construct a zview, you are promising that if the data pointer is non-null, the underlying string is zero-terminated. It otherwise behaves exactly like a std::string_view.
The terminating zero is not "in" the string, so it does not count as part of the view's length.
The added guarantee lets the view be used as a C-style string, which often matters since libpqxx builds on top of a C library. For this reason, zview also adds a c_str
method.
|
defaultnoexcept |
constexpr pqxx::zview::zview | ( | char const | text[], |
std::ptrdiff_t | len | ||
) |
Convenience overload: construct using pointer and signed length.
constexpr pqxx::zview::zview | ( | char | text[], |
std::ptrdiff_t | len | ||
) |
Convenience overload: construct using pointer and signed length.
|
explicit |
Construct from any initialiser you might use for std::string_view
.
pqxx::zview::zview | ( | std::string const & | str | ) |
std::string
. constexpr pqxx::zview::zview | ( | char const | str[] | ) |
Construct a zview
from a C-style string.
zview
once and re-use it. constexpr pqxx::zview::zview | ( | char const (&) | literal[size] | ) |
|
noexcept |
Either a null pointer, or a zero-terminated text buffer.
Referenced by pqxx::result::column_number(), pqxx::connection::connection(), pqxx::encrypt_password(), pqxx::connection::encrypt_password(), pqxx::transaction_base::esc_raw(), pqxx::connection::prepare(), pqxx::transaction_base::quote_raw(), pqxx::connection::set_client_encoding(), and pqxx::connection::unesc_raw().