plibsys  0.0.4
plist.h
Go to the documentation of this file.
1 /*
2  * The MIT License
3  *
4  * Copyright (C) 2010-2016 Alexander Saprykin <saprykin.spb@gmail.com>
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files (the
8  * 'Software'), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sublicense, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be
15  * included in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25 
80 #if !defined (PLIBSYS_H_INSIDE) && !defined (PLIBSYS_COMPILATION)
81 # error "Header files shouldn't be included directly, consider using <plibsys.h> instead."
82 #endif
83 
84 #ifndef PLIBSYS_HEADER_PLIST_H
85 #define PLIBSYS_HEADER_PLIST_H
86 
87 #include <pmacros.h>
88 #include <ptypes.h>
89 
91 
93 typedef struct PList_ PList;
94 
96 struct PList_ {
99 };
100 
113 
127 
143 P_LIB_API void p_list_foreach (PList *list,
144  PFunc func,
145  ppointer user_data);
146 
156 P_LIB_API void p_list_free (PList *list);
157 
164 P_LIB_API PList * p_list_last (PList *list);
165 
174 P_LIB_API psize p_list_length (const PList *list);
175 
188 
196 
198 
199 #endif /* PLIBSYS_HEADER_PLIST_H */
P_LIB_API void p_list_foreach(PList *list, PFunc func, ppointer user_data)
Calls a specified function for each list node.
#define P_END_DECLS
Closes .h file declarations to be exported as C functions, should be always used after P_BEGIN_DECLS...
Definition: pmacros.h:299
ppointer data
Pointer to the node data.
Definition: plist.h:97
#define P_GNUC_WARN_UNUSED_RESULT
Gives a warning if the result returned from a function is not being used.
Definition: pmacros.h:72
P_LIB_API PList * p_list_remove(PList *list, ppointer data) P_GNUC_WARN_UNUSED_RESULT
Removes data from a list.
P_LIB_API psize p_list_length(const PList *list)
Gets the number of list nodes.
unsigned __int64 psize
Type for a platform independent size_t.
Definition: ptypes.h:194
Miscellaneous macros.
Node for a singly linked list.
Definition: plist.h:96
void * ppointer
Type for a pointer.
Definition: ptypes.h:109
P_LIB_API PList * p_list_last(PList *list)
Gets the last node from the list.
PList * next
Next list node.
Definition: plist.h:98
P_LIB_API PList * p_list_append(PList *list, ppointer data) P_GNUC_WARN_UNUSED_RESULT
Appends data to a list.
#define P_LIB_API
Exports a symbol from a shared library.
Definition: pmacros.h:138
P_LIB_API PList * p_list_reverse(PList *list) P_GNUC_WARN_UNUSED_RESULT
Reverses the list order.
Types definitions.
P_LIB_API PList * p_list_prepend(PList *list, ppointer data) P_GNUC_WARN_UNUSED_RESULT
Prepends data to a list.
void(* PFunc)(ppointer data, ppointer user_data)
General purpose function.
Definition: ptypes.h:1090
P_LIB_API void p_list_free(PList *list)
Frees list memory.
#define P_BEGIN_DECLS
Starts .h file declarations to be exported as C functions.
Definition: pmacros.h:298