Deduplication of loading logic for catalog data.
This commit is contained in:
parent
ea035f58c8
commit
cd4e99cd11
6 changed files with 33 additions and 28 deletions
|
|
@ -1,15 +1,25 @@
|
|||
#ifndef PGCONTAINER_H
|
||||
#define PGCONTAINER_H
|
||||
|
||||
#include "Pgsql_declare.h"
|
||||
#include <QString>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <libpq-fe.h>
|
||||
|
||||
|
||||
class PgDatabaseCatalogue;
|
||||
|
||||
class IPgContainter {
|
||||
public:
|
||||
virtual ~IPgContainter() = default;
|
||||
|
||||
virtual std::string getLoadQuery() const = 0;
|
||||
virtual void load(const Pgsql::Result &res) = 0;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class PgContainer {
|
||||
class PgContainer: public IPgContainter {
|
||||
public:
|
||||
using t_Container = std::vector<T>; ///< Do not assume it will stay a vector only expect bidirectional access
|
||||
|
||||
|
|
@ -17,6 +27,7 @@ public:
|
|||
: m_catalogue(cat)
|
||||
{}
|
||||
|
||||
|
||||
typename t_Container::const_iterator begin() const
|
||||
{
|
||||
return m_container.begin();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue