IDLized stream interfaces. Required rename of overloaded Write method (now WriteFrom).

This commit is contained in:
warren%netscape.com 1999-06-03 21:50:47 +00:00
Родитель 829fdd746e
Коммит cbbfa208f8
34 изменённых файлов: 256 добавлений и 52 удалений

Просмотреть файл

@ -447,7 +447,8 @@ public:
fflush(stdout);
return NS_OK;
}
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount)
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
PRUint32 *aWriteCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -21,6 +21,7 @@
#include "plstr.h"
#include "nsEmitterUtils.h"
#include "nsMailHeaders.h"
#include "nscore.h"
/*
* This function will be used by the factory to generate an

Просмотреть файл

@ -23,6 +23,7 @@
#include "nsMailHeaders.h"
#include "nsIPref.h"
#include "nsIServiceManager.h"
#include "nscore.h"
// For the new pref API's
static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID);

Просмотреть файл

@ -24,6 +24,7 @@
#include "mimemoz2.h"
#include "nsIMimeEmitter.h"
#include "nsRepository.h"
#include "nscore.h"
// Need this for FO_NGLAYOUT
#include "net.h"

Просмотреть файл

@ -56,7 +56,8 @@ public:
NS_IMETHOD Write(const char *aBuf,
PRUint32 aLen,
PRUint32 *aWriteLength);
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) {
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
PRUint32 *aWriteCount) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD Flush(void) {

Просмотреть файл

@ -31,7 +31,6 @@ XPIDLSRCS= \
EXPORTS = \
nsIMsgOfflineNewsState.h \
nsINNTPArticleList.h \
nsINNTPCategory.h \
nsINNTPCategoryContainer.h \
nsINNTPHost.h \

Просмотреть файл

@ -22,6 +22,7 @@
#include "nntpCore.h"
#include "nsNNTPProtocol.h"
#include "nsINNTPArticleList.h"
#include "nsIOutputStream.h"
#include "nsIInputStream.h"
#include "nsFileStream.h"

Просмотреть файл

@ -35,6 +35,7 @@
#include "nsISecurityContext.h"
#include "xpgetstr.h"
#include "lcglue.h"
#include "nscore.h"
extern "C" int XP_PROGRESS_STARTING_JAVA;
extern "C" int XP_PROGRESS_STARTING_JAVA_DONE;

Просмотреть файл

@ -216,7 +216,8 @@ public:
NS_IMETHOD
Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount);
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) {
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
PRUint32 *aWriteCount) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -21,6 +21,7 @@
#include "prlog.h"
#include "prmem.h"
#include "nscore.h"
class ns4xPluginStreamListener : public nsIPluginStreamListener {

Просмотреть файл

@ -166,7 +166,8 @@ public:
NS_IMETHOD
Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount);
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) {
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
PRUint32 *aWriteCount) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -21,6 +21,7 @@
#include "prlog.h"
#include "prmem.h"
#include "nscore.h"
class ns4xPluginStreamListener : public nsIPluginStreamListener {

Просмотреть файл

@ -166,7 +166,8 @@ public:
NS_IMETHOD
Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount);
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) {
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
PRUint32 *aWriteCount) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -216,7 +216,8 @@ public:
NS_IMETHOD
Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount);
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) {
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
PRUint32 *aWriteCount) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -676,7 +676,8 @@ public:
NS_IMETHOD
Write(const char* aBuf, PRInt32 aCount, PRInt32 *resultingCount);
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) {
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
PRUint32 *aWriteCount) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -43,7 +43,8 @@ public:
NS_IMETHOD
Write(const char* aBuf, PRInt32 aCount, PRInt32 *resultingCount);
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) {
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
PRUint32 *aWriteCount) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -26,7 +26,7 @@
#include "nsIComponentManager.h"
#include "nsNetConverterStream.h"
#include "nsCOMPtr.h"
#include "nscore.h"
static NS_DEFINE_CID(kINetPluginCID, NS_INET_PLUGIN_CID);

Просмотреть файл

@ -48,7 +48,8 @@ public:
PRUint32 aLen,
PRUint32 *aWriteLength);
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) {
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
PRUint32 *aWriteCount) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -113,7 +113,8 @@ public:
PRUint32 aLen,
PRUint32 *aWriteCount);
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) {
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
PRUint32 *aWriteCount) {
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -157,7 +158,8 @@ public:
PRUint32 aLen,
PRUint32 *aWriteLength);
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) {
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
PRUint32 *aWriteCount) {
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -203,7 +205,8 @@ public:
PRUint32 aLen,
PRUint32 *aWriteLength);
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) {
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
PRUint32 *aWriteCount) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -154,7 +154,8 @@ public:
return NS_OK;
}
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) {
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
PRUint32 *aWriteCount) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -135,7 +135,8 @@ public:
return NS_OK;
}
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount) {
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count,
PRUint32 *aWriteCount) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -19,6 +19,9 @@
/* Root idl declarations to be used by all. */
%{C++
#include "prtime.h"
/*
* Start commenting out the C++ versions of the below in the output header
*/
@ -30,6 +33,7 @@ typedef octet PRUint8 ;
typedef unsigned short PRUint16 ;
typedef unsigned long PRUint32 ;
typedef unsigned long long PRUint64 ;
typedef unsigned long long PRTime ;
typedef short PRInt16 ;
typedef long PRInt32 ;
typedef long long PRInt64 ;
@ -38,6 +42,7 @@ typedef unsigned long nsrefcnt ;
typedef unsigned long nsresult ;
[ptr] native voidStar(void);
[ptr] native charStar(char);
[ref, nsid] native nsIDRef(nsID);
[ref, nsid] native nsIIDRef(nsIID);

Просмотреть файл

@ -30,8 +30,11 @@ MODULE = xpcom
XPIDL_MODULE = xpcom_io
XPIDLSRCS = \
nsIFileSpec.idl \
XPIDLSRCS = \
nsIFileSpec.idl \
nsIBaseStream.idl \
nsIInputStream.idl \
nsIOutputStream.idl \
$(NULL)
CPPSRCS = \
@ -54,11 +57,8 @@ EXPORTS = \
nsFileSpecImpl.h \
nsFileSpecStreaming.h \
nsFileStream.h \
nsIBaseStream.h \
nsIByteBufferInputStream.h \
nsIFileStream.h \
nsIInputStream.h \
nsIOutputStream.h \
nsIStringStream.h \
nsIUnicharInputStream.h \
nsSpecialSystemDirectory.h \

Просмотреть файл

@ -29,11 +29,8 @@ EXPORTS = \
nsFileSpecImpl.h \
nsFileSpecStreaming.h \
nsFileStream.h \
nsIBaseStream.h \
nsIByteBufferInputStream.h \
nsIFileStream.h \
nsIInputStream.h \
nsIOutputStream.h \
nsIStringStream.h \
nsIUnicharInputStream.h \
nsSpecialSystemDirectory.h \
@ -42,20 +39,12 @@ EXPORTS = \
NO_XPT_GEN=1
XPIDL_MODULE = xpcom_io
XPIDLSRCS = \
.\nsIFileSpec.idl \
$(NULL)
xXPIDLSRCS = \
.\nsIUri.idl \
.\nsIUrl.idl \
.\nsIIOService.idl \
.\nsIIOSpec.idl \
.\nsIFileSpec.idl \
.\nsIStreamObserver.idl \
.\nsIBaseStream.idl \
.\nsIInputStream.idl \
.\nsIOutputStream.idl \
XPIDLSRCS = \
.\nsIFileSpec.idl \
.\nsIBaseStream.idl \
.\nsIInputStream.idl \
.\nsIOutputStream.idl \
.\nsIBufferInputStream.idl \
$(NULL)
################################################################################

Просмотреть файл

@ -189,11 +189,11 @@ NS_IMETHODIMP
nsByteBufferInputStream::Fill(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount)
{
nsDummyBufferStream in(aBuf, aCount);
return Fill(&in, aWriteCount);
return Fill(&in, aCount, aWriteCount);
}
NS_IMETHODIMP
nsByteBufferInputStream::Fill(nsIInputStream* stream, PRUint32 *aWriteCount)
nsByteBufferInputStream::Fill(nsIInputStream* stream, PRUint32 aCount, PRUint32 *aWriteCount)
{
nsresult rv = NS_OK;
@ -201,9 +201,6 @@ nsByteBufferInputStream::Fill(nsIInputStream* stream, PRUint32 *aWriteCount)
return NS_BASE_STREAM_CLOSED;
*aWriteCount = 0;
PRUint32 aCount;
rv = stream->GetLength(&aCount);
if (NS_FAILED(rv)) return rv;
if (mBlocking)
PR_CEnterMonitor(this);
@ -349,15 +346,17 @@ nsByteBufferOutputStream::Close(void)
}
NS_IMETHODIMP
nsByteBufferOutputStream::Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount)
nsByteBufferOutputStream::Write(const char* aBuf, PRUint32 aCount,
PRUint32 *aWriteCount)
{
return mInputStream->Fill(aBuf, aCount, aWriteCount);
}
NS_IMETHODIMP
nsByteBufferOutputStream::Write(nsIInputStream* fromStream, PRUint32 *aWriteCount)
nsByteBufferOutputStream::WriteFrom(nsIInputStream* fromStream, PRUint32 aCount,
PRUint32 *aWriteCount)
{
return mInputStream->Fill(fromStream, aWriteCount);
return mInputStream->Fill(fromStream, aCount, aWriteCount);
}
NS_IMETHODIMP

