Backed out 2 changesets (bug 1908320) for causing wr failures on align-items-baseline...
[gecko.git] / xpcom / io / nsIStringStream.idl
blob3e084cbe7f64d3a829c1d509d0d0820a357137da
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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/. */
6 #include "nsIInputStream.idl"
8 %{C++
9 #include "mozilla/MemoryReporting.h"
11 namespace mozilla {
12 class StreamBufferSource;
13 } // namespace mozilla
16 native MallocSizeOf(mozilla::MallocSizeOf);
17 [ptr] native StreamBufferSource(mozilla::StreamBufferSource);
19 /**
20 * nsIStringInputStream
22 * Provides scriptable and specialized C++-only methods for initializing a
23 * nsIInputStream implementation with a simple character array.
25 [scriptable, builtinclass, uuid(450cd2d4-f0fd-424d-b365-b1251f80fd53)]
26 interface nsIStringInputStream : nsIInputStream
28 /**
29 * SetData - assign data to the input stream (copied on assignment).
31 * @param data - stream data
32 * @param dataLen - stream data length (-1 if length should be computed)
34 * NOTE: C++ code should consider using AdoptData or ShareData to avoid
35 * making an extra copy of the stream data.
37 * NOTE: For JS callers, the given data must not contain null characters
38 * (other than a null terminator) because a null character in the middle of
39 * the data string will be seen as a terminator when the data is converted
40 * from a JS string to a C++ character array.
42 void setData(in string data, in long dataLen);
44 /**
45 * SetUTF8Data - encode input data to UTF-8 and assign it to the input
46 * stream.
48 * @param data - stream data
50 * NOTE: This method is meant to be used by JS callers,
52 void setUTF8Data(in AUTF8String data);
54 /**
55 * NOTE: the following methods are designed to give C++ code added control
56 * over the ownership and lifetime of the stream data. Use with care :-)
59 /**
60 * AdoptData - assign data to the input stream. the input stream takes
61 * ownership of the given data buffer and will free it when
62 * the input stream is destroyed.
64 * @param data - stream data
65 * @param dataLen - stream data length (-1 if length should be computed)
67 [noscript] void adoptData(in charPtr data, in long dataLen);
69 /**
70 * ShareData - assign data to the input stream. the input stream references
71 * the given data buffer until the input stream is destroyed. the given
72 * data buffer must outlive the input stream.
74 * @param data - stream data
75 * @param dataLen - stream data length (-1 if length should be computed)
77 [noscript] void shareData(in string data, in long dataLen);
79 /**
80 * SetDataSource - assign data to the input stream. the input stream holds
81 * a strong reference to the given data buffer until it is destroyed.
83 * @param source - stream data source
85 [noscript] void setDataSource(in StreamBufferSource source);
87 [noscript, notxpcom]
88 size_t SizeOfIncludingThisIfUnshared(in MallocSizeOf aMallocSizeOf);
90 [noscript, notxpcom]
91 size_t SizeOfIncludingThisEvenIfShared(in MallocSizeOf aMallocSizeOf);