Add base64 encode/decode functions
[platform/upstream/glib.git] / glib / giochannel.h
index a84670c..aa812be 100644 (file)
@@ -98,11 +98,12 @@ typedef enum
   G_IO_FLAG_IS_SEEKABLE = 1 << 4,      /* Read only flag */
   G_IO_FLAG_MASK = (1 << 5) - 1,
   G_IO_FLAG_GET_MASK = G_IO_FLAG_MASK,
-  G_IO_FLAG_SET_MASK = G_IO_FLAG_APPEND | G_IO_FLAG_NONBLOCK,
+  G_IO_FLAG_SET_MASK = G_IO_FLAG_APPEND | G_IO_FLAG_NONBLOCK
 } GIOFlags;
 
 struct _GIOChannel
 {
+  /*< private >*/
   guint ref_count;
   GIOFuncs *funcs;
 
@@ -110,6 +111,7 @@ struct _GIOChannel
   GIConv read_cd;
   GIConv write_cd;
   gchar *line_term;            /* String which indicates the end of a line of text */
+  guint line_term_len;         /* So we can have null in the line term */
 
   gsize buf_size;
   GString *read_buf;           /* Raw data from the channel */
@@ -119,12 +121,15 @@ struct _GIOChannel
 
   /* Group the flags together, immediately after partial_write_buf, to save memory */
 
-  gboolean use_buffer : 1;     /* The encoding uses the buffers */
-  gboolean do_encode : 1;      /* The encoding uses the GIConv coverters */
-  gboolean close_on_unref : 1; /* Close the channel on final unref */
-  gboolean is_readable : 1;    /* Cached GIOFlag */
-  gboolean is_writeable : 1;   /* ditto */
-  gboolean is_seekable : 1;    /* ditto */
+  guint use_buffer     : 1;    /* The encoding uses the buffers */
+  guint do_encode      : 1;    /* The encoding uses the GIConv coverters */
+  guint close_on_unref : 1;    /* Close the channel on final unref */
+  guint is_readable    : 1;    /* Cached GIOFlag */
+  guint is_writeable   : 1;    /* ditto */
+  guint is_seekable    : 1;    /* ditto */
+
+  gpointer reserved1;  
+  gpointer reserved2;  
 };
 
 typedef gboolean (*GIOFunc) (GIOChannel   *source,
@@ -143,7 +148,7 @@ struct _GIOFuncs
                                  gsize        *bytes_written,
                                  GError      **err);
   GIOStatus (*io_seek)           (GIOChannel   *channel, 
-                                 glong         offset, 
+                                 gint64        offset, 
                                  GSeekType     type,
                                  GError      **err);
   GIOStatus  (*io_close)         (GIOChannel   *channel,
@@ -158,7 +163,7 @@ struct _GIOFuncs
 };
 
 void        g_io_channel_init   (GIOChannel    *channel);
-void        g_io_channel_ref    (GIOChannel    *channel);
+GIOChannel *g_io_channel_ref    (GIOChannel    *channel);
 void        g_io_channel_unref  (GIOChannel    *channel);
 
 #ifndef G_DISABLE_DEPRECATED
@@ -171,7 +176,7 @@ GIOError  g_io_channel_write    (GIOChannel    *channel,
                                 gsize          count,
                                 gsize         *bytes_written);
 GIOError  g_io_channel_seek     (GIOChannel    *channel,
-                                glong          offset, 
+                                gint64         offset, 
                                 GSeekType      type);
 void      g_io_channel_close    (GIOChannel    *channel);
 #endif /* G_DISABLE_DEPRECATED */
@@ -204,8 +209,10 @@ GIOStatus             g_io_channel_set_flags            (GIOChannel   *channel,
                                                         GError      **error);
 GIOFlags              g_io_channel_get_flags            (GIOChannel   *channel);
 void                  g_io_channel_set_line_term        (GIOChannel   *channel,
-                                                        const gchar  *line_term);
-G_CONST_RETURN gchar* g_io_channel_get_line_term        (GIOChannel   *channel);
+                                                        const gchar  *line_term,
+                                                        gint          length);
+G_CONST_RETURN gchar* g_io_channel_get_line_term        (GIOChannel   *channel,
+                                                        gint         *length);
 void                 g_io_channel_set_buffered         (GIOChannel   *channel,
                                                         gboolean      buffered);
 gboolean             g_io_channel_get_buffered         (GIOChannel   *channel);
@@ -250,9 +257,13 @@ GIOStatus   g_io_channel_write_unichar    (GIOChannel   *channel,
                                           gunichar      thechar,
                                           GError      **error);
 GIOStatus   g_io_channel_seek_position    (GIOChannel   *channel,
-                                          glong         offset,
+                                          gint64        offset,
                                           GSeekType     type,
                                           GError      **error);
+#ifdef G_OS_WIN32
+#define g_io_channel_new_file g_io_channel_new_file_utf8
+#endif
+
 GIOChannel* g_io_channel_new_file         (const gchar  *filename,
                                           const gchar  *mode,
                                           GError      **error);
@@ -283,8 +294,16 @@ GIOChannelError g_io_channel_error_from_errno (gint en);
 GIOChannel* g_io_channel_unix_new    (int         fd);
 gint        g_io_channel_unix_get_fd (GIOChannel *channel);
 
+
+/* Hook for GClosure / GSource integration. Don't touch */
+GLIB_VAR GSourceFuncs g_io_watch_funcs;
+
 #ifdef G_OS_WIN32
 
+/* You can use this "pseudo file descriptor" in a GPollFD to add
+ * polling for Windows messages. GTK applications should not do that.
+ */
+
 #define G_WIN32_MSG_HANDLE 19981206
 
 /* Use this to get a GPollFD from a GIOChannel, so that you can call
@@ -302,14 +321,7 @@ void        g_io_channel_win32_make_pollfd (GIOChannel   *channel,
  */
 gint        g_io_channel_win32_poll   (GPollFD    *fds,
                                       gint        n_fds,
-                                      gint        timeout);
-
-/* This is used to add polling for Windows messages. GDK (GTk+) programs
- * should *not* use this.
- */
-void        g_main_poll_win32_msg_add (gint        priority,
-                                      GPollFD    *fd,
-                                      guint       hwnd);
+                                      gint        timeout_);
 
 /* Create an IO channel for Windows messages for window handle hwnd. */
 GIOChannel *g_io_channel_win32_new_messages (guint hwnd);