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
15G_BEGIN_DECLS
16
17typedef struct _GPathBuf GPathBuf;
18
19struct _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
43GLIB_AVAILABLE_IN_2_76
44GPathBuf * g_path_buf_new (void);
45GLIB_AVAILABLE_IN_2_76
46GPathBuf * g_path_buf_new_from_path (const char *path);
47GLIB_AVAILABLE_IN_2_76
48GPathBuf * g_path_buf_init (GPathBuf *buf);
49GLIB_AVAILABLE_IN_2_76
50GPathBuf * g_path_buf_init_from_path (GPathBuf *buf,
51 const char *path);
52GLIB_AVAILABLE_IN_2_76
53void g_path_buf_clear (GPathBuf *buf);
54GLIB_AVAILABLE_IN_2_76
55char * g_path_buf_clear_to_path (GPathBuf *buf) G_GNUC_WARN_UNUSED_RESULT;
56GLIB_AVAILABLE_IN_2_76
57void g_path_buf_free (GPathBuf *buf);
58GLIB_AVAILABLE_IN_2_76
59char * g_path_buf_free_to_path (GPathBuf *buf) G_GNUC_WARN_UNUSED_RESULT;
60GLIB_AVAILABLE_IN_2_76
61GPathBuf * g_path_buf_copy (GPathBuf *buf);
62
63GLIB_AVAILABLE_IN_2_76
64GPathBuf * g_path_buf_push (GPathBuf *buf,
65 const char *path);
66GLIB_AVAILABLE_IN_2_76
67gboolean g_path_buf_pop (GPathBuf *buf);
68
69GLIB_AVAILABLE_IN_2_76
70gboolean g_path_buf_set_filename (GPathBuf *buf,
71 const char *file_name);
72GLIB_AVAILABLE_IN_2_76
73gboolean g_path_buf_set_extension (GPathBuf *buf,
74 const char *extension);
75
76GLIB_AVAILABLE_IN_2_76
77char * g_path_buf_to_path (GPathBuf *buf) G_GNUC_WARN_UNUSED_RESULT;
78
79GLIB_AVAILABLE_IN_2_76
80gboolean g_path_buf_equal (gconstpointer v1,
81 gconstpointer v2);
82
83G_END_DECLS
84