libpqxx  5.0
pqxx::binarystring Class Reference

#include <binarystring.hxx>

Public Types

typedef unsigned char char_type
 
typedef std::char_traits
< char_type >::char_type 
value_type
 
typedef size_t size_type
 
typedef long difference_type
 
typedef const value_typeconst_reference
 
typedef const value_typeconst_pointer
 
typedef const_pointer const_iterator
 
typedef std::reverse_iterator
< const_iterator
const_reverse_iterator
 

Public Member Functions

 binarystring (const binarystring &)
 
 binarystring (const field &)
 Read and unescape bytea field. More...
 
 binarystring (const std::string &)
 Copy binary data from std::string. More...
 
 binarystring (const void *, size_t)
 Copy binary data of given length straight out of memory. More...
 
 ~binarystring ()
 
size_type size () const PQXX_NOEXCEPT
 Size of converted string in bytes. More...
 
size_type length () const PQXX_NOEXCEPT
 Size of converted string in bytes. More...
 
bool empty () const PQXX_NOEXCEPT
 
const_iterator begin () const PQXX_NOEXCEPT
 
const_iterator cbegin () const PQXX_NOEXCEPT
 
const_iterator end () const PQXX_NOEXCEPT
 
const_iterator cend () const PQXX_NOEXCEPT
 
const_reference front () const PQXX_NOEXCEPT
 
const_reference back () const PQXX_NOEXCEPT
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator rend () const
 
const_reverse_iterator crend () const
 
const value_typedata () const PQXX_NOEXCEPT
 Unescaped field contents. More...
 
const_reference operator[] (size_type i) const PQXX_NOEXCEPT
 
PQXX_PURE bool operator== (const binarystring &) const PQXX_NOEXCEPT
 
bool operator!= (const binarystring &rhs) const PQXX_NOEXCEPT
 
binarystringoperator= (const binarystring &)
 
const_reference at (size_type) const
 Index contained string, checking for valid index. More...
 
void swap (binarystring &)
 Swap contents with other binarystring. More...
 
const char * get () const PQXX_NOEXCEPT
 Raw character buffer (no terminating zero is added) More...
 
std::string str () const
 Read as regular C++ string (may include null characters) More...
 

Member Typedef Documentation

typedef unsigned char pqxx::binarystring::char_type

Constructor & Destructor Documentation

pqxx::binarystring::binarystring ( const binarystring rhs)
pqxx::binarystring::binarystring ( const field F)
explicit

Read and unescape bytea field.

The field will be zero-terminated, even if the original bytea field isn't.

Parameters
Fthe field to read; must be a bytea field

References pqxx::field::c_str().

pqxx::binarystring::binarystring ( const std::string &  s)
explicit

Copy binary data from std::string.

pqxx::binarystring::binarystring ( const void *  binary_data,
size_t  len 
)

Copy binary data of given length straight out of memory.

pqxx::binarystring::~binarystring ( )

Member Function Documentation

pqxx::binarystring::const_reference pqxx::binarystring::at ( size_type  n) const

Index contained string, checking for valid index.

References pqxx::to_string().

const_reference pqxx::binarystring::back ( ) const
const_iterator pqxx::binarystring::begin ( ) const
const_iterator pqxx::binarystring::cbegin ( ) const
const_iterator pqxx::binarystring::cend ( ) const
const_reverse_iterator pqxx::binarystring::crbegin ( ) const
const_reverse_iterator pqxx::binarystring::crend ( ) const
const value_type* pqxx::binarystring::data ( ) const

Unescaped field contents.

Referenced by pqxx::connection_base::quote().

bool pqxx::binarystring::empty ( ) const
const_iterator pqxx::binarystring::end ( ) const
const_reference pqxx::binarystring::front ( ) const
const char* pqxx::binarystring::get ( ) const

Raw character buffer (no terminating zero is added)

Warning
No terminating zero is added! If the binary data did not end in a null character, you will not find one here.
size_type pqxx::binarystring::length ( ) const

Size of converted string in bytes.

bool pqxx::binarystring::operator!= ( const binarystring rhs) const
pqxx::binarystring & pqxx::binarystring::operator= ( const binarystring rhs)
bool pqxx::binarystring::operator== ( const binarystring rhs) const
const_reference pqxx::binarystring::operator[] ( size_type  i) const
const_reverse_iterator pqxx::binarystring::rbegin ( ) const
const_reverse_iterator pqxx::binarystring::rend ( ) const
size_type pqxx::binarystring::size ( ) const

Size of converted string in bytes.

Referenced by pqxx::connection_base::quote().

std::string pqxx::binarystring::str ( ) const

Read as regular C++ string (may include null characters)

Warning
libpqxx releases before 3.1 stored the string and returned a reference to it. This is no longer the case! It now creates and returns a new string object. Avoid repeated use of this function; retrieve your string once and keep it in a local variable. Also, do not expect to be able to compare the string's address to that of an earlier invocation.
void pqxx::binarystring::swap ( binarystring rhs)

Swap contents with other binarystring.


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