1 /* gpathbuf.h: A mutable path builder
3 * SPDX-FileCopyrightText: 2023 Emmanuele Bassi
4 * SPDX-License-Identifier: LGPL-2.1-or-later
9 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
10 #error "Only <glib.h> can be included directly."
13 #include <glib/gtypes.h>
17 typedef struct _GPathBuf GPathBuf;
20 * GPathBuf: (copy-func g_path_buf_copy) (free-func g_path_buf_free)
22 * A mutable path builder.
35 * Initializes a #GPathBuf on the stack.
37 * A stack-allocated `GPathBuf` must be initialized if it is used
38 * together with g_auto() to avoid warnings and crashes if the
39 * function returns before calling g_path_buf_init().
41 * |[<!-- language="C" -->
42 * g_auto (GPathBuf) buf = G_PATH_BUF_INIT;
47 #define G_PATH_BUF_INIT { { NULL, } } \
48 GLIB_AVAILABLE_MACRO_IN_2_76
50 GLIB_AVAILABLE_IN_2_76
51 GPathBuf * g_path_buf_new (void);
52 GLIB_AVAILABLE_IN_2_76
53 GPathBuf * g_path_buf_new_from_path (const char *path);
54 GLIB_AVAILABLE_IN_2_76
55 GPathBuf * g_path_buf_init (GPathBuf *buf);
56 GLIB_AVAILABLE_IN_2_76
57 GPathBuf * g_path_buf_init_from_path (GPathBuf *buf,
59 GLIB_AVAILABLE_IN_2_76
60 void g_path_buf_clear (GPathBuf *buf);
61 GLIB_AVAILABLE_IN_2_76
62 char * g_path_buf_clear_to_path (GPathBuf *buf) G_GNUC_WARN_UNUSED_RESULT;
63 GLIB_AVAILABLE_IN_2_76
64 void g_path_buf_free (GPathBuf *buf);
65 GLIB_AVAILABLE_IN_2_76
66 char * g_path_buf_free_to_path (GPathBuf *buf) G_GNUC_WARN_UNUSED_RESULT;
67 GLIB_AVAILABLE_IN_2_76
68 GPathBuf * g_path_buf_copy (GPathBuf *buf);
70 GLIB_AVAILABLE_IN_2_76
71 GPathBuf * g_path_buf_push (GPathBuf *buf,
73 GLIB_AVAILABLE_IN_2_76
74 gboolean g_path_buf_pop (GPathBuf *buf);
76 GLIB_AVAILABLE_IN_2_76
77 gboolean g_path_buf_set_filename (GPathBuf *buf,
78 const char *file_name);
79 GLIB_AVAILABLE_IN_2_76
80 gboolean g_path_buf_set_extension (GPathBuf *buf,
81 const char *extension);
83 GLIB_AVAILABLE_IN_2_76
84 char * g_path_buf_to_path (GPathBuf *buf) G_GNUC_WARN_UNUSED_RESULT;
86 GLIB_AVAILABLE_IN_2_76
87 gboolean g_path_buf_equal (gconstpointer v1,