Annotation of win32/gnome/gmime-x.x.x/gmime-stream.h, revision 1.1
1.1 ! paf 1: /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
! 2: /*
! 3: * Authors: Jeffrey Stedfast <fejj@ximian.com>
! 4: *
! 5: * Copyright 2001 Ximian, Inc. (www.ximian.com)
! 6: *
! 7: * This program is free software; you can redistribute it and/or modify
! 8: * it under the terms of the GNU General Public License as published by
! 9: * the Free Software Foundation; either version 2 of the License, or
! 10: * (at your option) any later version.
! 11: *
! 12: * This program 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
! 15: * GNU General Public License for more details.
! 16: *
! 17: * You should have received a copy of the GNU General Public License
! 18: * along with this program; if not, write to the Free Software
! 19: * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
! 20: *
! 21: */
! 22:
! 23:
! 24: #ifndef __GMIME_STREAM_H__
! 25: #define __GMIME_STREAM_H__
! 26:
! 27: #ifdef __cplusplus
! 28: extern "C" {
! 29: //#pragma }
! 30: #endif /* __cplusplus */
! 31:
! 32: #include <glib.h>
! 33: #include <sys/types.h>
! 34: #ifdef HAVE_UNISTD_H
! 35: #include <unistd.h>
! 36: #else
! 37: #include <stdio.h>
! 38: #endif
! 39: #include <stdarg.h>
! 40:
! 41: typedef enum {
! 42: GMIME_STREAM_SEEK_SET = SEEK_SET,
! 43: GMIME_STREAM_SEEK_CUR = SEEK_CUR,
! 44: GMIME_STREAM_SEEK_END = SEEK_END,
! 45: } GMimeSeekWhence;
! 46:
! 47: struct _IOVector {
! 48: gpointer data;
! 49: size_t len;
! 50: };
! 51:
! 52: typedef struct _IOVector IOVector;
! 53:
! 54: typedef struct _GMimeStream GMimeStream;
! 55:
! 56: struct _GMimeStream {
! 57: /* Note: these are private fields!! */
! 58: GMimeStream *super_stream;
! 59:
! 60: unsigned int type;
! 61: int refcount;
! 62:
! 63: off_t position;
! 64: off_t bound_start;
! 65: off_t bound_end;
! 66:
! 67: void (*destroy) (GMimeStream *stream);
! 68:
! 69: ssize_t (*read) (GMimeStream *stream, char *buf, size_t len);
! 70: ssize_t (*write) (GMimeStream *stream, char *buf, size_t len);
! 71: int (*flush) (GMimeStream *stream);
! 72: int (*close) (GMimeStream *stream);
! 73: gboolean (*eos) (GMimeStream *stream);
! 74: int (*reset) (GMimeStream *stream);
! 75: off_t (*seek) (GMimeStream *stream, off_t offset, GMimeSeekWhence whence);
! 76: off_t (*tell) (GMimeStream *stream);
! 77: ssize_t (*length) (GMimeStream *stream);
! 78: GMimeStream *(*substream) (GMimeStream *stream, off_t start, off_t end);
! 79: };
! 80:
! 81: #define GMIME_STREAM(stream) ((GMimeStream *) stream)
! 82:
! 83: void g_mime_stream_construct (GMimeStream *stream, GMimeStream *stream_template,
! 84: unsigned int type, off_t start, off_t end);
! 85:
! 86: /* public methods */
! 87: ssize_t g_mime_stream_read (GMimeStream *stream, char *buf, size_t len);
! 88: ssize_t g_mime_stream_write (GMimeStream *stream, char *buf, size_t len);
! 89: int g_mime_stream_flush (GMimeStream *stream);
! 90: int g_mime_stream_close (GMimeStream *stream);
! 91: gboolean g_mime_stream_eos (GMimeStream *stream);
! 92: int g_mime_stream_reset (GMimeStream *stream);
! 93: off_t g_mime_stream_seek (GMimeStream *stream, off_t offset, GMimeSeekWhence whence);
! 94: off_t g_mime_stream_tell (GMimeStream *stream);
! 95: ssize_t g_mime_stream_length (GMimeStream *stream);
! 96:
! 97: GMimeStream *g_mime_stream_substream (GMimeStream *stream, off_t start, off_t end);
! 98:
! 99: void g_mime_stream_ref (GMimeStream *stream);
! 100: void g_mime_stream_unref (GMimeStream *stream);
! 101:
! 102: void g_mime_stream_set_bounds (GMimeStream *stream, off_t start, off_t end);
! 103:
! 104: ssize_t g_mime_stream_write_string (GMimeStream *stream, const char *string);
! 105: ssize_t g_mime_stream_printf (GMimeStream *stream, const char *fmt, ...) G_GNUC_PRINTF (2, 3);
! 106:
! 107: ssize_t g_mime_stream_write_to_stream (GMimeStream *src, GMimeStream *dest);
! 108:
! 109:
! 110: ssize_t g_mime_stream_writev (GMimeStream *stream, IOVector *vector, size_t count);
! 111:
! 112: #ifdef __cplusplus
! 113: }
! 114: #endif /* __cplusplus */
! 115:
! 116: #endif /* __GMIME_STREAM_H__ */
E-mail: