mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
more new stuff
This commit is contained in:
parent
730e152cba
commit
d2fafbffad
54
dtool/src/dtoolutil/pfstreamBuf.cxx
Normal file
54
dtool/src/dtoolutil/pfstreamBuf.cxx
Normal file
@ -0,0 +1,54 @@
|
||||
// Filename: pfstreamBuf.cxx
|
||||
// Created by: cary (12Dec00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pfstreamBuf.h"
|
||||
|
||||
#ifndef HAVE_STREAMSIZE
|
||||
// Some compilers (notably SGI) don't define this for us
|
||||
typedef int streamsize;
|
||||
#endif /* HAVE_STREAMSIZE */
|
||||
|
||||
PipeStreamBuf::PipeStreamBuf(void) {
|
||||
#ifndef WIN32_VC
|
||||
// taken from Dr. Ose.
|
||||
// These lines, which are essential on Irix and Linux, seem to be
|
||||
// unnecessary and not understood on Windows.
|
||||
allocate();
|
||||
setp(base(), ebuf());
|
||||
#endif /* WIN32_VC */
|
||||
}
|
||||
|
||||
PipeStreamBuf::~PipeStreamBuf(void) {
|
||||
sync();
|
||||
// any other cleanup needed (pclose, etc)
|
||||
}
|
||||
|
||||
void PipeStreamBuf::flush(void) {
|
||||
// if there's anything to do here
|
||||
}
|
||||
|
||||
int PipeStreamBuf::overflow(int c) {
|
||||
streamsize n = pptr() - pbase();
|
||||
if (n != 0) {
|
||||
write_chars(pbase(), n, false);
|
||||
pbump(-n); // reset pptr()
|
||||
}
|
||||
if (c != EOF) {
|
||||
// write one more character
|
||||
char ch = c;
|
||||
write_chars(&ch, 1, false);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PipeStreamBuf::sync(void) {
|
||||
streamsize n = pptr() - pbase();
|
||||
write_chars(pbase(), n, false);
|
||||
pbump(-n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PipeStreamBuf::underflow(void) {
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user