2 #ifndef __UT_NTStreamUtil_H__
3 #define __UT_NTStreamUtil_H__
24 #define NTBinaryMode std::ios::binary
26 #define NTBinaryMode ((std::ios::openmode)0)
29 #define UT_NoCreate ((std::ios::openmode)0)
44 void *getNewNamedPipe(
char *pipeName );
46 UT_API FILE *UnixPWrite(
const char *cmd,
const char *file );
47 UT_API FILE *UnixPOpen(
const char *file,
const char *
mode );
48 UT_API void *UnixPOpen(
const char *file,
void **
in,
void **out,
50 UT_API int UnixPClose( FILE *file,
int block );
51 inline FILE *popen(
const char *
name,
const char *
mode )
52 {
return UnixPOpen( name, mode ); }
53 inline int pclose( FILE *
f,
int block = 1 )
54 {
return UnixPClose( f, block ); }
56 UT_API const char *UTgetSocketErrorString(
int err);
58 UT_API bool UTconvertShellToWindowsProcessCommand(
87 int_type overflow(int_type
c)
override;
90 pos_type seekoff(off_type _Off,
91 std::ios_base::seekdir _Way,
92 std::ios_base::openmode
93 _Mode = std::ios::out)
override;
94 pos_type seekpos(pos_type _Off,
95 std::ios_base::openmode
96 _Mode = std::ios::out)
override;
99 std::streamsize xsputn(
const char*
s, std::streamsize
num)
override;
111 myOwnBuf = !isfrozen;
121 bool resizeBuf(
exint minnewsize);
144 std::ios::openmode = std::ios::out);
153 char *
str() {
return myBuf.str(); }
154 void freeze(
bool isfrozen) { myBuf.freeze(isfrozen); }
158 return myBuf.pcount();
188 std::ostream &getStream();
191 void copyStream( std::ostream &out );
201 std::fstream *myFileStream;
205 #define DECLARE_PORTABLE_RW(type) \
206 UT_API UT_OStream &UTwrite( \
207 UT_OStream &os, const type *src, int64 numelem = 1); \
208 UT_API std::ostream &UTwrite( \
209 std::ostream &os, const type *src, int64 numelem = 1); \
210 UT_API int64 UTfread( FILE *f, type *dest, int64 numelem = 1 ); \
211 UT_API int64 UTfwrite( FILE *f, const type *src, int64 numelem = 1 ); \
222 #undef DECLARE_PORTABLE_RW
227 #define DECLARE_CONVERTIBLE_RW(T) \
228 template <typename DEST_TYPE> UT_API \
229 UT_OStream & UTwrite(UT_OStream &os, const T *src, int64 cnt = 1); \
230 template <typename DEST_TYPE> UT_API \
231 std::ostream & UTwrite(std::ostream &os, const T *src, int64 cnt = 1); \
232 template <typename DEST_TYPE> UT_API \
233 int64 UTfread(FILE *f, T *dest, int64 cnt = 1); \
234 template <typename DEST_TYPE> UT_API \
235 int64 UTfwrite(FILE *f, const T *src, int64 cnt = 1); \
251 std::ostream &os,
const char *data,
int64 size,
254 std::ostream &os,
const std::
string &data,
293 {
return buffer_size; }
308 virtual int doFilterChunk(
char *
buffer,
int data_size,
309 int buffer_size ) = 0;
332 size_t maxlen = ((
size_t)-1),
335 size_t maxlen = ((
size_t)-1),
370 #endif // __UT_NTStreamUtil_H__
UT_API void UTbuildDOSCommandLine(char *dest, const char *const *args)
UT_API void UTcreateTempFileName(UT_String &tempfile, const char *matchExt=0)
void freeze(bool isfrozen)
GT_API const UT_StringHolder filename
UT_OStrStreamBuf * rdbuf()
UT_API bool UTisDataAvailableOnStdin()
virtual int getDataChunkLength(int buffer_size)
virtual int endFilter(char *, int)
void freeze(bool isfrozen)
An output stream object that owns its own string buffer storage.
virtual ~UT_StreamBufferFilter()
GLuint const GLchar * name
unsigned long long uint64
UT_API bool UTisStdinValid()
virtual int beginFilter(char *, int, int)
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
UT_API bool UTcopyStreamToStream(std::istream &is, std::ostream &os, size_t maxlen=((size_t)-1), UT_StreamBufferFilter *filter=NULL)
UT_API bool UTisDataAvailableOnFD(int fd)
#define DECLARE_CONVERTIBLE_RW(T)
UT_API void UTsaveStringBinary(std::ostream &os, const char *str, UT_STRING_BINARY_IO minbits)
UT_API void UTwaitForTimeoutOrDataOnFD(long clock_ticks, int fd)
SYS_FORCE_INLINE const char * c_str() const
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLenum GLuint GLenum GLsizei const GLchar * buf
UT_API void UTsaveDataBinary(UT_OStream &os, const char *data, int64 size, UT_STRING_BINARY_IO minbits=UT_STRING_16BIT_IO)
**If you just want to fire and args
#define DECLARE_PORTABLE_RW(type)
~UT_OStrStream() override
UT_API bool UTcreateDirectoryForFile(const char *filename)
UT_API uint64 UTgetNBytesToSaveStringBinary(uint64 stringlength, UT_STRING_BINARY_IO minbits)
UT_API void UTwaitForTimeoutOrDataOnStdin(long clock_ticks)
UT_API bool UTwriteFiltered(std::ostream &os, const char *data, int size, UT_StreamBufferFilter *filter)