gbytes.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Copyright © 2009, 2010 Codethink Limited
  3. * Copyright © 2011 Collabora Ltd.
  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 Public
  18. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  19. *
  20. * Author: Ryan Lortie <desrt@desrt.ca>
  21. * Stef Walter <stefw@collabora.co.uk>
  22. */
  23. #ifndef __G_BYTES_H__
  24. #define __G_BYTES_H__
  25. #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
  26. #error "Only <glib.h> can be included directly."
  27. #endif
  28. #include <glib/gtypes.h>
  29. #include <glib/garray.h>
  30. G_BEGIN_DECLS
  31. GLIB_AVAILABLE_IN_ALL
  32. GBytes * g_bytes_new (gconstpointer data,
  33. gsize size);
  34. GLIB_AVAILABLE_IN_ALL
  35. GBytes * g_bytes_new_take (gpointer data,
  36. gsize size);
  37. GLIB_AVAILABLE_IN_ALL
  38. GBytes * g_bytes_new_static (gconstpointer data,
  39. gsize size);
  40. GLIB_AVAILABLE_IN_ALL
  41. GBytes * g_bytes_new_with_free_func (gconstpointer data,
  42. gsize size,
  43. GDestroyNotify free_func,
  44. gpointer user_data);
  45. GLIB_AVAILABLE_IN_ALL
  46. GBytes * g_bytes_new_from_bytes (GBytes *bytes,
  47. gsize offset,
  48. gsize length);
  49. GLIB_AVAILABLE_IN_ALL
  50. gconstpointer g_bytes_get_data (GBytes *bytes,
  51. gsize *size);
  52. GLIB_AVAILABLE_IN_ALL
  53. gsize g_bytes_get_size (GBytes *bytes);
  54. GLIB_AVAILABLE_IN_ALL
  55. GBytes * g_bytes_ref (GBytes *bytes);
  56. GLIB_AVAILABLE_IN_ALL
  57. void g_bytes_unref (GBytes *bytes);
  58. GLIB_AVAILABLE_IN_ALL
  59. gpointer g_bytes_unref_to_data (GBytes *bytes,
  60. gsize *size);
  61. GLIB_AVAILABLE_IN_ALL
  62. GByteArray * g_bytes_unref_to_array (GBytes *bytes);
  63. GLIB_AVAILABLE_IN_ALL
  64. guint g_bytes_hash (gconstpointer bytes);
  65. GLIB_AVAILABLE_IN_ALL
  66. gboolean g_bytes_equal (gconstpointer bytes1,
  67. gconstpointer bytes2);
  68. GLIB_AVAILABLE_IN_ALL
  69. gint g_bytes_compare (gconstpointer bytes1,
  70. gconstpointer bytes2);
  71. GLIB_AVAILABLE_IN_2_70
  72. gconstpointer g_bytes_get_region (GBytes *bytes,
  73. gsize element_size,
  74. gsize offset,
  75. gsize n_elements);
  76. G_END_DECLS
  77. #endif /* __G_BYTES_H__ */