xpcom/io/nsIStringStream.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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 /**
     9  * nsIStringInputStream
    10  *
    11  * Provides scriptable and specialized C++-only methods for initializing a
    12  * nsIInputStream implementation with a simple character array.
    13  */
    14 [scriptable, uuid(450cd2d4-f0fd-424d-b365-b1251f80fd53)]
    15 interface nsIStringInputStream : nsIInputStream
    16 {
    17     /**
    18      * SetData - assign data to the input stream (copied on assignment).
    19      *
    20      * @param data    - stream data
    21      * @param dataLen - stream data length (-1 if length should be computed)
    22      *
    23      * NOTE: C++ code should consider using AdoptData or ShareData to avoid
    24      * making an extra copy of the stream data.
    25      *
    26      * NOTE: For JS callers, the given data must not contain null characters
    27      * (other than a null terminator) because a null character in the middle of
    28      * the data string will be seen as a terminator when the data is converted
    29      * from a JS string to a C++ character array.
    30      */
    31     void setData(in string data, in long dataLen);
    33     /**
    34      * NOTE: the following methods are designed to give C++ code added control
    35      * over the ownership and lifetime of the stream data.  Use with care :-)
    36      */
    38     /**
    39      * AdoptData - assign data to the input stream.  the input stream takes
    40      * ownership of the given data buffer and will nsMemory::Free it when
    41      * the input stream is destroyed.
    42      *
    43      * @param data      - stream data
    44      * @param dataLen   - stream data length (-1 if length should be computed)
    45      */
    46     [noscript] void adoptData(in charPtr data, in long dataLen);
    48     /**
    49      * ShareData - assign data to the input stream.  the input stream references
    50      * the given data buffer until the input stream is destroyed.  the given
    51      * data buffer must outlive the input stream.
    52      *
    53      * @param data      - stream data
    54      * @param dataLen   - stream data length (-1 if length should be computed)
    55      */
    56     [noscript] void shareData(in string data, in long dataLen);
    57 };

mercurial