"Fossies" - the Fresh Open Source Software Archive

Member "genius-1.0.24/vte/src/vtestream-base.h" (16 Aug 2011, 2937 Bytes) of package /linux/misc/genius-1.0.24.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "vtestream-base.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) 2009,2010 Red Hat, Inc.
    3  *
    4  * This is free software; you can redistribute it and/or modify it under
    5  * the terms of the GNU Library General Public License as published by
    6  * the Free Software Foundation; either version 2 of the License, or
    7  * (at your option) any later version.
    8  *
    9  * This program is distributed in the hope that it will be useful, but
   10  * WITHOUT ANY WARRANTY; without even the implied warranty of
   11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   12  * General Public License for more details.
   13  *
   14  * You should have received a copy of the GNU Library General Public
   15  * License along with this program; if not, write to the Free Software
   16  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   17  *
   18  * Red Hat Author(s): Behdad Esfahbod
   19  */
   20 
   21 #include <glib-object.h>
   22 #include <gio/gio.h>
   23 
   24 /*
   25  * VteStream: Abstract base stream class
   26  */
   27 
   28 struct _VteStream {
   29     GObject parent;
   30 };
   31 
   32 typedef struct _VteStreamClass {
   33     GObjectClass parent_class;
   34 
   35     void (*reset) (VteStream *stream, gsize offset);
   36     gsize (*append) (VteStream *stream, const char *data, gsize len);
   37     gboolean (*read) (VteStream *stream, gsize offset, char *data, gsize len);
   38     void (*truncate) (VteStream *stream, gsize offset);
   39     void (*new_page) (VteStream *stream);
   40     gsize (*head) (VteStream *stream);
   41     gboolean (*write_contents) (VteStream *stream, GOutputStream *output,
   42                     gsize start_offset,
   43                     GCancellable *cancellable, GError **error);
   44 } VteStreamClass;
   45 
   46 static GType _vte_stream_get_type (void);
   47 #define VTE_TYPE_STREAM _vte_stream_get_type ()
   48 #define VTE_STREAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTE_TYPE_STREAM, VteStreamClass))
   49 
   50 G_DEFINE_ABSTRACT_TYPE (VteStream, _vte_stream, G_TYPE_OBJECT)
   51 
   52 static void
   53 _vte_stream_class_init (VteStreamClass *klass G_GNUC_UNUSED)
   54 {
   55 }
   56 
   57 static void
   58 _vte_stream_init (VteStream *stream G_GNUC_UNUSED)
   59 {
   60 }
   61 
   62 void
   63 _vte_stream_reset (VteStream *stream, gsize offset)
   64 {
   65     VTE_STREAM_GET_CLASS (stream)->reset (stream, offset);
   66 }
   67 
   68 gsize
   69 _vte_stream_append (VteStream *stream, const char *data, gsize len)
   70 {
   71     return VTE_STREAM_GET_CLASS (stream)->append (stream, data, len);
   72 }
   73 
   74 gboolean
   75 _vte_stream_read (VteStream *stream, gsize offset, char *data, gsize len)
   76 {
   77     return VTE_STREAM_GET_CLASS (stream)->read (stream, offset, data, len);
   78 }
   79 
   80 void
   81 _vte_stream_truncate (VteStream *stream, gsize offset)
   82 {
   83     VTE_STREAM_GET_CLASS (stream)->truncate (stream, offset);
   84 }
   85 
   86 void
   87 _vte_stream_new_page (VteStream *stream)
   88 {
   89     VTE_STREAM_GET_CLASS (stream)->new_page (stream);
   90 }
   91 
   92 gsize
   93 _vte_stream_head (VteStream *stream)
   94 {
   95     return VTE_STREAM_GET_CLASS (stream)->head (stream);
   96 }
   97 
   98 gboolean
   99 _vte_stream_write_contents (VteStream *stream, GOutputStream *output,
  100                 gsize start_offset,
  101                 GCancellable *cancellable, GError **error)
  102 {
  103     return VTE_STREAM_GET_CLASS (stream)->write_contents (stream, output,
  104                                   start_offset,
  105                                   cancellable, error);
  106 }