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:
rods%netscape.com 1999-03-19 15:53:07 +00:00
Родитель dcdc02d44e
Коммит f33501ef59
4 изменённых файлов: 30 добавлений и 2 удалений

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

@ -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