Files
tp/include/JSystem/JSupport/JSUOutputStream.h
T
Luke Street 6a48380461 More GCC compatibility/warning fixes (#3118)
* Wrap >4-char literals in a MULTI_CHAR macro

Modern compilers do not support CW's non-standard behavior with
>4 char literals. We can, however, use a constexpr function to
compute the u64 values directly. This leaves <=4 char literals
unchanged.

* Replace non-pointer usages of NULL with 0

* Define NULL to nullptr on C++11 and above

* Fix more -Wpointer-arith and -Woverflow warnings

* Replace u32/s32 with uintptr_t/intptr_t where appropriate

* JSUOutputStream: Overload all standard int types
2026-02-28 20:19:17 -08:00

47 lines
1.1 KiB
C++

#ifndef JSUOUTPUTSTREAM_H
#define JSUOUTPUTSTREAM_H
#include "JSystem/JSupport/JSUIosBase.h"
/**
* @ingroup jsystem-jsupport
*
*/
class JSUOutputStream : public JSUIosBase {
public:
JSUOutputStream() {}
virtual ~JSUOutputStream();
virtual s32 skip(s32, s8);
virtual s32 writeData(const void*, s32) = 0;
s32 write(const void*, s32);
void write(const char*);
#define JSU_OUTPUTSTREAM_OPERATOR(T) \
JSUOutputStream& operator<<(T val) { \
write(&val, sizeof(T)); \
return *this; \
}
JSU_OUTPUTSTREAM_OPERATOR(signed char)
JSU_OUTPUTSTREAM_OPERATOR(unsigned char)
JSU_OUTPUTSTREAM_OPERATOR(signed short)
JSU_OUTPUTSTREAM_OPERATOR(unsigned short)
JSU_OUTPUTSTREAM_OPERATOR(int)
JSU_OUTPUTSTREAM_OPERATOR(unsigned int)
JSU_OUTPUTSTREAM_OPERATOR(signed long)
JSU_OUTPUTSTREAM_OPERATOR(unsigned long)
JSU_OUTPUTSTREAM_OPERATOR(signed long long)
JSU_OUTPUTSTREAM_OPERATOR(unsigned long long)
#undef JSU_OUTPUTSTREAM_OPERATOR
JSUOutputStream& operator<<(const char* param_0) {
write(param_0);
return *this;
}
}; // Size = 0x8
#endif /* JSUOUTPUTSTREAM_H */