gpathbuf.h 2.4 KB

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