plibsys 0.0.5
pdir.h
Go to the documentation of this file.
1/*
2 * The MIT License
3 *
4 * Copyright (C) 2015-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
47#if !defined (PLIBSYS_H_INSIDE) && !defined (PLIBSYS_COMPILATION)
48# error "Header files shouldn't be included directly, consider using <plibsys.h> instead."
49#endif
50
51#ifndef PLIBSYS_HEADER_PDIR_H
52#define PLIBSYS_HEADER_PDIR_H
53
54#include <pmacros.h>
55#include <ptypes.h>
56#include <perror.h>
57
59
61typedef struct PDir_ PDir;
62
69
75
87 PError **error);
88
101 pint mode,
102 PError **error);
103
114 PError **error);
115
123
134
149 PError **error);
150
159 PError **error);
160
167
174
176
177#endif /* PLIBSYS_HEADER_PDIR_H */
PDirEntryType_
Directory entry types.
Definition pdir.h:64
@ P_DIR_ENTRY_TYPE_FILE
File.
Definition pdir.h:66
@ P_DIR_ENTRY_TYPE_DIR
Directory.
Definition pdir.h:65
@ P_DIR_ENTRY_TYPE_OTHER
Other.
Definition pdir.h:67
struct PDir_ PDir
Directory opaque data structure.
Definition pdir.h:61
P_LIB_API void p_dir_entry_free(PDirEntry *entry)
Frees PDirEntry object.
P_LIB_API pboolean p_dir_is_exists(const pchar *path)
Checks whether a directory exists or not.
struct PDirEntry_ PDirEntry
Structure with directory entry information.
P_LIB_API pboolean p_dir_rewind(PDir *dir, PError **error)
Resets a directory entry pointer.
P_LIB_API void p_dir_free(PDir *dir)
Frees PDir object.
P_LIB_API PDir * p_dir_new(const pchar *path, PError **error)
Creates a new PDir object.
P_LIB_API pboolean p_dir_create(const pchar *path, pint mode, PError **error)
Creates a new directory on a filesystem.
P_LIB_API PDirEntry * p_dir_get_next_entry(PDir *dir, PError **error)
Gets the next directory entry info.
P_LIB_API pboolean p_dir_remove(const pchar *path, PError **error)
Removes an empty directory.
P_LIB_API pchar * p_dir_get_path(const PDir *dir)
Gets the original directory path used to create a PDir object.
enum PDirEntryType_ PDirEntryType
Directory entry types.
Error report system.
struct PError_ PError
Opaque data structure for an error object.
Definition perror.h:68
Miscellaneous macros.
#define P_BEGIN_DECLS
Starts .h file declarations to be exported as C functions.
Definition pmacros.h:298
#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
#define P_LIB_API
Exports a symbol from a shared library.
Definition pmacros.h:138
Types definitions.
char pchar
Type for a char.
Definition ptypes.h:116
int pint
Type for an int.
Definition ptypes.h:120
signed int pboolean
Type for a bool.
Definition ptypes.h:114
Structure with directory entry information.
Definition pdir.h:71
char * name
Name.
Definition pdir.h:72
PDirEntryType type
Type.
Definition pdir.h:73