1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  *
3  * Copyright (C) 2013-2015 Richard Hughes <richard@hughsie.com>
4  *
5  * Licensed under the GNU Lesser General Public License Version 2.1
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
20  */
21 
22 #ifndef __DNF_UTILS_H
23 #define __DNF_UTILS_H
24 
25 #include <glib.h>
26 
27 #ifdef __cplusplus
28     #ifndef __has_cpp_attribute
29         #define __has_cpp_attribute(x) 0
30     #endif
31 
32     #if __has_cpp_attribute(deprecated)
33         #define DEPRECATED(msg) [[deprecated(msg)]]
34     #endif
35 #endif
36 
37 #ifndef DEPRECATED
38     #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
39         #define DEPRECATED(msg) __attribute__((__deprecated__(msg)))
40     #elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320)
41         #define DEPRECATED(msg) __declspec(deprecated(msg))
42     #elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
43         #define DEPRECATED(msg) __attribute__((__deprecated__))
44     #elif defined(_MSC_VER) && (_MSC_VER >= 1300)
45         #define DEPRECATED(msg) __declspec(deprecated)
46     #else
47         #define DEPRECATED(msg)
48     #endif
49 #endif
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 gchar           *dnf_realpath                       (const gchar            *path);
56 gboolean         dnf_remove_recursive               (const gchar            *directory,
57                                                      GError                 **error);
58 gboolean         dnf_ensure_file_unlinked           (const gchar            *src_path,
59                                                      GError                 **error);
60 gboolean         dnf_delete_files_matching          (const gchar            *directory_path,
61                                                      const char* const      *patterns,
62                                                      GError                 **error);
63 gboolean         dnf_get_file_contents_allow_noent  (const gchar            *path,
64                                                      gchar                  **out_contents,
65                                                      gsize                  *length,
66                                                      GError                 **error);
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #endif /* __DNF_UTILS_H */
73