libDtSearch: Remove optional code for NO_DBN which is not used on CDE
[oweals/cde.git] / cde / programs / nsgmls / List.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: List.h /main/2 1996/08/13 10:08:58 mgreess $ */
24 // Copyright (c) 1994 James Clark
25 // See the file COPYING for copying permission.
26
27 #ifndef List_INCLUDED
28 #define List_INCLUDED 1
29
30 #include "IList.h"
31 #include "Link.h"
32
33 #ifdef SP_NAMESPACE
34 namespace SP_NAMESPACE {
35 #endif
36
37 template<class T>
38 class ListItem : public Link {
39 public:
40   ListItem(const T &v) : value(v) { }
41   T value;
42 };
43
44 template<class T> class ListIter;
45
46 template<class T>
47 class List {
48 public:
49   List() { }
50   void append(const T &item) { list_.append(new ListItem<T>(item)); }
51   void insert(const T &item) { list_.insert(new ListItem<T>(item)); }
52   const T &head() const { return list_.head()->value; }
53   void remove(const T &);
54   T get();
55   int empty() { return list_.empty(); }
56   friend class ListIter<T>;
57 private:
58   List(const List<T> &) {}
59   void operator=(const List<T> &) {}
60
61   IList<ListItem<T> > list_;
62 };
63
64 #ifdef SP_NAMESPACE
65 }
66 #endif
67
68 #endif /* not List_INCLUDED */
69
70 #ifdef SP_DEFINE_TEMPLATES
71 #include "List.C"
72 #endif