gresource.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright (C) 2006-2007 Red Hat, Inc.
  4. *
  5. * SPDX-License-Identifier: LGPL-2.1-or-later
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General
  18. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  19. *
  20. * Author: Alexander Larsson <alexl@redhat.com>
  21. */
  22. #ifndef __G_RESOURCE_H__
  23. #define __G_RESOURCE_H__
  24. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  25. #error "Only <gio/gio.h> can be included directly."
  26. #endif
  27. #include <gio/giotypes.h>
  28. G_BEGIN_DECLS
  29. /**
  30. * G_TYPE_RESOURCE:
  31. *
  32. * The #GType for #GResource.
  33. */
  34. #define G_TYPE_RESOURCE (g_resource_get_type ())
  35. /**
  36. * G_RESOURCE_ERROR:
  37. *
  38. * Error domain for #GResource. Errors in this domain will be from the
  39. * #GResourceError enumeration. See #GError for more information on
  40. * error domains.
  41. */
  42. #define G_RESOURCE_ERROR (g_resource_error_quark ())
  43. GIO_AVAILABLE_IN_2_32
  44. GQuark g_resource_error_quark (void);
  45. typedef struct _GStaticResource GStaticResource;
  46. struct _GStaticResource {
  47. /*< private >*/
  48. const guint8 *data;
  49. gsize data_len;
  50. GResource *resource;
  51. GStaticResource *next;
  52. gpointer padding;
  53. };
  54. GIO_AVAILABLE_IN_2_32
  55. GType g_resource_get_type (void) G_GNUC_CONST;
  56. GIO_AVAILABLE_IN_2_32
  57. GResource * g_resource_new_from_data (GBytes *data,
  58. GError **error);
  59. GIO_AVAILABLE_IN_2_32
  60. GResource * g_resource_ref (GResource *resource);
  61. GIO_AVAILABLE_IN_2_32
  62. void g_resource_unref (GResource *resource);
  63. GIO_AVAILABLE_IN_2_32
  64. GResource * g_resource_load (const gchar *filename,
  65. GError **error);
  66. GIO_AVAILABLE_IN_2_32
  67. GInputStream *g_resource_open_stream (GResource *resource,
  68. const char *path,
  69. GResourceLookupFlags lookup_flags,
  70. GError **error);
  71. GIO_AVAILABLE_IN_2_32
  72. GBytes * g_resource_lookup_data (GResource *resource,
  73. const char *path,
  74. GResourceLookupFlags lookup_flags,
  75. GError **error);
  76. GIO_AVAILABLE_IN_2_32
  77. char ** g_resource_enumerate_children (GResource *resource,
  78. const char *path,
  79. GResourceLookupFlags lookup_flags,
  80. GError **error);
  81. GIO_AVAILABLE_IN_2_32
  82. gboolean g_resource_get_info (GResource *resource,
  83. const char *path,
  84. GResourceLookupFlags lookup_flags,
  85. gsize *size,
  86. guint32 *flags,
  87. GError **error);
  88. GIO_AVAILABLE_IN_2_32
  89. void g_resources_register (GResource *resource);
  90. GIO_AVAILABLE_IN_2_32
  91. void g_resources_unregister (GResource *resource);
  92. GIO_AVAILABLE_IN_2_32
  93. GInputStream *g_resources_open_stream (const char *path,
  94. GResourceLookupFlags lookup_flags,
  95. GError **error);
  96. GIO_AVAILABLE_IN_2_32
  97. GBytes * g_resources_lookup_data (const char *path,
  98. GResourceLookupFlags lookup_flags,
  99. GError **error);
  100. GIO_AVAILABLE_IN_2_32
  101. char ** g_resources_enumerate_children (const char *path,
  102. GResourceLookupFlags lookup_flags,
  103. GError **error);
  104. GIO_AVAILABLE_IN_2_32
  105. gboolean g_resources_get_info (const char *path,
  106. GResourceLookupFlags lookup_flags,
  107. gsize *size,
  108. guint32 *flags,
  109. GError **error);
  110. GIO_AVAILABLE_IN_2_32
  111. void g_static_resource_init (GStaticResource *static_resource);
  112. GIO_AVAILABLE_IN_2_32
  113. void g_static_resource_fini (GStaticResource *static_resource);
  114. GIO_AVAILABLE_IN_2_32
  115. GResource *g_static_resource_get_resource (GStaticResource *static_resource);
  116. G_END_DECLS
  117. #endif /* __G_RESOURCE_H__ */