Просмотреть файл

@ -35,8 +35,10 @@ public:
NS_IMETHOD Close(void);
// nsIOutputStream methods:
NS_IMETHOD Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount);
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount);
NS_IMETHOD Write(const char* aBuf, PRUint32 aCount,
PRUint32 *aWriteCount);
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 aCount,
PRUint32 *aWriteCount);
NS_IMETHOD Flush(void);
// nsByteBufferOutputStream methods:
@ -62,7 +64,7 @@ public:
NS_IMETHOD Read(char* aBuf, PRUint32 aCount, PRUint32 *aReadCount);
// nsIByteBufferInputStream methods:
NS_IMETHOD Fill(nsIInputStream* stream, PRUint32 *aWriteCount);
NS_IMETHOD Fill(nsIInputStream* stream, PRUint32 aCount, PRUint32 *aWriteCount);
NS_IMETHOD Fill(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount);
// nsByteBufferInputStream methods:

Просмотреть файл

@ -0,0 +1,45 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
[scriptable, uuid(6ccb17a0-e95e-11d1-beae-00805f8a66dc)]
interface nsIBaseStream : nsISupports
{
void Close();
};
/** Error codes */
%{C++
//@{
/// End of file
#define NS_BASE_STREAM_EOF NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 1)
/// Stream closed
#define NS_BASE_STREAM_CLOSED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 2)
/// Error from the operating system
#define NS_BASE_STREAM_OSERROR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 3)
/// Illegal arguments
#define NS_BASE_STREAM_ILLEGAL_ARGS NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 4)
/// For unichar streams
#define NS_BASE_STREAM_NO_CONVERTER NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 5)
/// For unichar streams
#define NS_BASE_STREAM_BAD_CONVERSION NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 6)
#define NS_BASE_STREAM_WOULD_BLOCK NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_BASE, 7)
//@}
%}

