Abstract IResult interface for Result
This is to allow faking the result for testing the CrudModel.
This commit is contained in:
parent
06504ecc1f
commit
c346430b25
6 changed files with 103 additions and 67 deletions
51
pgsql/Pgsql_ResultConstIterator.h
Normal file
51
pgsql/Pgsql_ResultConstIterator.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#pragma once
|
||||
|
||||
#include "Pgsql_Row.h"
|
||||
|
||||
namespace Pgsql {
|
||||
|
||||
class IResult;
|
||||
|
||||
class ResultConstIterator {
|
||||
public:
|
||||
ResultConstIterator(const IResult &r, int rw)
|
||||
: m_row(r, rw)
|
||||
{}
|
||||
|
||||
ResultConstIterator operator++()
|
||||
{
|
||||
ResultConstIterator t(*this);
|
||||
m_row.next();
|
||||
return t;
|
||||
}
|
||||
|
||||
ResultConstIterator& operator++(int)
|
||||
{
|
||||
m_row.next();
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const ResultConstIterator &rhs)
|
||||
{
|
||||
return m_row == rhs.m_row;
|
||||
}
|
||||
|
||||
bool operator!=(const ResultConstIterator &rhs)
|
||||
{
|
||||
return !operator==(rhs);
|
||||
}
|
||||
|
||||
const Row& operator*()
|
||||
{
|
||||
return m_row;
|
||||
}
|
||||
const Row& operator->()
|
||||
{
|
||||
return m_row;
|
||||
}
|
||||
|
||||
private:
|
||||
Row m_row;
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue