gfileoutputstream.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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_FILE_OUTPUT_STREAM_H__
  23. #define __G_FILE_OUTPUT_STREAM_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/goutputstream.h>
  28. G_BEGIN_DECLS
  29. #define G_TYPE_FILE_OUTPUT_STREAM (g_file_output_stream_get_type ())
  30. #define G_FILE_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_OUTPUT_STREAM, GFileOutputStream))
  31. #define G_FILE_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_OUTPUT_STREAM, GFileOutputStreamClass))
  32. #define G_IS_FILE_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_OUTPUT_STREAM))
  33. #define G_IS_FILE_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_OUTPUT_STREAM))
  34. #define G_FILE_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_OUTPUT_STREAM, GFileOutputStreamClass))
  35. typedef struct _GFileOutputStreamClass GFileOutputStreamClass;
  36. typedef struct _GFileOutputStreamPrivate GFileOutputStreamPrivate;
  37. struct _GFileOutputStream
  38. {
  39. GOutputStream parent_instance;
  40. /*< private >*/
  41. GFileOutputStreamPrivate *priv;
  42. };
  43. struct _GFileOutputStreamClass
  44. {
  45. GOutputStreamClass parent_class;
  46. goffset (* tell) (GFileOutputStream *stream);
  47. gboolean (* can_seek) (GFileOutputStream *stream);
  48. gboolean (* seek) (GFileOutputStream *stream,
  49. goffset offset,
  50. GSeekType type,
  51. GCancellable *cancellable,
  52. GError **error);
  53. gboolean (* can_truncate) (GFileOutputStream *stream);
  54. gboolean (* truncate_fn) (GFileOutputStream *stream,
  55. goffset size,
  56. GCancellable *cancellable,
  57. GError **error);
  58. GFileInfo * (* query_info) (GFileOutputStream *stream,
  59. const char *attributes,
  60. GCancellable *cancellable,
  61. GError **error);
  62. void (* query_info_async) (GFileOutputStream *stream,
  63. const char *attributes,
  64. int io_priority,
  65. GCancellable *cancellable,
  66. GAsyncReadyCallback callback,
  67. gpointer user_data);
  68. GFileInfo * (* query_info_finish) (GFileOutputStream *stream,
  69. GAsyncResult *result,
  70. GError **error);
  71. char * (* get_etag) (GFileOutputStream *stream);
  72. /* Padding for future expansion */
  73. void (*_g_reserved1) (void);
  74. void (*_g_reserved2) (void);
  75. void (*_g_reserved3) (void);
  76. void (*_g_reserved4) (void);
  77. void (*_g_reserved5) (void);
  78. };
  79. GIO_AVAILABLE_IN_ALL
  80. GType g_file_output_stream_get_type (void) G_GNUC_CONST;
  81. GIO_AVAILABLE_IN_ALL
  82. GFileInfo *g_file_output_stream_query_info (GFileOutputStream *stream,
  83. const char *attributes,
  84. GCancellable *cancellable,
  85. GError **error);
  86. GIO_AVAILABLE_IN_ALL
  87. void g_file_output_stream_query_info_async (GFileOutputStream *stream,
  88. const char *attributes,
  89. int io_priority,
  90. GCancellable *cancellable,
  91. GAsyncReadyCallback callback,
  92. gpointer user_data);
  93. GIO_AVAILABLE_IN_ALL
  94. GFileInfo *g_file_output_stream_query_info_finish (GFileOutputStream *stream,
  95. GAsyncResult *result,
  96. GError **error);
  97. GIO_AVAILABLE_IN_ALL
  98. char * g_file_output_stream_get_etag (GFileOutputStream *stream);
  99. G_END_DECLS
  100. #endif /* __G_FILE_FILE_OUTPUT_STREAM_H__ */