Просмотреть файл

@ -0,0 +1,47 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsIInputStream.idl"
[scriptable, uuid(93e9a230-1955-11d3-933b-000064657374)]
interface nsIBufferInputStream : nsIInputStream
{
/**
* Returns a pointer to the buffer underlying an input stream.
* @param startPosition - the position relative to the start of
* the available data for which the segment is to be returned.
* If the startPosition is >= the available amount of data
* (returned by GetLength), NULL is returned for the bufferSegment.
* @param bufferSegment - returns the buffer, starting from the
* "read cursor" location.
* @param bufferSegmentSize - the number of contiguous bytes
* that can be read from this location.
* Note that the bufferSegmentSize may be less than the available
* amount of data (returned by GetLength) if the buffer input
* stream is internally represented by discontiguous segments.
*/
void GetBuffer(in unsigned long startPosition,
out charStar bufferSegment,
out unsigned long bufferSegmentSize);
/**
* Returns the position of a string in the buffer. Returns -1 if
* not found.
*/
long Find(in charStar aString);
};

Просмотреть файл

@ -154,7 +154,8 @@ class FileImpl
*aWriteCount = bytesWrit;
return NS_OK;
}
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount)
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 aCount,
PRUint32 *aWriteCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -0,0 +1,40 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsIBaseStream.idl"
[scriptable, uuid(022396f0-93b5-11d1-895b-006008911b81)]
interface nsIInputStream : nsIBaseStream
{
/** Return the number of bytes in the stream
* @param aLength out parameter to hold the length
* of the stream. if an error occurs, the length
* will be undefined
* @return error status
*/
unsigned long GetLength();
/** Read data from the stream.
* @param aBuf the buffer into which the data is read
* @param aCount the maximum number of bytes to read
* @return aReadCount out parameter to hold the number of
* bytes read, eof if 0. if an error occurs, the
* read count will be undefined
*/
unsigned long Read(in charStar buf, in unsigned long count);
};

