1 /* Lips of Suna
2  * Copyright© 2007-2009 Lips of Suna development team.
3  *
4  * Lips of Suna is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation, either version 3 of the
7  * License, or (at your option) any later version.
8  *
9  * Lips of Suna is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with Lips of Suna. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 /**
19  * \addtogroup lisys System
20  * @{
21  * \addtogroup lisysDir Directory
22  * @{
23  */
24 
25 #ifndef __SYSTEM_DIRECTORY_H__
26 #define __SYSTEM_DIRECTORY_H__
27 
28 typedef int (*lisysDirFilter)(const char* dir, const char* name);
29 typedef int (*lisysDirSorter)(const char** name0, const char** name1);
30 typedef struct _lisysDir lisysDir;
31 struct _lisysDir;
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 lisysDir*
38 lisys_dir_open (const char* path);
39 
40 void
41 lisys_dir_free (lisysDir* self);
42 
43 int
44 lisys_dir_scan (lisysDir* self);
45 
46 int
47 lisys_dir_get_count (const lisysDir* self);
48 
49 const char*
50 lisys_dir_get_name (const lisysDir* self,
51                     int             i);
52 
53 char*
54 lisys_dir_get_path (const lisysDir* self,
55                     int             i);
56 
57 void
58 lisys_dir_set_filter (lisysDir*      self,
59                       lisysDirFilter filter);
60 
61 void
62 lisys_dir_set_sorter (lisysDir*      self,
63                       lisysDirSorter sorter);
64 
65 int
66 LISYS_DIR_FILTER_FILES (const char* dir,
67                         const char* name);
68 
69 int
70 LISYS_DIR_FILTER_DIRS (const char* dir,
71                        const char* name);
72 
73 int
74 LISYS_DIR_FILTER_HIDDEN (const char* dir,
75                          const char* name);
76 
77 int
78 LISYS_DIR_FILTER_VISIBLE (const char* dir,
79                           const char* name);
80 
81 int
82 LISYS_DIR_SORTER_ALPHA (const char** name0,
83                         const char** name1);
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif
90 
91 /** @} */
92 /** @} */
93 
94