[Issue 3341] Dummy stream
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Sep 22 11:44:14 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3341
David Simcha <dsimcha at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
--- Comment #1 from David Simcha <dsimcha at yahoo.com> 2009-09-22 11:44:14 PDT ---
This should do the job. I tested that it compiles, and it's pretty hard to
have a logic error given that it's supposed to do nothing. Just to make it
explicit, I hereby release the DummyStream class into the public domain, if
it's even copyrightable.
/**A dummy stream for disposing of output. Supports the interface of an
* OutputStream, simply does nothing for any method call.*/
class DummyStream : OutputStream {
this() {}
void writeExact(const void* buffer, size_t size){}
size_t write(const(ubyte)[] buffer) { return buffer.length; }
void write(byte x) {}
void write(ubyte x) {}
void write(short x) {}
void write(ushort x) {}
void write(int x) {}
void write(uint x) {}
void write(long x) {}
void write(ulong x) {}
void write(float x) {}
void write(double x) {}
void write(real x) {}
void write(ifloat x) {}
void write(idouble x) {}
void write(ireal x) {}
void write(cfloat x) {}
void write(cdouble x) {}
void write(creal x) {}
void write(char x) {}
void write(wchar x) {}
void write(dchar x) {}
void write(char[] s) {}
void write(const(wchar)[] s) {}
void writeLine(const(char)[] s) {}
void writeLineW(const(wchar)[] s) {}
void writeString(const(char)[] s) {}
void writeStringW(const(wchar)[] s) {}
size_t vprintf(char[] format, va_list args) { return 0; }
size_t printf(char[] format, ...) { return 0; }
OutputStream writef(...) { return this;}
OutputStream writefln(...) { return this; }
OutputStream writefx(TypeInfo[] arguments, void* argptr, int newline =
false) {
return this;
}
void flush() {}
void close() {}
bool isOpen() { return true; }
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list