1 | /* |
---|
2 | * Copyright (C) 2001 - 2004 Mike Wray <mike.wray@hp.com> |
---|
3 | * |
---|
4 | * This library is free software; you can redistribute it and/or modify |
---|
5 | * it under the terms of the GNU Lesser General Public License as published by |
---|
6 | * the Free Software Foundation; either version 2.1 of the License, or |
---|
7 | * (at your option) any later version. |
---|
8 | * |
---|
9 | * This library is distributed in the hope that it will be useful, |
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | * GNU Lesser General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU Lesser General Public License |
---|
15 | * along with this library; if not, write to the Free Software |
---|
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _XUTIL_STRING_STREAM_H_ |
---|
20 | #define _XUTIL_STRING_STREAM_H_ |
---|
21 | |
---|
22 | #include "iostream.h" |
---|
23 | |
---|
24 | /** Internal state for a string stream. |
---|
25 | * Exposed here so that string streams can be statically created, using |
---|
26 | * string_stream_init(). |
---|
27 | */ |
---|
28 | typedef struct { |
---|
29 | /** The string used for input and ouput. */ |
---|
30 | char *string; |
---|
31 | /** Output pointer. */ |
---|
32 | char *out; |
---|
33 | /** Input pointer. */ |
---|
34 | char *in; |
---|
35 | /** Length of string. */ |
---|
36 | int size; |
---|
37 | /** End marker. */ |
---|
38 | char *end; |
---|
39 | } StringData; |
---|
40 | |
---|
41 | extern IOMethods *string_stream_get_methods(void); |
---|
42 | extern IOStream *string_stream_new(char *s, int n); |
---|
43 | extern void string_stream_init(IOStream *stream, StringData *data, char *s, int n); |
---|
44 | |
---|
45 | #endif /* !_XUTIL_STRING_STREAM_H_ */ |
---|