Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
nsIStringStream.idl File Reference
import "nsIInputStream.idl";
#include "nsIInputStream.h"
#include "nsString.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

interface  nsIStringInputStream
 Based on original code from nsIStringStream.h. More...

Functions

NS_COM nsresult NS_NewStringInputStream (nsIInputStream **aStreamResult, const nsAString &aStringToRead)
NS_COM nsresult NS_NewCStringInputStream (nsIInputStream **aStreamResult, const nsACString &aStringToRead)
NS_COM nsresult NS_NewCharInputStream (nsIInputStream **aStreamResult, const char *aStringToRead)
NS_COM nsresult NS_NewByteInputStream (nsIInputStream **aStreamResult, const char *aStringToRead, PRInt32 aLength)

Function Documentation

NS_COM nsresult NS_NewByteInputStream ( nsIInputStream **  aStreamResult,
const char *  aStringToRead,
PRInt32  aLength 
)

Definition at line 396 of file nsStringStream.cpp.

{
    NS_PRECONDITION(aStreamResult, "null out ptr");

    nsStringInputStream* stream = new nsStringInputStream();
    if (! stream)
        return NS_ERROR_OUT_OF_MEMORY;

    NS_ADDREF(stream);

    nsresult rv = stream->ShareData(aStringToRead, aLength);
    
    if (NS_FAILED(rv)) {
        NS_RELEASE(stream);
        return rv;
    }
    
    *aStreamResult = stream;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_COM nsresult NS_NewCharInputStream ( nsIInputStream **  aStreamResult,
const char *  aStringToRead 
)

Definition at line 371 of file nsStringStream.cpp.

{
    NS_PRECONDITION(aStreamResult, "null out ptr");

    nsStringInputStream* stream = new nsStringInputStream();
    if (! stream)
        return NS_ERROR_OUT_OF_MEMORY;

    NS_ADDREF(stream);

    nsresult rv = stream->ShareData(aStringToRead, -1);
    
    if (NS_FAILED(rv)) {
        NS_RELEASE(stream);
        return rv;
    }
    
    *aStreamResult = stream;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_COM nsresult NS_NewCStringInputStream ( nsIInputStream **  aStreamResult,
const nsACString &  aStringToRead 
)

Definition at line 340 of file nsStringStream.cpp.

{
    NS_PRECONDITION(aStreamResult, "null out ptr");

    char* data = ToNewCString(aStringToRead);
    if (!data)
        return NS_ERROR_OUT_OF_MEMORY;

    nsStringInputStream* stream = new nsStringInputStream();
    if (! stream) {
        nsMemory::Free(data);
        return NS_ERROR_OUT_OF_MEMORY;
    }

    NS_ADDREF(stream);

    nsresult rv = stream->AdoptData(data, aStringToRead.Length());
    if (NS_FAILED(rv)) {
        nsMemory::Free(data);
        NS_RELEASE(stream);
        return rv;
    }
    
    *aStreamResult = stream;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_COM nsresult NS_NewStringInputStream ( nsIInputStream **  aStreamResult,
const nsAString &  aStringToRead 
)

Definition at line 309 of file nsStringStream.cpp.

{
    NS_PRECONDITION(aStreamResult, "null out ptr");

    char* data = ToNewCString(aStringToRead);
    if (!data)
        return NS_ERROR_OUT_OF_MEMORY;

    nsStringInputStream* stream = new nsStringInputStream();
    if (! stream) {
        nsMemory::Free(data);
        return NS_ERROR_OUT_OF_MEMORY;
    }

    NS_ADDREF(stream);

    nsresult rv = stream->AdoptData(data, aStringToRead.Length());
    if (NS_FAILED(rv)) {
        nsMemory::Free(data);
        NS_RELEASE(stream);
        return rv;
    }
    
    *aStreamResult = stream;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function: