Blender  V2.93
BaseIterator.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
24 #include <iterator>
25 
26 #ifdef WITH_CXX_GUARDEDALLOC
27 # include "MEM_guardedalloc.h"
28 #endif
29 
30 namespace Freestyle {
31 
32 // use for iterators definitions
33 template<class Element> class Nonconst_traits;
34 
35 template<class Element> class Const_traits {
36  public:
37  typedef Element value_type;
38  typedef const Element &reference;
39  typedef const Element *pointer;
40  typedef ptrdiff_t difference_type;
42 
43 #ifdef WITH_CXX_GUARDEDALLOC
44  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Const_traits")
45 #endif
46 };
47 
48 template<class Element> class Nonconst_traits {
49  public:
50  typedef Element value_type;
51  typedef Element &reference;
52  typedef Element *pointer;
53  typedef ptrdiff_t difference_type;
55 
56 #ifdef WITH_CXX_GUARDEDALLOC
57  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Nonconst_traits")
58 #endif
59 };
60 
62  public:
63  typedef std::input_iterator_tag iterator_category;
64 
65 #ifdef WITH_CXX_GUARDEDALLOC
66  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:InputIteratorTag_Traits")
67 #endif
68 };
69 
71  public:
72  typedef std::bidirectional_iterator_tag iterator_category;
73 
74 #ifdef WITH_CXX_GUARDEDALLOC
75  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BidirectionalIteratorTag_Traits")
76 #endif
77 };
78 
79 template<class Traits, class IteratorTagTraits> class IteratorBase {
80  public:
81  virtual ~IteratorBase()
82  {
83  }
84 
85  virtual bool begin() const = 0;
86  virtual bool end() const = 0;
87 
88  typedef typename IteratorTagTraits::iterator_category iterator_category;
89  typedef typename Traits::value_type value_type;
90  typedef typename Traits::difference_type difference_type;
91  typedef typename Traits::pointer pointer;
92  typedef typename Traits::reference reference;
93 
94  protected:
96  {
97  }
98 
99 #ifdef WITH_CXX_GUARDEDALLOC
100  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:IteratorBase")
101 #endif
102 };
103 
104 } /* namespace Freestyle */
Read Guarded memory(de)allocation.
std::bidirectional_iterator_tag iterator_category
Definition: BaseIterator.h:72
const Element & reference
Definition: BaseIterator.h:38
Nonconst_traits< Element > Non_const_traits
Definition: BaseIterator.h:41
const Element * pointer
Definition: BaseIterator.h:39
std::input_iterator_tag iterator_category
Definition: BaseIterator.h:63
Traits::difference_type difference_type
Definition: BaseIterator.h:90
Traits::reference reference
Definition: BaseIterator.h:92
virtual bool begin() const =0
IteratorTagTraits::iterator_category iterator_category
Definition: BaseIterator.h:88
Traits::value_type value_type
Definition: BaseIterator.h:89
Traits::pointer pointer
Definition: BaseIterator.h:91
virtual bool end() const =0
Nonconst_traits< Element > Non_const_traits
Definition: BaseIterator.h:54
inherits from class Rep
Definition: AppCanvas.cpp:32