7zip/CPP/Common/StdOutStream.h

88 lines
2 KiB
C
Raw Normal View History

2021-12-27 01:00:00 +01:00
// Common/StdOutStream.h
2023-06-21 02:00:00 +02:00
#ifndef ZIP7_INC_COMMON_STD_OUT_STREAM_H
#define ZIP7_INC_COMMON_STD_OUT_STREAM_H
2021-12-27 01:00:00 +01:00
#include <stdio.h>
#include "MyString.h"
#include "MyTypes.h"
class CStdOutStream
{
FILE *_stream;
2023-06-21 02:00:00 +02:00
// bool _streamIsOpen;
2021-12-27 01:00:00 +01:00
public:
bool IsTerminalMode;
2024-05-14 02:00:00 +02:00
CBoolPair ListPathSeparatorSlash;
2021-12-27 01:00:00 +01:00
int CodePage;
2023-06-21 02:00:00 +02:00
CStdOutStream(FILE *stream = NULL):
2021-12-27 01:00:00 +01:00
_stream(stream),
2023-06-21 02:00:00 +02:00
// _streamIsOpen(false),
2021-12-27 01:00:00 +01:00
IsTerminalMode(false),
CodePage(-1)
2024-05-14 02:00:00 +02:00
{
ListPathSeparatorSlash.Val =
#ifdef _WIN32
false;
#else
true;
#endif
}
2021-12-27 01:00:00 +01:00
2023-06-21 02:00:00 +02:00
// ~CStdOutStream() { Close(); }
2021-12-27 01:00:00 +01:00
// void AttachStdStream(FILE *stream) { _stream = stream; _streamIsOpen = false; }
// bool IsDefined() const { return _stream != NULL; }
operator FILE *() { return _stream; }
2023-06-21 02:00:00 +02:00
/*
2021-12-27 01:00:00 +01:00
bool Open(const char *fileName) throw();
bool Close() throw();
2023-06-21 02:00:00 +02:00
*/
2021-12-27 01:00:00 +01:00
bool Flush() throw();
CStdOutStream & operator<<(CStdOutStream & (* func)(CStdOutStream &))
{
(*func)(*this);
return *this;
}
CStdOutStream & operator<<(const char *s) throw()
{
fputs(s, _stream);
return *this;
}
CStdOutStream & operator<<(char c) throw()
{
fputc((unsigned char)c, _stream);
return *this;
}
CStdOutStream & operator<<(Int32 number) throw();
CStdOutStream & operator<<(Int64 number) throw();
CStdOutStream & operator<<(UInt32 number) throw();
CStdOutStream & operator<<(UInt64 number) throw();
CStdOutStream & operator<<(const wchar_t *s);
void PrintUString(const UString &s, AString &temp);
void Convert_UString_to_AString(const UString &src, AString &dest);
void Normalize_UString(UString &s);
2024-05-14 02:00:00 +02:00
void Normalize_UString_Path(UString &s);
2021-12-27 01:00:00 +01:00
2024-05-14 02:00:00 +02:00
void NormalizePrint_UString_Path(const UString &s, UString &tempU, AString &tempA);
void NormalizePrint_UString_Path(const UString &s);
2021-12-27 01:00:00 +01:00
void NormalizePrint_UString(const UString &s);
2024-05-14 02:00:00 +02:00
void NormalizePrint_wstr_Path(const wchar_t *s);
2021-12-27 01:00:00 +01:00
};
CStdOutStream & endl(CStdOutStream & outStream) throw();
extern CStdOutStream g_StdOut;
extern CStdOutStream g_StdErr;
#endif