Просмотреть файл

@ -0,0 +1,53 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsIBaseStream.idl"
#include "nsIInputStream.idl"
[scriptable, uuid(7f13b870-e95f-11d1-beae-00805f8a66dc)]
interface nsIOutputStream : nsIBaseStream
{
/** Write data into the stream.
* @param aBuf the buffer from which the data is read
* @param aCount the maximum number of bytes to write
* @return aWriteCount out parameter to hold the number of
* bytes written. if an error occurs, the writecount
* is undefined
*/
unsigned long Write(in string buf, in unsigned long count);
/**
* Writes data into the stream from an input stream.
* Implementer's note: This method is defined by this interface in order
* to allow the output stream to efficiently copy the data from the input
* stream into its internal buffer (if any). If this method was provide
* as an external facility, a separate char* buffer would need to be used
* in order to call the output stream's other Write method.
* @param fromStream the stream from which the data is read
* @param count the maximun number of bytes to write
* @return aWriteCount out parameter to hold the number of
* bytes written. if an error occurs, the writecount
* is undefined
*/
unsigned long WriteFrom(in nsIInputStream inStr, in unsigned long count);
/**
* Flushes the stream.
*/
void Flush();
};

Просмотреть файл

@ -110,7 +110,8 @@ class BasicStringImpl
*aWriteCount = bytesWrit;
return NS_OK;
}
NS_IMETHOD Write(nsIInputStream* fromStream, PRUint32 *aWriteCount)
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 aCount,
PRUint32 *aWriteCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -19,6 +19,8 @@
#define nsIUnicharInputStream_h___
#include "nsIInputStream.h"
#include "nscore.h"
class nsString;
#define NS_IUNICHAR_INPUT_STREAM_IID \

Просмотреть файл

@ -137,7 +137,7 @@ XPTHeader *getHeader(const char *filename, nsIAllocator *al) {
}
if (flen > 0) {
PRInt32 howmany = PR_Read(in, whole, flen);
PRUint32 howmany = PR_Read(in, whole, flen);
if (howmany < 0) {
NS_ERROR("FAILED: reading typelib file");
goto out;