1 /* GNU Mailutils -- a suite of utilities for electronic mail 2 Copyright (C) 2004-2021 Free Software Foundation, Inc. 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 3 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General 15 Public License along with this library. If not, see 16 <http://www.gnu.org/licenses/>. */ 17 18 #ifndef _MUCPP_ITERATOR_H 19 #define _MUCPP_ITERATOR_H 20 21 #include <errno.h> 22 #include <mailutils/iterator.h> 23 #include <mailutils/cpp/error.h> 24 #include <mailutils/cpp/list.h> 25 26 namespace mailutils 27 { 28 29 class List; 30 31 class Iterator 32 { 33 protected: 34 mu_iterator_t mu_iter; 35 List* pList; 36 37 friend class List; 38 39 public: 40 Iterator (const List&); 41 Iterator (const mu_iterator_t); 42 ~Iterator (); 43 44 bool operator == (const Iterator&); 45 bool operator != (const Iterator&); 46 47 void dup (Iterator*&, const Iterator&); 48 void first (); 49 void next (); 50 Iterator& operator ++ (int); 51 void current (void** pitem); 52 void* current (); 53 bool is_done (); 54 List& get_list (); 55 56 inline void* operator * () { 57 return this->current (); 58 } 59 }; 60 61 } 62 63 #endif // not _MUCPP_ITERATOR_H 64 65