Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78476 - in sandbox/icl/libs/xplore/br1/sqlbrowser: . data/concept data/qsql
From: afojgo_at_[hidden]
Date: 2012-05-15 02:49:20


Author: jofaber
Date: 2012-05-15 02:49:18 EDT (Tue, 15 May 2012)
New Revision: 78476
URL: http://svn.boost.org/trac/boost/changeset/78476

Log:
Layer continued for data access.
Text files modified:
   sandbox/icl/libs/xplore/br1/sqlbrowser/Dag.h | 3 +++
   sandbox/icl/libs/xplore/br1/sqlbrowser/data/concept/IsQuerySelector.h | 8 ++++----
   sandbox/icl/libs/xplore/br1/sqlbrowser/data/concept/Selector.h | 5 ++---
   sandbox/icl/libs/xplore/br1/sqlbrowser/data/concept/SelectorTraits.h | 6 +++---
   sandbox/icl/libs/xplore/br1/sqlbrowser/data/qsql/QSqlCreator.h | 6 ++++--
   sandbox/icl/libs/xplore/br1/sqlbrowser/data/qsql/QSqlSelector.h | 19 ++++++++++---------
   6 files changed, 26 insertions(+), 21 deletions(-)

Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/Dag.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/Dag.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/Dag.h 2012-05-15 02:49:18 EDT (Tue, 15 May 2012)
@@ -18,7 +18,10 @@
 #include "Dag/DecoratedGraph.h" //CL
 #include "Dag/TypeGraph.h" //CL
 #include "data/concept/CreatorTraits.h" //CL
+#include "data/concept/SelectorTraits.h" //CL
 #include "data/concept/IsQuerySelector.h" //CL
+#include "data/qsql/QSqlSelector.h" //CL
+#include "data/qsql/QSqlCreator.h" //CL
 
 
 inline QString indentation(int depth)

Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/data/concept/IsQuerySelector.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/data/concept/IsQuerySelector.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/data/concept/IsQuerySelector.h 2012-05-15 02:49:18 EDT (Tue, 15 May 2012)
@@ -10,17 +10,17 @@
 namespace data
 {
 
-template<class Accessor> struct isQuerySelector;
-
 template<class Accessor>
-struct isQuerySelector
+struct IsQuerySelector
 {
+ typedef IsQuerySelector<Accessor> type;
     static const bool value = false;
 };
 
 template<>
-struct isQuerySelector<QSqlSelector>
+struct IsQuerySelector<QSqlSelector>
 {
+ typedef IsQuerySelector<QSqlSelector> type;
     static const bool value = true;
 };
 

Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/data/concept/Selector.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/data/concept/Selector.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/data/concept/Selector.h 2012-05-15 02:49:18 EDT (Tue, 15 May 2012)
@@ -7,20 +7,19 @@
 
 //std
 //boost
+#include <boost/mpl/bool.hpp>
 #include <boost/utility/enable_if.hpp>
 //qt
 //local
 #include "Dag/TypeGraph.h"
 
 #include "data/concept/IsQuerySelector.h"
-//CL #include "data/qsql/QSqlSelector.h"
 
 namespace data
 {
-
 // If it is an SqlAccessor, make the type-graph like so:
 template<class Accessor>
-typename boost::enable_if< isQuerySelector<Accessor>, void>::type
+typename boost::enable_if< IsQuerySelector<Accessor>, void>::type
 makeTypeGraph(Accessor& accessor, TypeGraph& typeGraph)
 {
     typedef typename Accessor::iterator iterator;

Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/data/concept/SelectorTraits.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/data/concept/SelectorTraits.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/data/concept/SelectorTraits.h 2012-05-15 02:49:18 EDT (Tue, 15 May 2012)
@@ -20,10 +20,10 @@
 struct SelectorTraits
 {
     typedef typename Accessor::size_type size_type;
- typedef typename Accessor::iterator iterator;
+ typedef typename Accessor::iterator const_iterator;
 
- static iterator begin(const Accessor& accessor);
- static iterator end(const Accessor& accessor);
+ static const_iterator begin(const Accessor& accessor);
+ static const_iterator end(const Accessor& accessor);
     static size_type select(const Query&);
 };
 

Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/data/qsql/QSqlCreator.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/data/qsql/QSqlCreator.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/data/qsql/QSqlCreator.h 2012-05-15 02:49:18 EDT (Tue, 15 May 2012)
@@ -12,6 +12,8 @@
 
 typedef dag::db::tString tString;
 
+template<class Object>class QSqlCreator;
+
 //==============================================================================
 //= Concept: data::Creator Spec: QSqlCreator
 //==============================================================================
@@ -19,7 +21,7 @@
 struct CreatorTraits<Object, QSqlCreator<Object> >
 {
     typedef QSqlCreator<Object> tCreator;
- typedef typename tCreator::iterator iterator;
+ typedef typename tCreator::const_iterator const_iterator;
     typedef typename tCreator::tQuery tQuery;
 
     static tQuery createQuery();
@@ -38,7 +40,7 @@
             "SELECT ...";
     }
 
- tObject create(iterator it)
+ tObject create(const_iterator it)
     {
         return dag::db::EdgeType();
     }

Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/data/qsql/QSqlSelector.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/data/qsql/QSqlSelector.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/data/qsql/QSqlSelector.h 2012-05-15 02:49:18 EDT (Tue, 15 May 2012)
@@ -12,7 +12,7 @@
 #include <QSqlQuery.h>
 
 //concepts
-#include "data/concept/Selector.h"
+#include "data/concept/SelectorTraits.h"
 
 
 // Data access sql, xml, file etc. lives in namespace data
@@ -23,12 +23,13 @@
 {
 public:
     typedef QVector<QVariant> type;
- typedef typename tResultSet::iterator iterator;
+ typedef std::size_t size_type;
     typedef QVector<QVariant> tResultSet;
+ typedef tResultSet::const_iterator const_iterator;
     typedef QSqlQuery tQuery;
 
- iterator begin(){ return m_aResultSet.begin(); }
- iterator end() { return m_aResultSet.end(); }
+ const_iterator begin()const{ return m_aResultSet.begin(); }
+ const_iterator end() const{ return m_aResultSet.end(); }
     size_type select(const tQuery&);
 
 private:
@@ -37,16 +38,16 @@
 
 
 //==============================================================================
-//= Concept: DataSelector Spec: QSqlSelector
+//= Concept: data::Selector Specialisation: QSqlSelector
 //==============================================================================
 template<>
-struct SelectorTraits<QSqlSelector, class QSqlQuery>
+struct SelectorTraits<QSqlSelector, QSqlQuery>
 {
     typedef std::size_t size_type;
- typedef typename QSqlSelector::iterator iterator;
+ typedef QSqlSelector::const_iterator const_iterator;
 
- static iterator begin(const QSqlSelector& accessor){ return accessor.begin(); }
- static iterator end (const QSqlSelector& accessor){ return accessor.end(); };
+ static const_iterator begin(const QSqlSelector& accessor){ return accessor.begin(); }
+ static const_iterator end (const QSqlSelector& accessor){ return accessor.end(); };
     static size_type select(const QSqlQuery&);
 };
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk