2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
24 /*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
25 /*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
26 /*%% (c) Copyright 1993, 1994 Novell, Inc. */
27 /*%% $XConsortium: tt_object_list.h /main/3 1995/10/23 10:42:45 rswiston $ */
32 * Copyright (c) 1990 by Sun Microsystems, Inc.
34 #ifndef _TT_OBJECT_LIST_H
35 #define _TT_OBJECT_LIST_H
38 #include <util/tt_ptr.h>
39 #include <util/tt_object.h>
40 #if defined(OPT_BUG_HPUX) || defined(OPT_BUG_AIX)
44 class _Tt_object_list_element;
45 class _Tt_object_list_ptr;
46 class _Tt_object_list: public _Tt_object {
47 friend class _Tt_object_list_cursor;
50 _Tt_object_list(const _Tt_object_list &t);
51 virtual ~_Tt_object_list();
53 _Tt_object_list &push(const _Tt_object_ptr &e);
54 _Tt_object_list &pop();
55 _Tt_object_list &append(const _Tt_object_ptr &e);
56 _Tt_object_list &append(_Tt_object_list_ptr l);
57 _Tt_object_list &append_destructive(_Tt_object_list_ptr l);
58 _Tt_object_list &dequeue();
59 _Tt_object_ptr &top() const;
60 _Tt_object_ptr &bot() const;
61 _Tt_object_ptr &operator[] (int n) const;
66 bool_t xdr(XDR * /* xdrs */) {
67 fprintf(stderr,"Warning: _Tt_object_list::xdr called");
70 bool_t xdr(XDR *xdrs, _Tt_new_xdrfn xdrfn, _Tt_object *(*make_new)());
71 void print(_Tt_object_printfn print_elt, const _Tt_ostream &os) const;
72 int verify(int (*verifier)(const _Tt_object *));
75 _Tt_object_list_element *first, *last;
77 declare_ptr_to(_Tt_object_list)
79 class _Tt_object_list_element : public _Tt_allocated {
80 friend class _Tt_object_list;
81 friend class _Tt_object_list_cursor;
83 _Tt_object_list_element();
84 ~_Tt_object_list_element();
86 _Tt_object_list_element *next, *prev;
89 class _Tt_object_list_cursor : public _Tt_allocated {
91 _Tt_object_list_cursor();
92 ~_Tt_object_list_cursor();
93 _Tt_object_list_cursor(const _Tt_object_list_cursor &c);
94 _Tt_object_list_cursor(const _Tt_object_list_ptr &l);
95 _Tt_object_ptr &operator *() const;
96 _Tt_object_ptr &operator->() const;
97 _Tt_object_list_cursor &reset();
98 _Tt_object_list_cursor &reset(const _Tt_object_list_ptr &l);
101 _Tt_object_list_cursor &insert(const _Tt_object_ptr &p);
102 _Tt_object_list_cursor &remove();
103 int is_valid() const;
105 _Tt_object_list_element *current;
106 _Tt_object_list_ptr listhdr;
107 enum { DELETED, INIT };
111 #endif /* _TT_OBJECT_LIST_H */