RetroArch
file_list.h
Go to the documentation of this file.
1 /* Copyright (C) 2010-2018 The RetroArch team
2  *
3  * ---------------------------------------------------------------------------------------
4  * The following license statement only applies to this file (file_list.h).
5  * ---------------------------------------------------------------------------------------
6  *
7  * Permission is hereby granted, free of charge,
8  * to any person obtaining a copy of this software and associated documentation files (the "Software"),
9  * to deal in the Software without restriction, including without limitation the rights to
10  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11  * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef __LIBRETRO_SDK_FILE_LIST_H__
24 #define __LIBRETRO_SDK_FILE_LIST_H__
25 
26 #include <retro_common_api.h>
27 
29 
30 #include <stddef.h>
31 #include <stdlib.h>
32 
33 #include <boolean.h>
34 
35 struct item_file
36 {
37  char *path;
38  char *label;
39  char *alt;
40  unsigned type;
41  size_t directory_ptr;
42  size_t entry_idx;
43  void *userdata;
44  void *actiondata;
45 };
46 
47 typedef struct file_list
48 {
49  struct item_file *list;
50 
51  size_t capacity;
52  size_t size;
53 } file_list_t;
54 
55 
57  size_t index);
58 
60  size_t index);
61 
72 void file_list_free(file_list_t *list);
73 
84 bool file_list_reserve(file_list_t *list, size_t nitems);
85 
86 bool file_list_append(file_list_t *userdata, const char *path,
87  const char *label, unsigned type, size_t current_directory_ptr,
88  size_t entry_index);
89 
91  const char *path, const char *label,
92  unsigned type, size_t directory_ptr,
93  size_t entry_idx);
94 
95 void file_list_pop(file_list_t *list, size_t *directory_ptr);
96 
97 void file_list_clear(file_list_t *list);
98 
100 
101 void file_list_get_last(const file_list_t *list,
102  const char **path, const char **label,
103  unsigned *type, size_t *entry_idx);
104 
105 void *file_list_get_last_actiondata(const file_list_t *list);
106 
107 size_t file_list_get_size(const file_list_t *list);
108 
109 size_t file_list_get_directory_ptr(const file_list_t *list);
110 
111 void file_list_get_at_offset(const file_list_t *list, size_t index,
112  const char **path, const char **label,
113  unsigned *type, size_t *entry_idx);
114 
115 void file_list_free_userdata(const file_list_t *list, size_t index);
116 
117 void file_list_free_actiondata(const file_list_t *list, size_t idx);
118 
120  const char *label);
121 
122 void file_list_get_label_at_offset(const file_list_t *list, size_t index,
123  const char **label);
124 
126  const char *alt);
127 
128 void file_list_set_userdata(const file_list_t *list, size_t idx, void *ptr);
129 
130 void file_list_set_actiondata(const file_list_t *list, size_t idx, void *ptr);
131 
132 void file_list_get_alt_at_offset(const file_list_t *list, size_t index,
133  const char **alt);
134 
136 
138 
139 bool file_list_search(const file_list_t *list, const char *needle,
140  size_t *index);
141 
143 
144 #endif
void * file_list_get_last_actiondata(const file_list_t *list)
Definition: file_list.c:398
const GLvoid * ptr
Definition: nx_glsym.h:242
void file_list_get_last(const file_list_t *list, const char **path, const char **label, unsigned *type, size_t *entry_idx)
Definition: file_list.c:422
#define RETRO_BEGIN_DECLS
Definition: retro_common_api.h:41
void file_list_free_actiondata(const file_list_t *list, size_t idx)
Definition: file_list.c:380
void file_list_pop(file_list_t *list, size_t *directory_ptr)
Definition: file_list.c:140
size_t directory_ptr
Definition: file_list.h:41
GLsizei const GLchar ** path
Definition: glext.h:7901
struct file_list file_list_t
void * file_list_get_userdata_at_offset(const file_list_t *list, size_t index)
Definition: file_list.c:352
struct item_file * list
Definition: file_list.h:49
void file_list_copy(const file_list_t *src, file_list_t *dst)
Definition: file_list.c:216
unsigned type
Definition: file_list.h:40
void file_list_get_alt_at_offset(const file_list_t *list, size_t index, const char **alt)
Definition: file_list.c:310
void file_list_free(file_list_t *list)
frees the list
Definition: file_list.c:161
char * alt
Definition: file_list.h:39
GLuint GLsizei const GLchar * label
Definition: glext.h:8583
void file_list_sort_on_type(file_list_t *list)
Definition: file_list.c:347
GLenum type
Definition: glext.h:6233
size_t capacity
Definition: file_list.h:51
unsigned entry_idx
Definition: menu_cbs_ok.c:2308
void file_list_set_alt_at_offset(file_list_t *list, size_t index, const char *alt)
Definition: file_list.c:296
void file_list_set_actiondata(const file_list_t *list, size_t idx, void *ptr)
Definition: file_list.c:366
size_t file_list_get_directory_ptr(const file_list_t *list)
Definition: file_list.c:133
GLenum src
Definition: glext.h:6980
size_t file_list_get_size(const file_list_t *list)
Definition: file_list.c:126
void * actiondata
Definition: file_list.h:44
void * file_list_get_actiondata_at_offset(const file_list_t *list, size_t index)
Definition: file_list.c:373
bool file_list_reserve(file_list_t *list, size_t nitems)
makes the list big enough to contain at least nitems
Definition: file_list.c:32
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 idx
Definition: pixman-arm-neon-asm.h:96
void file_list_get_at_offset(const file_list_t *list, size_t index, const char **path, const char **label, unsigned *type, size_t *entry_idx)
Definition: file_list.c:405
#define RETRO_END_DECLS
Definition: retro_common_api.h:42
Definition: file_list.h:47
void file_list_free_userdata(const file_list_t *list, size_t index)
Definition: file_list.c:389
GLuint index
Definition: glext.h:6671
char * path
Definition: file_list.h:37
void file_list_clear(file_list_t *list)
Definition: file_list.c:191
Definition: file_list.h:35
void file_list_set_label_at_offset(file_list_t *list, size_t index, const char *label)
Definition: file_list.c:271
void file_list_sort_on_alt(file_list_t *list)
Definition: file_list.c:342
void file_list_get_label_at_offset(const file_list_t *list, size_t index, const char **label)
Definition: file_list.c:285
bool file_list_prepend(file_list_t *list, const char *path, const char *label, unsigned type, size_t directory_ptr, size_t entry_idx)
Definition: file_list.c:83
void * userdata
Definition: file_list.h:43
GLenum GLenum dst
Definition: glext.h:6980
size_t size
Definition: file_list.h:52
size_t entry_idx
Definition: file_list.h:42
bool file_list_append(file_list_t *userdata, const char *path, const char *label, unsigned type, size_t current_directory_ptr, size_t entry_index)
Definition: file_list.c:112
bool file_list_search(const file_list_t *list, const char *needle, size_t *index)
Definition: file_list.c:433
char * label
Definition: file_list.h:38
void file_list_set_userdata(const file_list_t *list, size_t idx, void *ptr)
Definition: file_list.c:359