merge the formfield patch from ooo-build
[ooovba.git] / vcl / inc / list.h
blob62587328f159d9e988e2a9d5126c8b9e4bf973fb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 /*[]---------------------------------------------------[]*/
29 /*| |*/
30 /*| Implementation of the list data type |*/
31 /*| |*/
32 /*| |*/
33 /*| Author: Alexander Gelfenbain |*/
34 /*[]---------------------------------------------------[]*/
36 #ifndef __CLIST_H
37 #define __CLIST_H
39 #ifdef __cplusplus
40 extern "C"
42 #endif
45 * List of void * pointers
48 typedef struct _list *list;
49 typedef void (*list_destructor)(void *);
51 /*- constructors and a destructor */
52 list listNewEmpty(void);
53 #ifdef TEST
54 list listNewCopy(list);
55 #endif
56 void listDispose(list);
57 void listSetElementDtor(list, list_destructor); /*- this function will be executed when the element is removed via listRemove() or listClear() */
59 /*- queries */
60 void * listCurrent(list);
61 int listCount(list);
62 int listIsEmpty(list);
63 #ifdef TEST
64 int listAtFirst(list);
65 int listAtLast(list);
66 int listPosition(list); /* Expensive! */
67 #endif
68 /*- search */
69 int listFind(list, void *); /* Returns true/false */
71 /*- positioning functions */
72 /*- return the number of elements by which the current position in the list changes */
73 int listNext(list);
74 int listSkipForward(list, int n);
75 int listToFirst(list);
76 int listToLast(list);
77 int listPositionAt(list, int n); /* Expensive! */
79 /*- adding and removing elements */
80 list listAppend(list, void *);
81 #ifdef TEST
82 list listPrepend(list, void *);
83 list listInsertAfter(list, void *);
84 list listInsertBefore(list, void *);
85 #endif
86 list listRemove(list); /* removes the current element */
87 list listClear(list); /* removes all elements */
89 #ifdef TEST
90 /*- forall */
91 void listForAll(list, void (*f)(void *));
92 #endif
94 #ifdef __cplusplus
96 #endif
99 #endif /* __CLIST_H */