aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-stream.c
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnu.org>1999-07-15 08:11:56 +0800
committerArturo Espinosa <unammx@src.gnome.org>1999-07-15 08:11:56 +0800
commitfce26238c489db149f63164f13adf4bdb83d6062 (patch)
treef05ffd69d069044bcdb28e6d0d768239bc489e03 /camel/camel-stream.c
parent68f3afb7a29764be0389cb5a7b9960357e957412 (diff)
downloadgsoc2013-evolution-fce26238c489db149f63164f13adf4bdb83d6062.tar
gsoc2013-evolution-fce26238c489db149f63164f13adf4bdb83d6062.tar.gz
gsoc2013-evolution-fce26238c489db149f63164f13adf4bdb83d6062.tar.bz2
gsoc2013-evolution-fce26238c489db149f63164f13adf4bdb83d6062.tar.lz
gsoc2013-evolution-fce26238c489db149f63164f13adf4bdb83d6062.tar.xz
gsoc2013-evolution-fce26238c489db149f63164f13adf4bdb83d6062.tar.zst
gsoc2013-evolution-fce26238c489db149f63164f13adf4bdb83d6062.zip
Implemented base64 encoder based on CamelStreams. Should the
1999-07-13 Miguel de Icaza <miguel@gnu.org> * camel/gmime-base64.c (gmime_encode_base64): Implemented base64 encoder based on CamelStreams. Should the encoder/decoder be a Stream itself? * camel/gmime-utils.c: include config.h here. * camel/url-util.c: ditto. * camel/gstring-util.c: ditto. * camel/gmime-content-field.c: ditto. * camel/camel-stream.c: ditto. * camel/camel-stream-fs.c: ditto. * camel/camel-store.c: ditto. * camel/camel-simple-data-wrapper.c: ditto. * camel/camel-session.c: ditto. * camel/camel-service.c: ditto. * camel/camel-mime-part.c: ditto. * camel/camel-mime-message.c: ditto. * camel/camel-log.c: ditto. * camel/camel-data-wrapper.c: ditto * camel/camel-folder.c: ditto. * camel/camel-stream.c (camel_stream_write): Moved api documentation to the places that they document. (camel_stream_class_init): Virtual classes do not need to have a default implementation. So null them all. (camel_stream_write): Return value from write. (camel_stream_available): implement. (camel_stream_write_strings): documented. * devel-docs/query/virtual-folder-in-depth.sgml: Small reformatting 1999-06-28 bertrand <Bertrand.Guiheneuf@inria.fr> * tests/test2.c (main): now use CamelDataWrapper::contruct_form_stream to test svn path=/trunk/; revision=1024
Diffstat (limited to 'camel/camel-stream.c')
-rw-r--r--camel/camel-stream.c142
1 files changed, 61 insertions, 81 deletions
diff --git a/camel/camel-stream.c b/camel/camel-stream.c
index 9f9e912bd8..5554b8fe38 100644
--- a/camel/camel-stream.c
+++ b/camel/camel-stream.c
@@ -21,22 +21,26 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-
+#include <config.h>
#include "camel-stream.h"
-static CamelStreamClass *parent_class=NULL;
+static CamelStreamClass *parent_class = NULL;
/* Returns the class for a CamelMimeMessage */
#define CS_CLASS(so) CAMEL_STREAM_CLASS (GTK_OBJECT(so)->klass)
-static gint _read (CamelStream *stream, gchar *buffer, gint n);
-static gint _write (CamelStream *stream, gchar *buffer, gint n);
-static void _flush (CamelStream *stream);
-static gint _available (CamelStream *stream);
-static gboolean _eos (CamelStream *stream);
-static void _close (CamelStream *stream);
+static void
+default_camel_flush (CamelStream *stream)
+{
+ /* nothing */
+}
+static void
+default_camel_close (CamelStream *stream)
+{
+ /* nothing */
+}
static void
camel_stream_class_init (CamelStreamClass *camel_stream_class)
@@ -45,19 +49,16 @@ camel_stream_class_init (CamelStreamClass *camel_stream_class)
parent_class = gtk_type_class (gtk_object_get_type ());
/* virtual method definition */
- camel_stream_class->read = _read;
- camel_stream_class->write = _write;
- camel_stream_class->flush = _flush;
- camel_stream_class->available = _available;
- camel_stream_class->eos = _eos;
- camel_stream_class->close = _close;
+ camel_stream_class->read = NULL;
+ camel_stream_class->write = NULL;
+ camel_stream_class->flush = default_camel_flush;
+ camel_stream_class->available = NULL;
+ camel_stream_class->eos = NULL;
+ camel_stream_class->close = default_camel_close;
/* virtual method overload */
-
}
-
-
GtkType
camel_stream_get_type (void)
{
@@ -82,24 +83,17 @@ camel_stream_get_type (void)
return camel_stream_type;
}
-
-
/**
- * _read: read bytes from a stream
- * @stream: stream
- * @buffer: buffer where bytes are stored
- * @n: max number of bytes to read
- *
+ * camel_stream_read:
+ * @stream: a CamelStream.
+ * @buffer: buffer where bytes pulled from the stream are stored.
+ * @n: max number of bytes to read.
*
+ * Read at most @n bytes from the @stream object and stores them
+ * in the buffer pointed at by @buffer.
*
* Return value: number of bytes actually read.
**/
-static gint
-_read (CamelStream *stream, gchar *buffer, gint n)
-{
-
-}
-
gint
camel_stream_read (CamelStream *stream, gchar *buffer, gint n)
{
@@ -107,98 +101,84 @@ camel_stream_read (CamelStream *stream, gchar *buffer, gint n)
}
/**
- * _write: read bytes to a stream
- * @stream: the stream
- * @buffer: byte buffer
+ * camel_stream_write:
+ * @stream: a CamelStream object.
+ * @buffer: buffer to write.
* @n: number of bytes to write
- *
- *
- *
+ *
+ * Write @n bytes from the buffer pointed at by @buffer into @stream.
+ *
* Return value: the number of bytes actually written
* in the stream.
**/
-static gint
-_write (CamelStream *stream, gchar *buffer, gint n)
-{
-
-}
-
gint
camel_stream_write (CamelStream *stream, gchar *buffer, gint n)
{
- CS_CLASS (stream)->write (stream, buffer, n);
+ return CS_CLASS (stream)->write (stream, buffer, n);
}
-
-
/**
- * _flush: flush pending changes
- * @stream: the stream
- *
+ * camel_stream_flush:
+ * @stream: a CamelStream object
*
+ * Flushes the contents of the stream to its backing store.
**/
-static void
-_flush (CamelStream *stream)
+void
+camel_stream_flush (CamelStream *stream)
{
-
+ return CS_CLASS (stream)->flush (stream);
}
-
-
/**
- * _available: return the number of bytes available for reading
- * @stream: the stream
- *
- * Return the number of bytes available without blocking.
+ * camel_stream_available:
+ * @stream: a CamelStream object
*
- * Return value: the number of bytes available
+ * Return value: the number of bytes available.
**/
static gint
-_available (CamelStream *stream)
+camel_stream_available (CamelStream *stream)
{
-
+ return CS_CLASS (stream)->available (stream);
}
-
/**
- * _eos: test if there are bytes left to read
- * @stream: the stream
- *
+ * camle_stream_eos:
+ * @stream: a CamelStream object
*
+ * Test if there are bytes left to read on the @stream object.
*
- * Return value: true if all stream has been read
+ * Return value: %TRUE if all the contents on the stream has been read, or
+ * %FALSE if information is still available.
**/
static gboolean
-_eos (CamelStream *stream)
+camel_stream_eos (CamelStream *stream)
{
-
+ return CS_CLASS (stream)->eos (stream);
}
/**
- * _close: close a stream
- * @stream: the stream
- *
+ * camel_stram_close:
+ * @stream: a CamelStream object.
*
+ * Close the @stream object.
**/
-static void
-_close (CamelStream *stream)
-{
-
-}
-
void
camel_stream_close (CamelStream *stream)
{
CS_CLASS (stream)->close (stream);
}
-
-
-
-
/***************** Utility functions ********************/
+/**
+ * came_stream_write_strings:
+ * @stream: a CamelStream object.
+ * @...: A %NULL terminated list of strings.
+ *
+ * This is a utility function that writes the list of
+ * strings into the @stream object.
+ */
void
camel_stream_write_strings (CamelStream *stream, ... )
{
@@ -209,7 +189,7 @@ camel_stream_write_strings (CamelStream *stream, ... )
string = va_arg (args, char *);
while (string) {
- camel_stream_write_string(stream, string);
+ camel_stream_write_string (stream, string);
string = va_arg (args, char *);
}
va_end (args);