You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

100 lines
3.1 KiB

  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright (C) 2006-2007 Red Hat, Inc.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General
  16. * Public License along with this library; if not, write to the
  17. * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  18. * Boston, MA 02111-1307, USA.
  19. *
  20. * Author: Alexander Larsson <alexl@redhat.com>
  21. */
  22. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  23. #error "Only <gio/gio.h> can be included directly."
  24. #endif
  25. #ifndef __G_SEEKABLE_H__
  26. #define __G_SEEKABLE_H__
  27. #include <gio/giotypes.h>
  28. G_BEGIN_DECLS
  29. #define G_TYPE_SEEKABLE (g_seekable_get_type ())
  30. #define G_SEEKABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_SEEKABLE, GSeekable))
  31. #define G_IS_SEEKABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_SEEKABLE))
  32. #define G_SEEKABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_SEEKABLE, GSeekableIface))
  33. /**
  34. * GSeekable:
  35. *
  36. * Seek object for streaming operations.
  37. **/
  38. typedef struct _GSeekableIface GSeekableIface;
  39. /**
  40. * GSeekableIface:
  41. * @g_iface: The parent interface.
  42. * @tell: Tells the current location within a stream.
  43. * @can_seek: Checks if seeking is supported by the stream.
  44. * @seek: Seeks to a location within a stream.
  45. * @can_truncate: Chekcs if truncation is suppored by the stream.
  46. * @truncate_fn: Truncates a stream.
  47. *
  48. * Provides an interface for implementing seekable functionality on I/O Streams.
  49. **/
  50. struct _GSeekableIface
  51. {
  52. GTypeInterface g_iface;
  53. /* Virtual Table */
  54. goffset (* tell) (GSeekable *seekable);
  55. gboolean (* can_seek) (GSeekable *seekable);
  56. gboolean (* seek) (GSeekable *seekable,
  57. goffset offset,
  58. GSeekType type,
  59. GCancellable *cancellable,
  60. GError **error);
  61. gboolean (* can_truncate) (GSeekable *seekable);
  62. gboolean (* truncate_fn) (GSeekable *seekable,
  63. goffset offset,
  64. GCancellable *cancellable,
  65. GError **error);
  66. /* TODO: Async seek/truncate */
  67. };
  68. GType g_seekable_get_type (void) G_GNUC_CONST;
  69. goffset g_seekable_tell (GSeekable *seekable);
  70. gboolean g_seekable_can_seek (GSeekable *seekable);
  71. gboolean g_seekable_seek (GSeekable *seekable,
  72. goffset offset,
  73. GSeekType type,
  74. GCancellable *cancellable,
  75. GError **error);
  76. gboolean g_seekable_can_truncate (GSeekable *seekable);
  77. gboolean g_seekable_truncate (GSeekable *seekable,
  78. goffset offset,
  79. GCancellable *cancellable,
  80. GError **error);
  81. G_END_DECLS
  82. #endif /* __G_SEEKABLE_H__ */