libpqxx
stream_base.hxx
1
13#ifndef PQXX_H_STREAM_BASE
14#define PQXX_H_STREAM_BASE
15
16#include "pqxx/compiler-public.hxx"
17#include "pqxx/compiler-internal-pre.hxx"
18#include "pqxx/transaction_base.hxx"
19#include "pqxx/util.hxx"
20
21#include <string>
22
23
24namespace pqxx
25{
26
27class PQXX_LIBEXPORT PQXX_NOVTABLE stream_base :
29{
30public:
31 explicit stream_base(transaction_base &);
32 // TODO: Can we get rid of the vtable?
33 virtual ~stream_base() noexcept =default;
34 virtual void complete() = 0;
35 operator bool() const noexcept;
36 bool operator!() const noexcept;
37protected:
38 bool m_finished;
39 virtual void close();
40 template<typename C> static std::string columnlist(const C &);
41 template<typename I> static std::string columnlist(I begin, I end);
42private:
45 stream_base & operator=(const stream_base &);
46};
47
48template<typename C> std::string stream_base::columnlist(const C &c)
49{
50 return columnlist(std::begin(c), std::end(c));
51}
52
53template<typename I> std::string stream_base::columnlist(I begin, I end)
54{
55 return separated_list(",", begin, end);
56}
57
58} // namespace pqxx
59
60
61#include "pqxx/compiler-internal-post.hxx"
62#endif
STL namespace.
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS access)
Represent sequence of values as a string, joined by a given separator.
Definition: util.hxx:95
Definition: stream_base.hxx:29
virtual ~stream_base() noexcept=default
static std::string columnlist(const C &)
Definition: stream_base.hxx:48
Definition: transaction_base.hxx:44
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138