1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27#ifndef __com_sun_star_io_XTextInputStream_idl__
28#define __com_sun_star_io_XTextInputStream_idl__
29
30#ifndef __com_sun_star_io_XInputStream_idl__
31#include <com/sun/star/io/XInputStream.idl>
32#endif
33
34#ifndef __com_sun_star_io_IOException_idl__
35#include <com/sun/star/io/IOException.idl>
36#endif
37
38
39//=============================================================================
40
41module com {  module sun {  module star {  module io {
42
43//=============================================================================
44/** Interface to read strings from a stream.
45
46	<p>This interfaces allows to read strings seperated by
47	delimiters and to read lines. The character encoding
48	to be used can be set by <member>setEncoding()</member>.
49	Default encoding is "utf8".</p>
50 */
51published interface XTextInputStream: com::sun::star::io::XInputStream
52{
53	//-------------------------------------------------------------------------
54	/** reads text until a line break (CR, LF, or CR/LF) or
55		EOF is found and returns it as string (without CR, LF).
56
57		<p>The read characters are converted according to the
58		encoding defined by <member>setEncoding</member>. If
59		EOF is already reached before calling this method
60		an empty string is returned.<p>
61
62		@see setEncoding
63		@see isEOF
64	 */
65	string readLine()
66			raises( com::sun::star::io::IOException );
67
68	//-------------------------------------------------------------------------
69	/** reads text until one of the given delimiter characters
70		or EOF is found and returns it as string (without delimiter).
71
72		<p><strong>Important:</strong> CR/LF is not used as default
73		delimiter! So if no delimiter is defined or none of the
74		delimiters is found, the stream will be read to EOF. The
75		read characters are converted according to the encoding
76		defined by <member>setEncoding</member>. If EOF is already
77		reached before calling this method an empty string is returned.</p>
78
79		@see setEncoding
80		@see isEOF
81	 */
82	string readString( [in] sequence<char> Delimiters, [in] boolean bRemoveDelimiter )
83			raises( com::sun::star::io::IOException );
84
85	//-------------------------------------------------------------------------
86	/** Returns the EOF status.
87
88		<p>This method has to be used to detect if the end
89		of the stream is reached.</p>
90		<p><strong>Important:</strong>
91		This cannot be detected by asking for an empty string
92		because that can be a valid return value of <member>
93		readLine()</member> (if the line is empty) and
94		readString() (if a delimiter is directly followed
95		by the next one).</p>
96
97		@returns
98			<TRUE/>, if the end of file is reached, so that
99			no next string can be read. <FALSE/> otherwise
100	 */
101	boolean isEOF()
102			raises( com::sun::star::io::IOException );
103
104	//-------------------------------------------------------------------------
105	/** sets character encoding.
106
107		@param Encoding
108			sets the character encoding that should be used.
109			The character encoding names refer to the document
110			http://www.iana.org/assignments/character-sets.
111			Which character sets are supported depends on
112			the implementation.
113	 */
114	void setEncoding( [in] string Encoding );
115};
116
117//=============================================================================
118
119}; }; }; };
120
121#endif
122