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(
93 pos_type seekoff(off_type _Off,
94 std::ios_base::seekdir _Way,
95 std::ios_base::openmode
96 _Mode = std::ios::out)
override;
97 pos_type seekpos(pos_type _Off,
98 std::ios_base::openmode
99 _Mode = std::ios::out)
override;
102 std::streamsize xsputn(
const char*
s, std::streamsize num)
override;
114 myOwnBuf = !isfrozen;
124 bool resizeBuf(
exint minnewsize);
147 std::ios::openmode = std::ios::out);
159 char *
str() {
return myBuf.str(); }
160 void freeze(
bool isfrozen) { myBuf.freeze(isfrozen); }
164 return myBuf.pcount();
195 std::ostream &getStream();
198 void copyStream( std::ostream &out );
208 std::fstream *myFileStream;
212 #define DECLARE_PORTABLE_RW(type) \
213 UT_API UT_OStream &UTwrite( \
214 UT_OStream &os, const type *src, int64 numelem = 1); \
215 UT_API std::ostream &UTwrite( \
216 std::ostream &os, const type *src, int64 numelem = 1); \
217 UT_API int64 UTfread( FILE *f, type *dest, int64 numelem = 1 ); \
218 UT_API int64 UTfwrite( FILE *f, const type *src, int64 numelem = 1 ); \
229 #undef DECLARE_PORTABLE_RW
234 #define DECLARE_CONVERTIBLE_RW(T) \
235 template <typename DEST_TYPE> UT_API \
236 UT_OStream & UTwrite(UT_OStream &os, const T *src, int64 cnt = 1); \
237 template <typename DEST_TYPE> UT_API \
238 std::ostream & UTwrite(std::ostream &os, const T *src, int64 cnt = 1); \
239 template <typename DEST_TYPE> UT_API \
240 int64 UTfread(FILE *f, T *dest, int64 cnt = 1); \
241 template <typename DEST_TYPE> UT_API \
242 int64 UTfwrite(FILE *f, const T *src, int64 cnt = 1); \
258 std::ostream &os, const
char *data,
int64 size,
261 std::ostream &os, const std::
string &data,
303 {
return buffer_size; }
318 virtual int doFilterChunk(
char *
buffer,
int data_size,
319 int buffer_size ) = 0;
342 size_t maxlen = ((
size_t)-1),
345 size_t maxlen = ((
size_t)-1),
380 #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)
GLenum GLuint GLenum GLsizei const GLchar * buf
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.
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
GLuint const GLchar * name
UT_API void UTsaveDataBinary(UT_OStream &os, const char *data, int64 size, UT_STRING_BINARY_IO minbits=UT_STRING_16BIT_IO)
LeafData & operator=(const LeafData &)=delete
**If you just want to fire and args
#define DECLARE_PORTABLE_RW(type)
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)
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter