VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/io/nsIStringStream.idl@ 65902

最後變更 在這個檔案從65902是 11551,由 vboxsync 提交於 16 年 前

API/xpcom: prefix any C symbols in VBoxXPCOM.so, to avoid namespace pollution. Enabled only on Linux at the moment.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 5.5 KB
 
1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 * [email protected] (original author)
24 * [email protected]
25 * [email protected]
26 * [email protected]
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * either of the GNU General Public License Version 2 or later (the "GPL"),
30 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 * in which case the provisions of the GPL or the LGPL are applicable instead
32 * of those above. If you wish to allow use of your version of this file only
33 * under the terms of either the GPL or the LGPL, and not to allow others to
34 * use your version of this file under the terms of the MPL, indicate your
35 * decision by deleting the provisions above and replace them with the notice
36 * and other provisions required by the GPL or the LGPL. If you do not delete
37 * the provisions above, a recipient may use your version of this file under
38 * the terms of any one of the MPL, the GPL or the LGPL.
39 *
40 * ***** END LICENSE BLOCK ***** */
41
42/**
43 * Based on original code from nsIStringStream.h
44 */
45
46#include "nsIInputStream.idl"
47
48/**
49 * nsIStringInputStream
50 *
51 * Provides scriptable and specialized C++ only methods for initializing a
52 * nsIInputStream implementation with a simple character array.
53 */
54[scriptable, uuid(450cd2d4-f0fd-424d-b365-b1251f80fd53)]
55interface nsIStringInputStream : nsIInputStream
56{
57 /**
58 * SetData - assign data to the input stream (copied on assignment).
59 *
60 * @param data - stream data
61 * @param dataLen - stream data length (-1 if length should be computed)
62 *
63 * NOTE: C++ code should consider using AdoptData or ShareData to avoid
64 * making an extra copy of the stream data.
65 */
66 void setData(in string data, in long dataLen);
67
68 /**
69 * NOTE: the following methods are designed to give C++ code added control
70 * over the ownership and lifetime of the stream data. Use with care :-)
71 */
72
73 /**
74 * AdoptData - assign data to the input stream. the input stream takes
75 * ownership of the given data buffer and will nsMemory::Free it when
76 * the input stream is destroyed.
77 *
78 * @param data - stream data
79 * @param dataLen - stream data length (-1 if length should be computed)
80 */
81 [noscript] void adoptData(in charPtr data, in long dataLen);
82
83 /**
84 * ShareData - assign data to the input stream. the input stream references
85 * the given data buffer until the input stream is destroyed. the given
86 * data buffer must outlive the input stream.
87 *
88 * @param data - stream data
89 * @param dataLen - stream data length (-1 if length should be computed)
90 */
91 [noscript] void shareData(in string data, in long dataLen);
92};
93
94%{C++
95
96//-----------------------------------------------------------------------------
97// C++ factory methods
98//-----------------------------------------------------------------------------
99
100#include "nsIInputStream.h"
101#include "nsString.h"
102
103#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
104#define NS_NewByteInputStream VBoxNsxpNS_NewByteInputStream
105#define NS_NewCStringInputStream VBoxNsxpNS_NewCStringInputStream
106#define NS_NewCharInputStream VBoxNsxpNS_NewCharInputStream
107#define NS_NewStringInputStream VBoxNsxpNS_NewStringInputStream
108#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
109
110//-----------------------------------------------------------------------------
111// Factory method to get an nsInputStream from an nsAString. Result will
112// implement nsIStringInputStream and nsIRandomAccessStore
113extern "C" NS_COM nsresult
114NS_NewStringInputStream(nsIInputStream** aStreamResult,
115 const nsAString& aStringToRead);
116
117//-----------------------------------------------------------------------------
118// Factory method to get an nsInputStream from an nsACString. Result will
119// implement nsIStringInputStream and nsIRandomAccessStore
120extern "C" NS_COM nsresult
121NS_NewCStringInputStream(nsIInputStream** aStreamResult,
122 const nsACString& aStringToRead);
123
124//-----------------------------------------------------------------------------
125// Factory method to get an nsInputStream from a string. Result will
126// implement nsIStringInputStream and nsIRandomAccessStore
127extern "C" NS_COM nsresult
128NS_NewCharInputStream(nsIInputStream** aStreamResult,
129 const char* aStringToRead);
130
131//-----------------------------------------------------------------------------
132// Factory method to get an nsInputStream from a byte buffer. Result will
133// implement nsIStringInputStream and nsIRandomAccessStore
134extern "C" NS_COM nsresult
135NS_NewByteInputStream(nsIInputStream** aStreamResult,
136 const char* aStringToRead,
137 PRInt32 aLength);
138%}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette