LibreOffice Module vcl (master)  1
list.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 /*[]---------------------------------------------------[]*/
21 /*| |*/
22 /*| Implementation of the list data type |*/
23 /*| |*/
24 /*| |*/
25 /*| Author: Alexander Gelfenbain |*/
26 /*[]---------------------------------------------------[]*/
27 
28 #ifndef INCLUDED_VCL_INC_LIST_H
29 #define INCLUDED_VCL_INC_LIST_H
30 
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35 
36 /*
37  * List of void * pointers
38  */
39 
40  typedef struct list_ *list;
41  typedef void (*list_destructor)(void *);
42 
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() */
50 
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
60 
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);
67 
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 */
77 
78 #ifdef TEST
79 /*- forall */
80  void listForAll(list, void (*f)(void *));
81 #endif
82 
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif // INCLUDED_VCL_INC_LIST_H
88 
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
list listNewEmpty(void)
Definition: list.cxx:85
struct list_ * list
Definition: list.h:40
int listToLast(list)
Definition: list.cxx:162
void * listCurrent(list)
Definition: list.cxx:111
Definition: list.cxx:42
list listAppend(list, void *)
Definition: list.cxx:173
list listRemove(list)
Definition: list.cxx:181
int listNext(list)
Definition: list.cxx:130
void(* list_destructor)(void *)
Definition: list.h:41
int listCount(list)
Definition: list.cxx:118
int listIsEmpty(list)
Definition: list.cxx:124
void listDispose(list)
Definition: list.cxx:97
int listToFirst(list)
Definition: list.cxx:151
void listSetElementDtor(list, list_destructor)
Definition: list.cxx:104
list listClear(list)
Definition: list.cxx:208
int listSkipForward(list, int n)
Definition: list.cxx:135
void(* f)(TrueTypeTable *)
Definition: ttcr.cxx:466
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo