1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23#ifndef __com_sun_star_io_XTextInputStream_idl__
24#define __com_sun_star_io_XTextInputStream_idl__
25
26#ifndef __com_sun_star_io_XInputStream_idl__
27#include <com/sun/star/io/XInputStream.idl>
28#endif
29
30#ifndef __com_sun_star_io_IOException_idl__
31#include <com/sun/star/io/IOException.idl>
32#endif
33
34
35//=============================================================================
36
37module com {  module sun {  module star {  module io {
38
39//=============================================================================
40/** Interface to read strings from a stream.
41
42	<p>This interfaces allows to read strings seperated by
43	delimiters and to read lines. The character encoding
44	to be used can be set by <member>setEncoding()</member>.
45	Default encoding is "utf8".</p>
46 */
47published interface XTextInputStream: com::sun::star::io::XInputStream
48{
49	//-------------------------------------------------------------------------
50	/** reads text until a line break (CR, LF, or CR/LF) or
51		EOF is found and returns it as string (without CR, LF).
52
53		<p>The read characters are converted according to the
54		encoding defined by <member>setEncoding</member>. If
55		EOF is already reached before calling this method
56		an empty string is returned.<p>
57
58		@see setEncoding
59		@see isEOF
60	 */
61	string readLine()
62			raises( com::sun::star::io::IOException );
63
64	//-------------------------------------------------------------------------
65	/** reads text until one of the given delimiter characters
66		or EOF is found and returns it as string (without delimiter).
67
68		<p><strong>Important:</strong> CR/LF is not used as default
69		delimiter! So if no delimiter is defined or none of the
70		delimiters is found, the stream will be read to EOF. The
71		read characters are converted according to the encoding
72		defined by <member>setEncoding</member>. If EOF is already
73		reached before calling this method an empty string is returned.</p>
74
75		@see setEncoding
76		@see isEOF
77	 */
78	string readString( [in] sequence<char> Delimiters, [in] boolean bRemoveDelimiter )
79			raises( com::sun::star::io::IOException );
80
81	//-------------------------------------------------------------------------
82	/** Returns the EOF status.
83
84		<p>This method has to be used to detect if the end
85		of the stream is reached.</p>
86		<p><strong>Important:</strong>
87		This cannot be detected by asking for an empty string
88		because that can be a valid return value of <member>
89		readLine()</member> (if the line is empty) and
90		readString() (if a delimiter is directly followed
91		by the next one).</p>
92
93		@returns
94			<TRUE/>, if the end of file is reached, so that
95			no next string can be read. <FALSE/> otherwise
96	 */
97	boolean isEOF()
98			raises( com::sun::star::io::IOException );
99
100	//-------------------------------------------------------------------------
101	/** sets character encoding.
102
103		@param Encoding
104			sets the character encoding that should be used.
105			The character encoding names refer to the document
106			http://www.iana.org/assignments/character-sets.
107			Which character sets are supported depends on
108			the implementation.
109	 */
110	void setEncoding( [in] string Encoding );
111};
112
113//=============================================================================
114
115}; }; }; };
116
117#endif
118