Dmitigr Pgfe  1.1beta
The modern C++ API to PostgreSQL
List of all members
Composite Class Referenceabstract

Represents an abstraction of a composite type. More...

#include <dmitigr/pgfe/composite.hpp>

Inheritance diagram for Composite:
Compositional

Public Member Functions

Observers
virtual const Datadata (std::size_t index) const =0
 
virtual const Datadata (const std::string &name, std::size_t offset=0) const =0
 
Modifiers
virtual void set_data (std::size_t index, std::unique_ptr< Data > &&data)=0
 Sets the object of type Data to the field of the composite. More...
 
virtual void set_data (std::size_t index, std::nullptr_t data)=0
 
template<typename T >
std::enable_if_t<!std::is_same_v< Data *, T > > set_data (std::size_t index, T &&value)
 
virtual void set_data (const std::string &name, std::unique_ptr< Data > &&data)=0
 
virtual void set_data (const std::string &name, std::nullptr_t data)=0
 
template<typename T >
std::enable_if_t<!std::is_same_v< Data *, T > > set_data (const std::string &name, T &&value)
 
virtual std::unique_ptr< Datarelease_data (std::size_t index)=0
 Release the object of type Data from the composite. More...
 
virtual std::unique_ptr< Datarelease_data (const std::string &name, std::size_t offset=0)=0
 
virtual void append_field (const std::string &name, std::unique_ptr< Data > &&data={})=0
 Appends the field to this composite. More...
 
template<typename T >
void append_field (const std::string &name, T &&value)
 
virtual void insert_field (std::size_t index, const std::string &name, std::unique_ptr< Data > &&data={})=0
 Inserts new field to a composite. More...
 
template<typename T >
void insert_field (std::size_t index, const std::string &name, T &&value)
 
virtual void insert_field (const std::string &name, const std::string &new_field_name, std::unique_ptr< Data > &&data)=0
 
template<typename T >
void insert_field (const std::string &name, const std::string &new_field_name, T &&value)
 
virtual void remove_field (std::size_t index)=0
 Removes field from a composite. More...
 
virtual void remove_field (const std::string &name, std::size_t offset=0)=0
 
Conversions
virtual std::vector< std::pair< std::string, std::unique_ptr< Data > > > to_vector () const =0
 
virtual std::vector< std::pair< std::string, std::unique_ptr< Data > > > move_to_vector ()=0
 
- Public Member Functions inherited from Compositional
virtual ~Compositional ()=default
 The destructor. More...
 
virtual std::size_t field_count () const =0
 
virtual bool has_fields () const =0
 
virtual const std::string & field_name (std::size_t index) const =0
 
virtual std::optional< std::size_t > field_index (const std::string &name, std::size_t offset=0) const =0
 
virtual std::size_t field_index_throw (const std::string &name, std::size_t offset=0) const =0
 Similar to field_index(const std::string&, std::size_t) except the requirement. More...
 
virtual bool has_field (const std::string &name, std::size_t offset=0) const =0
 

Constructors

static DMITIGR_PGFE_API std::unique_ptr< Composite > APIENTRY make ()
 
static DMITIGR_PGFE_API std::unique_ptr< Composite > APIENTRY make (std::vector< std::pair< std::string, std::unique_ptr< Data >>> &&v)
 
virtual std::unique_ptr< Compositeclone () const =0
 

Detailed Description

Represents an abstraction of a composite type.

Member Function Documentation

◆ append_field() [1/2]

virtual void append_field ( const std::string &  name,
std::unique_ptr< Data > &&  data = {} 
)
pure virtual

Appends the field to this composite.

Parameters
name- see Compositional.
data- the data to set.
Exception safety guarantee
Strong.

◆ append_field() [2/2]

