VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/obsolete/nsIFileStream.h@ 4837

Last change on this file since 4837 was 1, checked in by vboxsync, 54 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.4 KB
Line 
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 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37#ifndef nsIFileStream_h___
38#define nsIFileStream_h___
39
40#include "xpcomobsolete.h"
41#include "nsIInputStream.h"
42#include "nsIOutputStream.h"
43#include "nsISeekableStream.h"
44#include "prio.h"
45
46class nsFileSpec;
47
48/* a6cf90e8-15b3-11d2-932e-00805f8add32 */
49#define NS_IOPENFILE_IID \
50{ 0xa6cf90e8, 0x15b3, 0x11d2, \
51 {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
52
53//========================================================================================
54class nsIOpenFile
55// Represents a file, and supports Open.
56//========================================================================================
57: public nsISupports
58{
59public:
60 NS_DEFINE_STATIC_IID_ACCESSOR(NS_IOPENFILE_IID)
61
62 NS_IMETHOD Open(
63 const nsFileSpec& inFile,
64 int nsprMode,
65 PRIntn accessMode) = 0;
66 // Note: Open() is only needed after
67 // an explicit Close(). All file streams
68 // are automatically opened on construction.
69 NS_IMETHOD GetIsOpen(PRBool* outOpen) = 0;
70
71}; // class nsIOpenFile
72
73/* a6cf90e8-15b3-11d2-932e-00805f8add32 */
74#define NS_IRANDOMACCESS_IID \
75{ 0xa6cf90eb, 0x15b3, 0x11d2, \
76 {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
77
78//========================================================================================
79class nsIRandomAccessStore
80// Supports Seek, Tell etc.
81//========================================================================================
82: public nsISeekableStream
83{
84public:
85 NS_DEFINE_STATIC_IID_ACCESSOR(NS_IRANDOMACCESS_IID)
86
87/* "PROTECTED" */
88 NS_IMETHOD GetAtEOF(PRBool* outAtEOF) = 0;
89 NS_IMETHOD SetAtEOF(PRBool inAtEOF) = 0;
90}; // class nsIRandomAccessStore
91
92
93#ifndef NO_XPCOM_FILE_STREAMS // hack to work around duplicate class definitions in here
94 // and mozilla/netwerks/base/nsIFileStreams.idl
95
96/* a6cf90e6-15b3-11d2-932e-00805f8add32 */
97#define NS_IFILESPECINPUTSTREAM_IID \
98{ 0xa6cf90e6, 0x15b3, 0x11d2, \
99 {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
100
101//========================================================================================
102class nsIFileSpecInputStream
103// These are additional file-specific methods that files have, above what
104// nsIInputStream supports. The current implementation supports both
105// interfaces.
106//========================================================================================
107: public nsIInputStream
108{
109public:
110 NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFILESPECINPUTSTREAM_IID)
111}; // class nsIFileSpecInputStream
112
113/* a6cf90e7-15b3-11d2-932e-00805f8add32 */
114#define NS_IFILESPECOUTPUTSTREAM_IID \
115{ 0xa6cf90e7, 0x15b3, 0x11d2, \
116 {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
117
118//========================================================================================
119class nsIFileSpecOutputStream
120// These are additional file-specific methods that files have, above what
121// nsIOutputStream supports. The current implementation supports both
122// interfaces.
123//========================================================================================
124: public nsIOutputStream
125{
126public:
127 NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFILESPECOUTPUTSTREAM_IID)
128}; // class nsIFileSpecOutputStream
129
130#endif // NO_XPCOM_FILE_STREAMS
131
132//----------------------------------------------------------------------------------------
133nsresult NS_NewTypicalInputFileStream(
134 nsISupports** aStreamResult,
135 const nsFileSpec& inFile
136 /*Default nsprMode == PR_RDONLY*/
137 /*Default accessmode = 0700 (octal)*/);
138// Factory method to get an nsInputStream from a file, using most common options
139
140//----------------------------------------------------------------------------------------
141nsresult NS_NewTypicalOutputFileStream(
142 nsISupports** aStreamResult, // will implement all the above interfaces
143 const nsFileSpec& inFile
144 /*default nsprMode= (PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE)*/
145 /*Default accessMode= 0700 (octal)*/);
146 // Factory method to get an nsOutputStream to a file - most common case.
147
148//----------------------------------------------------------------------------------------
149extern "C" NS_COM_OBSOLETE nsresult NS_NewIOFileStream(
150 nsISupports** aStreamResult, // will implement all the above interfaces
151 const nsFileSpec& inFile,
152 PRInt32 nsprMode,
153 PRInt32 accessMode);
154 // Factory method to get an object that implements both nsIInputStream
155 // and nsIOutputStream, associated with a single file.
156
157#endif /* nsIFileSpecStream_h___ */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use