1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 /*[]---------------------------------------------------[]*/
22 /*| Implementation of the list data type |*/
25 /*| Author: Alexander Gelfenbain |*/
26 /*[]---------------------------------------------------[]*/
28 #ifndef INCLUDED_VCL_INC_LIST_H
29 #define INCLUDED_VCL_INC_LIST_H
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);
46 list
listNewCopy(list
);
48 void listDispose(list
);
49 void listSetElementDtor(list
, list_destructor
); /*- this function will be executed when the element is removed via listRemove() or listClear() */
52 void * listCurrent(list
);
54 int listIsEmpty(list
);
56 int listAtFirst(list
);
58 int listPosition(list
); /* Expensive! */
61 /*- positioning functions */
62 /*- return the number of elements by which the current position in the list changes */
64 int listSkipForward(list
, int n
);
65 int listToFirst(list
);
68 /*- adding and removing elements */
69 list
listAppend(list
, void *);
71 list
listPrepend(list
, void *);
72 list
listInsertAfter(list
, void *);
73 list
listInsertBefore(list
, void *);
75 list
listRemove(list
); /* removes the current element */
76 list
listClear(list
); /* removes all elements */
80 void listForAll(list
, void (*f
)(void *));
87 #endif // INCLUDED_VCL_INC_LIST_H
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */