14 #ifndef PANDAFILESTREAMBUF_H 15 #define PANDAFILESTREAMBUF_H 19 #ifdef USE_PANDAFILESTREAM 22 #ifndef WIN32_LEAN_AND_MEAN 23 #define WIN32_LEAN_AND_MEAN 1 31 class EXPCL_DTOOL_DTOOLUTIL PandaFileStreamBuf :
public std::streambuf {
34 virtual ~PandaFileStreamBuf();
36 void open(
const char *filename, std::ios::openmode mode);
38 void attach(
const char *filename, HANDLE handle, std::ios::openmode mode);
40 void attach(
const char *filename,
int fd, std::ios::openmode mode);
53 static NewlineMode _newline_mode;
56 virtual std::streampos seekoff(std::streamoff off, ios_seekdir dir, ios_openmode which);
57 virtual std::streampos seekpos(std::streampos pos, ios_openmode which);
59 virtual int overflow(
int c);
61 virtual int underflow();
64 size_t read_chars(
char *start,
size_t length);
65 size_t write_chars(
const char *start,
size_t length);
67 size_t read_chars_raw(
char *start,
size_t length);
68 size_t write_chars_raw(
const char *start,
size_t length);
70 size_t decode_newlines(
char *dest,
size_t dest_length,
71 const char *source,
size_t source_length);
73 size_t encode_newlines_msdos(
char *dest,
size_t dest_length,
74 const char *source,
size_t source_length);
75 size_t encode_newlines_unix(
char *dest,
size_t dest_length,
76 const char *source,
size_t source_length);
77 size_t encode_newlines_mac(
char *dest,
size_t dest_length,
78 const char *source,
size_t source_length);
81 std::string _filename;
83 std::ios::openmode _open_mode;
98 EXPCL_DTOOL_DTOOLUTIL std::ostream &
99 operator << (std::ostream &out, PandaFileStreamBuf::NewlineMode newline_mode);
101 EXPCL_DTOOL_DTOOLUTIL std::istream &
102 operator >> (std::istream &in, PandaFileStreamBuf::NewlineMode &newline_mode);
104 #endif // USE_PANDAFILESTREAM