1 /* gpathbuf.h: A mutable path builder
2 *
3 * SPDX-FileCopyrightText: 2023 Emmanuele Bassi
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6
7 #pragma once
8
9 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
10 #error "Only <glib.h> can be included directly."
11 #endif
12
13 #include <glib/gtypes.h>
14
15 G_BEGIN_DECLS
16
17 typedef struct _GPathBuf GPathBuf;
18
19 struct _GPathBuf
20 {
21 /*< private >*/
22 gpointer dummy[8];
23 };
24
25 /**
26 * G_PATH_BUF_INIT:
27 *
28 * Initializes a #GPathBuf on the stack.
29 *
30 * A stack-allocated `GPathBuf` must be initialized if it is used
31 * together with g_auto() to avoid warnings and crashes if the
32 * function returns before calling g_path_buf_init().
33 *
34 * |[<!-- language="C" -->
35 * g_auto (GPathBuf) buf = G_PATH_BUF_INIT;
36 * ]|
37 *
38 * Since: 2.76
39 */
40 #define G_PATH_BUF_INIT { { NULL, } } \
41 GLIB_AVAILABLE_MACRO_IN_2_76
42
43 GLIB_AVAILABLE_IN_2_76
44 GPathBuf * g_path_buf_new (void);
45 GLIB_AVAILABLE_IN_2_76
46 GPathBuf * g_path_buf_new_from_path (const char *path);
47 GLIB_AVAILABLE_IN_2_76
48 GPathBuf * g_path_buf_init (GPathBuf *buf);
49 GLIB_AVAILABLE_IN_2_76
50 GPathBuf * g_path_buf_init_from_path (GPathBuf *buf,
51 const char *path);
52 GLIB_AVAILABLE_IN_2_76
53 void g_path_buf_clear (GPathBuf *buf);
54 GLIB_AVAILABLE_IN_2_76
55 char * g_path_buf_clear_to_path (GPathBuf *buf) G_GNUC_WARN_UNUSED_RESULT;
56 GLIB_AVAILABLE_IN_2_76
57 void g_path_buf_free (GPathBuf *buf);
58 GLIB_AVAILABLE_IN_2_76
59 char * g_path_buf_free_to_path (GPathBuf *buf) G_GNUC_WARN_UNUSED_RESULT;
60 GLIB_AVAILABLE_IN_2_76
61 GPathBuf * g_path_buf_copy (GPathBuf *buf);
62
63 GLIB_AVAILABLE_IN_2_76
64 GPathBuf * g_path_buf_push (GPathBuf *buf,
65 const char *path);
66 GLIB_AVAILABLE_IN_2_76
67 gboolean g_path_buf_pop (GPathBuf *buf);
68
69 GLIB_AVAILABLE_IN_2_76
70 gboolean g_path_buf_set_filename (GPathBuf *buf,
71 const char *file_name);
72 GLIB_AVAILABLE_IN_2_76
73 gboolean g_path_buf_set_extension (GPathBuf *buf,
74 const char *extension);
75
76 GLIB_AVAILABLE_IN_2_76
77 char * g_path_buf_to_path (GPathBuf *buf) G_GNUC_WARN_UNUSED_RESULT;
78
79 GLIB_AVAILABLE_IN_2_76
80 gboolean g_path_buf_equal (gconstpointer v1,
81 gconstpointer v2);
82
83 G_END_DECLS