Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/util/doxygen/addon/doxmlparser/src/baseiterator.h

Source at commit 1322 created 9 years 5 months ago.
By meklort, Add doxygen to utils folder
1/******************************************************************************
2 *
3 * $Id: doxygen.cpp,v 1.87 2001/03/19 19:27:40 root Exp $
4 *
5 *
6 * Copyright (C) 1997-2006 by Dimitri van Heesch.
7 *
8 * Permission to use, copy, modify, and distribute this software and its
9 * documentation under the terms of the GNU General Public License is hereby
10 * granted. No representations are made about the suitability of this software
11 * for any purpose. It is provided "as is" without express or implied warranty.
12 * See the GNU General Public License for more details.
13 *
14 */
15#ifndef BASEITERATOR_H
16#define BASEITERATOR_H
17
18#include <qlist.h>
19#include <doxmlintf.h>
20
21template<class Intf,class ElemIntf,class ElemImpl> class BaseIterator :
22 public Intf, public QListIterator<ElemImpl>
23{
24 public:
25 BaseIterator(const QList<ElemImpl> &list) : QListIterator<ElemImpl>(list) {}
26 virtual ~BaseIterator() {}
27 virtual ElemIntf *toFirst() { return QListIterator<ElemImpl>::toFirst(); }
28 virtual ElemIntf *toLast() { return QListIterator<ElemImpl>::toLast(); }
29 virtual ElemIntf *toNext() { return QListIterator<ElemImpl>::operator++(); }
30 virtual ElemIntf *toPrev() { return QListIterator<ElemImpl>::operator--(); }
31 virtual ElemIntf *current() const { return QListIterator<ElemImpl>::current(); }
32 virtual void release() { delete this; }
33};
34
35template<class Intf,class ElemIntf,class ElemImpl,class Intermediate>
36 class BaseIteratorVia :
37 public Intf, public QListIterator<ElemImpl>
38{
39 public:
40 BaseIteratorVia(const QList<ElemImpl> &list) : QListIterator<ElemImpl>(list) {}
41 virtual ~BaseIteratorVia() {}
42 virtual ElemIntf *toFirst() { return static_cast<Intermediate *>(QListIterator<ElemImpl>::toFirst()); }
43 virtual ElemIntf *toLast() { return static_cast<Intermediate *>(QListIterator<ElemImpl>::toLast()); }
44 virtual ElemIntf *toNext() { return static_cast<Intermediate *>(QListIterator<ElemImpl>::operator++()); }
45 virtual ElemIntf *toPrev() { return static_cast<Intermediate *>(QListIterator<ElemImpl>::operator--()); }
46 virtual ElemIntf *current() const { return static_cast<Intermediate *>(QListIterator<ElemImpl>::current()); }
47 virtual void release() { delete this; }
48};
49
50#endif
51

Archive Download this file

Revision: 1322