mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-28 06:12:53 -06:00
.tutorial
git-svn-id: svn://ultimatepp.org/upp/trunk@11482 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
8fa242b083
commit
08d5d416e0
5 changed files with 210 additions and 0 deletions
49
tutorial/CoreTutorial/SpecialStream.cpp
Normal file
49
tutorial/CoreTutorial/SpecialStream.cpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#include "Tutorial.h"
|
||||
|
||||
void SpecialStream()
|
||||
{
|
||||
/// .Special streams
|
||||
SizeStream szs;
|
||||
szs << "1234567";
|
||||
DUMP(szs.GetSize());
|
||||
|
||||
///
|
||||
|
||||
StringStream in("123456");
|
||||
CompareStream cs(in);
|
||||
cs.Put("12345");
|
||||
DUMP(cs.IsEqual());
|
||||
cs.Put("7");
|
||||
DUMP(cs.IsEqual());
|
||||
|
||||
///
|
||||
|
||||
struct MyOutStream : OutStream {
|
||||
virtual void Out(const void *data, dword size) {
|
||||
DUMPHEX(String((const char *)data, size));
|
||||
}
|
||||
};
|
||||
|
||||
MyOutStream os;
|
||||
os << "This is a test " << 12345;
|
||||
os.Close();
|
||||
|
||||
///
|
||||
|
||||
StringStream ss1;
|
||||
StringStream ss2;
|
||||
TeeStream tee(ss1, ss2);
|
||||
tee << "Tee stream test";
|
||||
tee.Close();
|
||||
DUMP(ss1.GetResult());
|
||||
DUMP(ss2.GetResult());
|
||||
|
||||
///
|
||||
|
||||
static const char s[] = "Some line\nAnother line";
|
||||
MemReadStream ms(s, sizeof(os));
|
||||
while(!ms.IsEof())
|
||||
DUMP(ms.GetLine());
|
||||
|
||||
///
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue