Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50923 - sandbox-branches/guigl-openGL-wrappers/boost/guigl
From: andreytorba_at_[hidden]
Date: 2009-01-31 06:15:21


Author: andreo
Date: 2009-01-31 06:15:20 EST (Sat, 31 Jan 2009)
New Revision: 50923
URL: http://svn.boost.org/trac/boost/changeset/50923

Log:
templatize creators
Text files modified:
   sandbox-branches/guigl-openGL-wrappers/boost/guigl/draw.hpp | 67 ++++-----------------------------------
   1 files changed, 8 insertions(+), 59 deletions(-)

Modified: sandbox-branches/guigl-openGL-wrappers/boost/guigl/draw.hpp
==============================================================================
--- sandbox-branches/guigl-openGL-wrappers/boost/guigl/draw.hpp (original)
+++ sandbox-branches/guigl-openGL-wrappers/boost/guigl/draw.hpp 2009-01-31 06:15:20 EST (Sat, 31 Jan 2009)
@@ -52,36 +52,29 @@
     }
   };
 
- class point_creator;
- class line_loop_creator;
- class polygon_creator;
-
+ template<GLenum type>
   class vertex_creator : boost::noncopyable
   {
   private:
     begin m_scoped_begin;
 
- vertex_creator(GLenum type)
+ public:
+ vertex_creator()
       : m_scoped_begin(type)
     {}
 
- vertex_creator(GLenum type, double x, double y)
+ vertex_creator(double x, double y)
       : m_scoped_begin(type)
     {
       vertex(x, y);
     }
 
- vertex_creator(GLenum type, const position_type& position)
+ vertex_creator(const position_type& position)
       : m_scoped_begin(type)
     {
       vertex(position);
     }
 
- friend point_creator;
- friend line_loop_creator;
- friend polygon_creator;
-
- public:
     inline vertex_creator const& operator()(const position_type &position) const
     {
       vertex(position);
@@ -95,22 +88,7 @@
     }
   };
 
- class point_creator : public vertex_creator
- {
- public:
- point_creator()
- : vertex_creator(GL_POINTS)
- {}
-
- point_creator(double x, double y)
- : vertex_creator(GL_POINTS, x, y)
- {}
-
- point_creator(const position_type& position)
- : vertex_creator(GL_POINTS, position)
- {}
-
- };
+ typedef vertex_creator<GL_POINTS> point_creator;
 
   inline void point(double x, double y)
   {
@@ -177,22 +155,7 @@
   // std::for_each(begin_it, end_it, &vertex);
   // }
 
- class line_loop_creator : public vertex_creator
- {
- public:
- line_loop_creator()
- : vertex_creator(GL_LINE_LOOP)
- {}
-
- line_loop_creator(double x, double y)
- : vertex_creator(GL_LINE_LOOP, x, y)
- {}
-
- line_loop_creator(const position_type& position)
- : vertex_creator(GL_LINE_LOOP, position)
- {}
- };
-
+ typedef vertex_creator<GL_LINE_LOOP> line_loop_creator;
   //template<class ForwardIterator>
   //inline void line_loop(
   // const color_type& cl,
@@ -213,21 +176,7 @@
     return line_loop(position.x, position.y);
   }
 
- class polygon_creator : public vertex_creator
- {
- public:
- polygon_creator()
- : vertex_creator(GL_POLYGON)
- {}
-
- polygon_creator(double x, double y)
- : vertex_creator(GL_POLYGON, x, y)
- {}
-
- polygon_creator(const position_type& position)
- : vertex_creator(GL_POLYGON, position)
- {}
- };
+ typedef vertex_creator<GL_POLYGON> polygon_creator;
 
   inline polygon_creator polygon(double x, double y)
   {


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