• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • graphics API Reference
  • KDE Home
  • Contact Us
 

digikam

  • extragear
  • graphics
  • digikam
  • core
  • dplugins
  • generic
  • tools
  • mediaserver
  • upnpsdk
  • Platinum
  • Source
  • Extras
  • Managed
EnumerableNptList.h
Go to the documentation of this file.
1 /*****************************************************************
2 |
3 | Platinum - Managed EnumerableNptList
4 |
5 | Copyright (c) 2004-2010, Plutinosoft, LLC.
6 | All rights reserved.
7 | http://www.plutinosoft.com
8 |
9 | This program is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU General Public License
11 | as published by the Free Software Foundation; either version 2
12 | of the License, or (at your option) any later version.
13 |
14 | OEMs, ISVs, VARs and other distributors that combine and
15 | distribute commercially licensed software with Platinum software
16 | and do not wish to distribute the source code for the commercially
17 | licensed software under version 2, or (at your option) any later
18 | version, of the GNU General Public License (the "GPL") must enter
19 | into a commercial license agreement with Plutinosoft, LLC.
20 |
21 | This program is distributed in the hope that it will be useful,
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | GNU General Public License for more details.
25 |
26 | You should have received a copy of the GNU General Public License
27 | along with this program; see the file LICENSE.txt. If not, write to
28 | the Free Software Foundation, Inc.,
29 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30 | http://www.gnu.org/licenses/gpl-2.0.html
31 |
32 ****************************************************************/
33 #pragma once
34 
35 namespace Platinum
36 {
37 
38 namespace Enumerables
39 {
40 
41 /*----------------------------------------------------------------------
42 | EnumerableNptList
43 +---------------------------------------------------------------------*/
44 template<typename T_DotNetType, typename T_NativeType>
45 private ref class EnumerableNptList : public IEnumerable<T_DotNetType>
46 {
47 private:
48 
49  ref class EnumerableNptListIterator : public IEnumerator<T_DotNetType>
50  {
51  private:
52 
53  const NPT_List<T_NativeType>* m_pList;
54  typename NPT_List<T_NativeType>::Iterator* m_pIt;
55 
56  public:
57 
58  virtual property T_DotNetType Current
59  {
60  T_DotNetType get()
61  {
62  return marshal_as<T_DotNetType>(***m_pIt); // FIXME: This is a problem when T_NativeType is not a pointer (like PLT_DeviceDataReference for example)
63  }
64  }
65 
66  private:
67 
68  virtual property Object^ Current2
69  {
70  Object^ get() sealed = System::Collections::IEnumerator::Current::get
71  {
72  return marshal_as<T_DotNetType>(***m_pIt); // FIXME: This is a problem when T_NativeType is not a pointer (like PLT_DeviceDataReference for example)
73  }
74  }
75 
76  public:
77 
78  virtual bool MoveNext()
79  {
80  if (!m_pIt)
81  {
82  m_pIt = &m_pList->GetFirstItem();
83  }
84  else
85  {
86  (*m_pIt)++;
87  }
88 
89  return *m_pIt;
90  }
91 
92  virtual void Reset()
93  {
94  m_pIt = 0;
95  }
96 
97  public:
98 
99  EnumerableNptListIterator(const NPT_List<T_NativeType>& list)
100  {
101  m_pIt = 0;
102  m_pList = &list;
103  }
104 
105  ~EnumerableNptListIterator()
106  {
107  }
108 
109  };
110 
111 private:
112 
113  const NPT_List<T_NativeType>* m_pList;
114 
115 public:
116 
117  virtual IEnumerator<T_DotNetType>^ GetEnumerator()
118  {
119  return gcnew EnumerableNptListIterator(*m_pList);
120  }
121 
122 private:
123 
124  virtual System::Collections::IEnumerator^ GetEnumerator2() sealed = System::Collections::IEnumerable::GetEnumerator
125  {
126  return gcnew EnumerableNptListIterator(*m_pList);
127  }
128 
129 public:
130 
131  EnumerableNptList(const NPT_List<T_NativeType>& list)
132  {
133  m_pList = &list;
134  }
135 };
136 
137 /*----------------------------------------------------------------------
138 | EnumerableNptListRef
139 +---------------------------------------------------------------------*/
140 template<typename T_DotNetType, typename T_NativeType>
141 private ref class EnumerableNptListRef : public IEnumerable<T_DotNetType>
142 {
143 private:
144 
145  ref class EnumerableNptListRefIterator : public IEnumerator<T_DotNetType>
146  {
147  private:
148 
149  const NPT_List<T_NativeType>* m_pList;
150  typename NPT_List<T_NativeType>::Iterator* m_pIt;
151 
152  public:
153 
154  virtual property T_DotNetType Current
155  {
156  T_DotNetType get()
157  {
158  return marshal_as<T_DotNetType>(**m_pIt);
159  }
160  }
161 
162  private:
163 
164  virtual property Object^ Current2
165  {
166  Object^ get() sealed = System::Collections::IEnumerator::Current::get
167  {
168  return marshal_as<T_DotNetType>(**m_pIt);
169  }
170  }
171 
172  public:
173 
174  virtual bool MoveNext()
175  {
176  if (!m_pIt)
177  {
178  m_pIt = &m_pList->GetFirstItem();
179  }
180  else
181  {
182  (*m_pIt)++;
183  }
184 
185  return *m_pIt;
186  }
187 
188  virtual void Reset()
189  {
190  m_pIt = 0;
191  }
192 
193  public:
194 
195  EnumerableNptListRefIterator(const NPT_List<T_NativeType>& list)
196  {
197  m_pIt = 0;
198  m_pList = &list;
199  }
200 
201  ~EnumerableNptListRefIterator()
202  {
203  }
204 
205  };
206 
207 private:
208 
209  const NPT_List<T_NativeType>* m_pList;
210 
211 public:
212 
213  virtual IEnumerator<T_DotNetType>^ GetEnumerator()
214  {
215  return gcnew EnumerableNptListRefIterator(*m_pList);
216  }
217 
218 private:
219 
220  virtual System::Collections::IEnumerator^ GetEnumerator2() sealed = System::Collections::IEnumerable::GetEnumerator
221  {
222  return gcnew EnumerableNptListRefIterator(*m_pList);
223  }
224 
225 public:
226 
227  EnumerableNptListRef(const NPT_List<T_NativeType>& list)
228  {
229  m_pList = &list;
230  }
231 };
232 
233 }
234 }
Platinum::Enumerables::EnumerableNptListRef::GetEnumerator
virtual IEnumerator< T_DotNetType > GetEnumerator()
Definition: EnumerableNptList.h:213
Platinum::Enumerables::EnumerableNptList
Definition: EnumerableNptList.h:45
IEnumerable
Platinum::Enumerables::EnumerableNptList::GetEnumerator
virtual IEnumerator< T_DotNetType > GetEnumerator()
Definition: EnumerableNptList.h:117
IEnumerator
NPT_List::GetFirstItem
Iterator GetFirstItem() const
Definition: NptList.h:125
Platinum::Enumerables::EnumerableNptListRef
Definition: EnumerableNptList.h:141
NPT_List< T_NativeType >
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Sun Dec 8 2019 04:08:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

digikam

Skip menu "digikam"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages
-->

graphics API Reference

Skip menu "graphics API Reference"
  • digikam
  • KDiagram
  •     KChart
  •     KGantt
  • KPhotoAlbum
  •   AndroidRemoteControl
  • Krita
  •   libs
  •     KritaBasicFlakes
  •     brush
  •     KritaUndo2
  •     KritaFlake
  •     image
  •     KritaPlugin
  •     Krita
  •     KritaOdf
  •     KritaPigment
  •     KritaStore
  •     ui
  •     KritaWidgets
  •     KritaWidgetUtils
  •   plugins
  •     Assitants
  •     Extensions
  •     Filters
  •         KritaText
  •         KritaTextLayout
  •     Generators
  •     Formats
  •             src
  •     PaintOps
  •       libpaintop
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal