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 librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
25 * $XConsortium: obj_list.h /main/3 1995/11/06 18:36:04 rswiston $
27 * @(#)template.h 1.6 11 Feb 1994 cde_app_builder/src/libAButil
29 * RESTRICTED CONFIDENTIAL INFORMATION:
31 * The information in this document is subject to special
32 * restrictions in a confidential disclosure agreement between
33 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
34 * document outside HP, IBM, Sun, USL, SCO, or Univel without
35 * Sun's specific written approval. This document and all copies
36 * and derivative works thereof must be returned or destroyed at
39 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
43 #ifndef _ABOBJ_OBJ_LIST_H_
44 #define _ABOBJ_OBJ_LIST_H_
47 * obj_list.h - define ABObjList data type
50 #define _POSIX_SOURCE 1 /* we want to be POSIX-compliant */
53 #include <ab_private/AB.h> /* everybody must include this first! */
54 #include <ab/util_types.h>
56 extern struct _AB_OBJ;
57 #define ABObj struct _AB_OBJ *
61 OBJLIST_SORT_UNDEF = 0,
62 OBJLIST_SORT_ALPHANUMERIC,
64 OBJLIST_SORT_CLIENT_DEF,
65 OBJLIST_SORT_ORDER_NUM_VALUES /* must be last */
68 typedef void (*ABObjListIterFn)(ABObj obj);
80 OBJLIST_SORT_ORDER sort_order;
82 } ABObjListRec, *ABObjList;
85 #include <ab_private/obj.h>
88 * ABObjList - lifecycle methods
90 ABObjList objlist_create(void);
91 int objlist_destroy(ABObjList);
92 int objlist_construct(ABObjList);
93 int objlist_destruct(ABObjList);
94 ABObjList objlist_dup(ABObjList);
97 * ABObjList - methods dealing with entire list
99 int objlist_set_sort_order(ABObjList, OBJLIST_SORT_ORDER);
100 OBJLIST_SORT_ORDER objlist_get_sort_order(ABObjList);
101 int objlist_set_is_unique(ABObjList, BOOL unique);
102 BOOL objlist_is_unique(ABObjList);
103 int objlist_make_empty(ABObjList);
104 int objlist_is_empty(ABObjList);
105 int objlist_set_num_objs(ABObjList, int numABObjs);
106 int objlist_get_num_objs(ABObjList);
107 int objlist_set_max_size_soft(ABObjList, int maxNumObjs);
108 int objlist_get_max_size(ABObjList);
109 BOOL objlist_max_size_is_soft(ABObjList);
110 int objlist_shrink_mem_to_fit(ABObjList);
111 int objlist_iterate(ABObjList, ABObjListIterFn);
114 * Methods dealing with individual objects
116 int objlist_remove_obj(ABObjList, ABObj obj);
117 int objlist_remove_index(ABObjList, int index);
118 int objlist_add_obj(ABObjList, ABObj obj, void *userData);
119 int objlist_add_index(ABObjList,
120 int index, ABObj obj, void *userData);
121 BOOL objlist_obj_exists(ABObjList list, ABObj obj);
122 int objlist_get_obj_index(ABObjList list, ABObj obj);
123 ABObj objlist_get_obj(ABObjList, int whichObj, void **userDataOut);
124 void *objlist_get_obj_data(ABObjList, ABObj obj);
130 int objlist_dump(ABObjList list);
134 /*************************************************************************
135 **************************************************************************
137 ** Inline definitions **
139 **************************************************************************
140 *************************************************************************/
141 int objlist_destroy_impl(ABObjList *listInOut);
142 #define objlist_destroy(list) (objlist_destroy_impl(&(list)))
144 #endif /* _ABOBJ_OBJ_LIST_H_ */