Updated core
[LibreOffice.git] / vcl / inc / list.h
blobb19591022700d335f931d9272d1a8920c7b23ee1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 /*[]---------------------------------------------------[]*/
21 /*| |*/
22 /*| Implementation of the list data type |*/
23 /*| |*/
24 /*| |*/
25 /*| Author: Alexander Gelfenbain |*/
26 /*[]---------------------------------------------------[]*/
28 #ifndef INCLUDED_VCL_INC_LIST_H
29 #define INCLUDED_VCL_INC_LIST_H
31 #ifdef __cplusplus
32 extern "C"
34 #endif
37 * List of void * pointers
40 typedef struct _list *list;
41 typedef void (*list_destructor)(void *);
43 /*- constructors and a destructor */
44 list listNewEmpty(void);
45 #ifdef TEST
46 list listNewCopy(list);
47 #endif
48 void listDispose(list);
49 void listSetElementDtor(list, list_destructor); /*- this function will be executed when the element is removed via listRemove() or listClear() */
51 /*- queries */
52 void * listCurrent(list);
53 int listCount(list);
54 int listIsEmpty(list);
55 #ifdef TEST
56 int listAtFirst(list);
57 int listAtLast(list);
58 int listPosition(list); /* Expensive! */
59 #endif
61 /*- positioning functions */
62 /*- return the number of elements by which the current position in the list changes */
63 int listNext(list);
64 int listSkipForward(list, int n);
65 int listToFirst(list);
66 int listToLast(list);
68 /*- adding and removing elements */
69 list listAppend(list, void *);
70 #ifdef TEST
71 list listPrepend(list, void *);
72 list listInsertAfter(list, void *);
73 list listInsertBefore(list, void *);
74 #endif
75 list listRemove(list); /* removes the current element */
76 list listClear(list); /* removes all elements */
78 #ifdef TEST
79 /*- forall */
80 void listForAll(list, void (*f)(void *));
81 #endif
83 #ifdef __cplusplus
85 #endif
88 #endif // INCLUDED_VCL_INC_LIST_H
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */