1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camel-stream-fs.h :stream based on unix filesystem */
6 * Bertrand Guiheneuf <bertrand@helixcode.com>
8 * Copyright 1999, 2000 Ximian, Inc. (www.ximian.com)
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU Lesser General Public
12 * License as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
26 #ifndef CAMEL_SEEKABLE_STREAM_H
27 #define CAMEL_SEEKABLE_STREAM_H 1
29 #include <sys/types.h>
31 #include <camel/camel-stream.h>
33 #define CAMEL_SEEKABLE_STREAM_TYPE (camel_seekable_stream_get_type ())
34 #define CAMEL_SEEKABLE_STREAM(obj) (CAMEL_CHECK_CAST((obj), CAMEL_SEEKABLE_STREAM_TYPE, CamelSeekableStream))
35 #define CAMEL_SEEKABLE_STREAM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SEEKABLE_STREAM_TYPE, CamelSeekableStreamClass))
36 #define CAMEL_IS_SEEKABLE_STREAM(o) (CAMEL_CHECK_TYPE((o), CAMEL_SEEKABLE_STREAM_TYPE))
41 CAMEL_STREAM_SET = SEEK_SET,
42 CAMEL_STREAM_CUR = SEEK_CUR,
43 CAMEL_STREAM_END = SEEK_END
44 } CamelStreamSeekPolicy;
46 #define CAMEL_STREAM_UNBOUND (~0)
48 struct _CamelSeekableStream {
49 CamelStream parent_object;
51 off_t position; /* current postion in the stream */
52 off_t bound_start; /* first valid position */
53 off_t bound_end; /* first invalid position */
57 CamelStreamClass parent_class;
60 off_t (*seek) (CamelSeekableStream *stream, off_t offset,
61 CamelStreamSeekPolicy policy);
62 off_t (*tell) (CamelSeekableStream *stream);
63 int (*set_bounds) (CamelSeekableStream *stream,
64 off_t start, off_t end);
65 } CamelSeekableStreamClass;
67 /* Standard Camel function */
68 CamelType camel_seekable_stream_get_type (void);
71 off_t camel_seekable_stream_seek (CamelSeekableStream *stream, off_t offset,
72 CamelStreamSeekPolicy policy);
73 off_t camel_seekable_stream_tell (CamelSeekableStream *stream);
74 int camel_seekable_stream_set_bounds (CamelSeekableStream *stream, off_t start, off_t end);
78 #endif /* CAMEL_SEEKABLE_STREAM_H */