зеркало из https://github.com/mozilla/gecko-dev.git
Added nsString, so the conversion goes to a string and to a stream
Eventually, we will want it to just go to a string.
This commit is contained in:
Родитель
dcdc02d44e
Коммит
f33501ef59
|
@ -423,6 +423,12 @@ void nsHTMLToTXTSinkStream::UnicodeToTXTString(const nsString& aSrc)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLToTXTSinkStream::GetStringBuffer(nsString & aStrBuffer)
|
||||
{
|
||||
aStrBuffer = mStrBuffer;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -449,6 +455,7 @@ nsHTMLToTXTSinkStream::AddLeaf(const nsIParserNode& aNode, ostream& aStream)
|
|||
|
||||
UnicodeToTXTString(text);
|
||||
aStream << mBuffer;
|
||||
mStrBuffer.Append(mBuffer);
|
||||
mColPos += text.Length();
|
||||
}
|
||||
else if (type == eHTMLTag_whitespace)
|
||||
|
@ -458,6 +465,7 @@ nsHTMLToTXTSinkStream::AddLeaf(const nsIParserNode& aNode, ostream& aStream)
|
|||
const nsString& text = aNode.GetText();
|
||||
UnicodeToTXTString(text);
|
||||
aStream << mBuffer;
|
||||
mStrBuffer.Append(mBuffer);
|
||||
mColPos += text.Length();
|
||||
}
|
||||
}
|
||||
|
@ -466,6 +474,7 @@ nsHTMLToTXTSinkStream::AddLeaf(const nsIParserNode& aNode, ostream& aStream)
|
|||
if (PR_TRUE)
|
||||
{
|
||||
aStream << endl;
|
||||
mStrBuffer.Append("\n");
|
||||
mColPos += 1;
|
||||
}
|
||||
}
|
||||
|
@ -543,7 +552,9 @@ nsHTMLToTXTSinkStream::CloseContainer(const nsIParserNode& aNode){
|
|||
{
|
||||
if (mColPos != 0)
|
||||
{
|
||||
*mOutput << endl;
|
||||
if (mOutput)
|
||||
*mOutput << endl;
|
||||
mStrBuffer.Append("\n");
|
||||
mColPos = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ class nsHTMLToTXTSinkStream : public nsIHTMLContentSink {
|
|||
virtual ~nsHTMLToTXTSinkStream();
|
||||
|
||||
NS_IMETHOD_(void) SetOutputStream(ostream& aStream);
|
||||
NS_IMETHOD GetStringBuffer(nsString & aStrBuffer);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -124,6 +125,8 @@ protected:
|
|||
char* mBuffer;
|
||||
PRInt32 mBufferSize;
|
||||
|
||||
nsString mStrBuffer;
|
||||
|
||||
};
|
||||
|
||||
extern NS_HTMLPARS nsresult
|
||||
|
|
|
@ -423,6 +423,12 @@ void nsHTMLToTXTSinkStream::UnicodeToTXTString(const nsString& aSrc)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLToTXTSinkStream::GetStringBuffer(nsString & aStrBuffer)
|
||||
{
|
||||
aStrBuffer = mStrBuffer;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -449,6 +455,7 @@ nsHTMLToTXTSinkStream::AddLeaf(const nsIParserNode& aNode, ostream& aStream)
|
|||
|
||||
UnicodeToTXTString(text);
|
||||
aStream << mBuffer;
|
||||
mStrBuffer.Append(mBuffer);
|
||||
mColPos += text.Length();
|
||||
}
|
||||
else if (type == eHTMLTag_whitespace)
|
||||
|
@ -458,6 +465,7 @@ nsHTMLToTXTSinkStream::AddLeaf(const nsIParserNode& aNode, ostream& aStream)
|
|||
const nsString& text = aNode.GetText();
|
||||
UnicodeToTXTString(text);
|
||||
aStream << mBuffer;
|
||||
mStrBuffer.Append(mBuffer);
|
||||
mColPos += text.Length();
|
||||
}
|
||||
}
|
||||
|
@ -466,6 +474,7 @@ nsHTMLToTXTSinkStream::AddLeaf(const nsIParserNode& aNode, ostream& aStream)
|
|||
if (PR_TRUE)
|
||||
{
|
||||
aStream << endl;
|
||||
mStrBuffer.Append("\n");
|
||||
mColPos += 1;
|
||||
}
|
||||
}
|
||||
|
@ -543,7 +552,9 @@ nsHTMLToTXTSinkStream::CloseContainer(const nsIParserNode& aNode){
|
|||
{
|
||||
if (mColPos != 0)
|
||||
{
|
||||
*mOutput << endl;
|
||||
if (mOutput)
|
||||
*mOutput << endl;
|
||||
mStrBuffer.Append("\n");
|
||||
mColPos = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ class nsHTMLToTXTSinkStream : public nsIHTMLContentSink {
|
|||
virtual ~nsHTMLToTXTSinkStream();
|
||||
|
||||
NS_IMETHOD_(void) SetOutputStream(ostream& aStream);
|
||||
NS_IMETHOD GetStringBuffer(nsString & aStrBuffer);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -124,6 +125,8 @@ protected:
|
|||
char* mBuffer;
|
||||
PRInt32 mBufferSize;
|
||||
|
||||
nsString mStrBuffer;
|
||||
|
||||
};
|
||||
|
||||
extern NS_HTMLPARS nsresult
|
||||
|
|
Загрузка…
Ссылка в новой задаче