void append_field ( const std::string &  name,
T &&  value 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ clone()

virtual std::unique_ptr<Composite> clone ( ) const
pure virtual
Returns
The copy of this instance.

◆ data() [1/2]

virtual const Data* data ( std::size_t  index) const
pure virtual
Returns
The field data of this composite, or nullptr if NULL.
Parameters
index- see Compositional;
Requires
(index < field_count())

◆ data() [2/2]

virtual const Data* data ( const std::string &  name,
std::size_t  offset = 0 
) const
pure virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
name- see Compositional;
offset- see Compositional.
Requires
has_field(name, offset)

◆ insert_field() [1/4]

virtual void insert_field ( std::size_t  index,
const std::string &  name,
std::unique_ptr< Data > &&  data = {} 
)
pure virtual

Inserts new field to a composite.

Parameters
index- the index of the field before which the new field will be inserted;
name- the name of the new field;
data- the data to set to the new field.
Exception safety guarantee
Strong.
Requires
(index < field_count())

◆ insert_field() [2/4]

void insert_field ( std::size_t  index,
const std::string &  name,
T &&  value 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ insert_field() [3/4]

virtual void insert_field ( const std::string &  name,
const std::string &  new_field_name,
std::unique_ptr< Data > &&  data 
)
pure virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
name- the name of the field before which the new field will be inserted;
new_field_name- the name of the new field;
data- the data to set to the new field.
Requires
(has_field(name, 0))

◆ insert_field() [4/4]

void insert_field ( const std::string &  name,
const std::string &  new_field_name,
T &&  value 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ make() [1/2]

static DMITIGR_PGFE_API std::unique_ptr<Composite> APIENTRY make ( )
static
Returns
The new instance of the composite.

◆ make() [2/2]

static DMITIGR_PGFE_API std::unique_ptr<Composite> APIENTRY make ( std::vector< std::pair< std::string, std::unique_ptr< Data >>> &&  v)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ move_to_vector()

virtual std::vector<std::pair<std::string, std::unique_ptr<Data> > > move_to_vector ( )
pure virtual
Returns
The result of conversion of this instance to the instance of type std::vector.
Effects
(has_fields() == false)

◆ release_data() [1/2]

virtual std::unique_ptr<Data> release_data ( std::size_t  index)
pure virtual

Release the object of type Data from the composite.

Parameters
index- see Compositional.
Returns
The released object of type Data.
Effects
(data(index) == nullptr).
Exception safety guarantee
Strong.
Requires
(index < field_count())

◆ release_data() [2/2]

virtual std::unique_ptr<Data> release_data ( const std::string &  name,
std::size_t  offset = 0 
)
pure virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
name- see Compositional;
offset- see Compositional.
Requires
has_field(name, offset)

◆ remove_field() [1/2]

virtual void remove_field ( std::size_t  index)
pure virtual

Removes field from a composite.

Requires
(index < field_count())
Exception safety guarantee
Strong.

◆ remove_field() [2/2]

virtual void remove_field ( const std::string &  name,
std::size_t  offset = 0 
)
pure virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
name- see Compositional;
offset- see Compositional.
Requires
has_field(name, offset)

◆ set_data() [1/6]

virtual void set_data ( std::size_t  index,
std::unique_ptr< Data > &&  data 
)
pure virtual

Sets the object of type Data to the field of the composite.

Parameters
index- see Compositional;
data- the data to set.
Exception safety guarantee
Strong.
Requires
(index < field_count())

◆ set_data() [2/6]

virtual void set_data ( std::size_t  index,
std::nullptr_t  data 
)
pure virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ set_data() [3/6]

std::enable_if_t<!std::is_same_v<Data*, T> > set_data ( std::size_t  index,
T &&  value 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Sets the data of the specified index with the value of type T, implicitly converted to the Data by using to_data().

◆ set_data() [4/6]

virtual void set_data ( const std::string &  name,
std::unique_ptr< Data > &&  data 
)
pure virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
name- see Compositional;
data- the data to set.
Requires
(has_field(name, 0))

◆ set_data() [5/6]

virtual void set_data ( const std::string &  name,
std::nullptr_t  data 
)
pure virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ set_data() [6/6]

std::enable_if_t<!std::is_same_v<Data*, T> > set_data ( const std::string &  name,
T &&  value 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ to_vector()

virtual std::vector<std::pair<std::string, std::unique_ptr<Data> > > to_vector ( ) const
pure virtual
Returns
The result of conversion of this instance to the instance of type std::vector.

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