|
1 /* vim:set expandtab ts=4 sw=4 sts=4 cin: */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 /** |
|
9 * An interface that allows writing unicode data. |
|
10 */ |
|
11 [scriptable, uuid(2d00b1bb-8b21-4a63-bcc6-7213f513ac2e)] |
|
12 interface nsIUnicharOutputStream : nsISupports |
|
13 { |
|
14 /** |
|
15 * Write a single character to the stream. When writing many characters, |
|
16 * prefer the string-taking write method. |
|
17 * |
|
18 * @retval true The character was written successfully |
|
19 * @retval false Not all bytes of the character could be written. |
|
20 */ |
|
21 boolean write(in unsigned long aCount, |
|
22 [const, array, size_is(aCount)] in char16_t c); |
|
23 |
|
24 /** |
|
25 * Write a string to the stream. |
|
26 * |
|
27 * @retval true The string was written successfully |
|
28 * @retval false Not all bytes of the string could be written. |
|
29 */ |
|
30 boolean writeString(in AString str); |
|
31 |
|
32 /** |
|
33 * Flush the stream. This finishes the conversion and writes any bytes that |
|
34 * finish the current byte sequence. |
|
35 * |
|
36 * It does NOT flush the underlying stream. |
|
37 * |
|
38 * @see nsIUnicodeEncoder::Finish |
|
39 */ |
|
40 void flush(); |
|
41 |
|
42 /** |
|
43 * Close the stream and free associated resources. This also closes the |
|
44 * underlying stream. |
|
45 */ |
|
46 void close(); |
|
47 }; |