1 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset:8 -*- */
4 * This file is part of The Croco Library
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2.1 of the GNU Lesser General Public
8 * License as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * Author: Dodji Seketeli
21 * See the COPYRIGHTS file for copyrights information.
24 #ifndef __CR_INPUT_SRC_H__
25 #define __CR_INPUT_SRC_H__
30 #include "cr-parsing-location.h"
36 *The libcroco basic input stream class
40 typedef struct _CRInput CRInput ;
41 typedef struct _CRInputPriv CRInputPriv ;
44 *The #CRInput class provides the abstraction of
45 *an utf8-encoded character stream.
52 typedef struct _CRInputPos CRInputPos ;
58 gboolean end_of_file ;
59 gboolean end_of_line ;
60 glong next_byte_index ;
64 cr_input_new_from_buf (guchar *a_buf, gulong a_len,
65 enum CREncoding a_enc, gboolean a_free_buf) ;
67 cr_input_new_from_uri (const gchar *a_file_uri,
68 enum CREncoding a_enc) ;
71 cr_input_destroy (CRInput *a_this) ;
74 cr_input_ref (CRInput *a_this) ;
77 cr_input_unref (CRInput *a_this) ;
80 cr_input_read_byte (CRInput *a_this, guchar *a_byte) ;
83 cr_input_read_char (CRInput *a_this, guint32 *a_char) ;
86 cr_input_consume_chars (CRInput *a_this, guint32 a_char,
90 cr_input_consume_char (CRInput *a_this, guint32 a_char) ;
93 cr_input_consume_white_spaces (CRInput *a_this, gulong *a_nb_chars) ;
96 cr_input_peek_byte (CRInput *a_this, enum CRSeekPos a_origin,
97 gulong a_offset, guchar *a_byte) ;
100 cr_input_peek_byte2 (CRInput *a_this, gulong a_offset,
104 cr_input_peek_char (CRInput *a_this, guint32 *a_char) ;
107 cr_input_get_byte_addr (CRInput *a_this,
111 cr_input_get_cur_byte_addr (CRInput *a_this, guchar ** a_offset) ;
114 cr_input_seek_index (CRInput *a_this,
115 enum CRSeekPos a_origin, gint a_pos) ;
118 cr_input_get_cur_index (CRInput *a_this, glong *a_index) ;
121 cr_input_set_cur_index (CRInput *a_this, glong a_index) ;
124 cr_input_get_cur_pos (CRInput *a_this, CRInputPos * a_pos) ;
127 cr_input_set_cur_pos (CRInput *a_this, CRInputPos *a_pos) ;
130 cr_input_get_parsing_location (CRInput *a_this,
131 CRParsingLocation *a_loc) ;
134 cr_input_get_end_of_line (CRInput *a_this, gboolean *a_eol) ;
137 cr_input_set_end_of_line (CRInput *a_this, gboolean a_eol) ;
140 cr_input_get_end_of_file (CRInput *a_this, gboolean *a_eof) ;
143 cr_input_set_end_of_file (CRInput *a_this, gboolean a_eof) ;
146 cr_input_set_line_num (CRInput *a_this, glong a_line_num) ;
149 cr_input_get_line_num (CRInput *a_this, glong *a_line_num) ;
152 cr_input_set_column_num (CRInput *a_this, glong a_col) ;
155 cr_input_get_column_num (CRInput *a_this, glong *a_col) ;
158 cr_input_increment_line_num (CRInput *a_this,
162 cr_input_increment_col_num (CRInput *a_this,
166 cr_input_get_nb_bytes_left (CRInput *a_this) ;
169 cr_input_end_of_input (CRInput *a_this, gboolean *a_end_of_input) ;
173 #endif /*__CR_INPUT_SRC_H__*/