not sure if this is the _best_ way to solve the problem, but I added a c-string version of |NS_NewStringInputStream|, which can't use overloading since it's |extern "C"|, so I named it |NS_NewCStringInputStream|.
git-svn-id: svn://10.0.0.236/trunk@64905 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
196674549e
commit
15e1919c91
@ -265,6 +265,12 @@ class ConstStringImpl
|
||||
{
|
||||
}
|
||||
|
||||
ConstStringImpl(const nsCString& inString)
|
||||
: ConstCharImpl(inString.ToNewCString(),
|
||||
inString.Length())
|
||||
{
|
||||
}
|
||||
|
||||
~ConstStringImpl()
|
||||
{
|
||||
Recycle((char*)mConstString);
|
||||
@ -381,6 +387,27 @@ extern "C" NS_COM nsresult NS_NewStringInputStream(
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
extern "C" NS_COM nsresult NS_NewCStringInputStream(
|
||||
nsISupports** aStreamResult,
|
||||
const nsCString& aStringToRead)
|
||||
// Factory method to get an nsInputStream from a cstring. Result will implement all the
|
||||
// file stream interfaces in nsIFileStream.h
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
NS_PRECONDITION(aStreamResult != nsnull, "null ptr");
|
||||
if (! aStreamResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
ConstStringImpl* stream = new ConstStringImpl(aStringToRead);
|
||||
if (! stream)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(stream);
|
||||
*aStreamResult = (nsISupports*)(void*)stream;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
extern "C" NS_COM nsresult NS_NewStringOutputStream(
|
||||
nsISupports** aStreamResult,
|
||||
|
||||
@ -33,6 +33,13 @@ extern "C" NS_COM nsresult NS_NewStringInputStream(
|
||||
// Factory method to get an nsInputStream from a string. Result will implement all the
|
||||
// file stream interfaces in nsIFileStream.h
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
extern "C" NS_COM nsresult NS_NewCStringInputStream(
|
||||
nsISupports** aStreamResult,
|
||||
const nsCString& aStringToRead);
|
||||
// Factory method to get an nsInputStream from a cstring. Result will implement all the
|
||||
// file stream interfaces in nsIFileStream.h
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
extern "C" NS_COM nsresult NS_NewStringOutputStream(
|
||||
nsISupports** aStreamResult,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user