Change LGPL-2.1+ to LGPL-2.1-or-later
[platform/upstream/glib.git] / glib / gpathbuf.h
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 /**
20  * GPathBuf: (copy-func g_path_buf_copy) (free-func g_path_buf_free)
21  *
22  * A mutable path builder.
23  *
24  * Since: 2.76
25  */
26 struct _GPathBuf
27 {
28   /*< private >*/
29   gpointer dummy[8];
30 };
31
32 /**
33  * G_PATH_BUF_INIT:
34  *
35  * Initializes a #GPathBuf on the stack.
36  *
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().
40  *
41  * |[<!-- language="C" -->
42  *   g_auto (GPathBuf) buf = G_PATH_BUF_INIT;
43  * ]|
44  *
45  * Since: 2.76
46  */
47 #define G_PATH_BUF_INIT { { NULL, } } \
48   GLIB_AVAILABLE_MACRO_IN_2_76
49
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,
58                                          const char *path);
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);
69
70 GLIB_AVAILABLE_IN_2_76
71 GPathBuf *    g_path_buf_push           (GPathBuf   *buf,
72                                          const char *path);
73 GLIB_AVAILABLE_IN_2_76
74 gboolean      g_path_buf_pop            (GPathBuf   *buf);
75
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);
82
83 GLIB_AVAILABLE_IN_2_76
84 char *        g_path_buf_to_path        (GPathBuf   *buf) G_GNUC_WARN_UNUSED_RESULT;
85
86 GLIB_AVAILABLE_IN_2_76
87 gboolean      g_path_buf_equal          (gconstpointer v1,
88                                          gconstpointer v2);
89
90 G_END_DECLS