reference: OutFilterStream example without output stream

git-svn-id: svn://ultimatepp.org/upp/trunk@7416 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-06-05 11:10:21 +00:00
parent 4e3b601d57
commit 9258427048
2 changed files with 22 additions and 2 deletions

View file

@ -2,6 +2,18 @@
using namespace Upp;
String data;
void AnythingPut(const void *ptr, int count)
{
data.Cat((const char *)ptr, count);
}
void AnythingEnd()
{
LOG("----- STREAM CLOSED");
}
CONSOLE_APP_MAIN
{
String path = GetHomeDirFile("test.gz");
@ -22,7 +34,7 @@ CONSOLE_APP_MAIN
LOG(in.GetLine());
}
{
{ // In this case we are using InFilterStream without input stream to represent HttpRequest as input stream
HttpRequest http("www.ultimatepp.org");
InFilterStream in;
http.WhenContent = callback(&in, &InFilterStream::Out);
@ -31,4 +43,12 @@ CONSOLE_APP_MAIN
while(!in.IsEof())
LOG(in.GetLine());
}
{ // In this case we are using OutFilterStream without out stream to represent anything with Put as stream
OutFilterStream out;
out.Filter = callback(AnythingPut);
out.End = callback(AnythingEnd);
out << "Hello world!";
}
LOG(data);
}

View file

@ -12,7 +12,7 @@ GUI_APP_MAIN
Report report;
report.OnPage(callback1(DrawWatermark, &report)); // called after new page is created
for(int i = 0; i < 100; i++) {
report << "{{1:1:1@N Report:: with:: Watermark}}"; // Need to use @n to make table background transparent
report << "{{1:1:1@N Report:: with:: Watermark}}"; // Need to use @N to make table background transparent
report << "Report with Watermark";
}
Perform(report);