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 
24 namespace pqxx
25 {
26 
27 class PQXX_LIBEXPORT PQXX_NOVTABLE stream_base :
29 {
30 public:
31  explicit stream_base(transaction_base &);
32  virtual ~stream_base() noexcept;
33  virtual void complete() = 0;
34  operator bool() const noexcept;
35  bool operator!() const noexcept;
36 protected:
37  bool m_finished;
38  virtual void close();
39  template<typename C> static std::string columnlist(const C &);
40  template<typename I> static std::string columnlist(I begin, I end);
41 private:
42  stream_base();
43  stream_base(const stream_base&);
44  stream_base & operator=(const stream_base &);
45 };
46 
47 template<typename C> std::string stream_base::columnlist(const C &c)
48 {
49  return columnlist(std::begin(c), std::end(c));
50 }
51 
52 template<typename I> std::string stream_base::columnlist(I begin, I end)
53 {
54  return separated_list(",", begin, end);
55 }
56 
57 } // namespace pqxx
58 
59 
60 #include "pqxx/compiler-internal-post.hxx"
61 #endif
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:136
bool m_finished
Definition: stream_base.hxx:37
Definition: transaction_base.hxx:43
Definition: stream_base.hxx:27
static std::string columnlist(const C &)
Definition: stream_base.hxx:47
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
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25