aboutsummaryrefslogtreecommitdiff
path: root/CPP/Common/StdOutStream.h
diff options
context:
space:
mode:
authorIgor Pavlov <87184205+ip7z@users.noreply.github.com>2021-12-27 00:00:00 +0000
committerIgor Pavlov <87184205+ip7z@users.noreply.github.com>2022-03-18 15:35:13 +0500
commitf19f813537c7aea1c20749c914e756b54a9c3cf5 (patch)
tree816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /CPP/Common/StdOutStream.h
parent98e06a519b63b81986abe76d28887f6984a7732b (diff)
download7zip-21.07.tar.gz
7zip-21.07.tar.bz2
7zip-21.07.zip
'21.07'21.07
Diffstat (limited to 'CPP/Common/StdOutStream.h')
-rw-r--r--CPP/Common/StdOutStream.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/CPP/Common/StdOutStream.h b/CPP/Common/StdOutStream.h
new file mode 100644
index 0000000..93f1dfa
--- /dev/null
+++ b/CPP/Common/StdOutStream.h
@@ -0,0 +1,76 @@
1// Common/StdOutStream.h
2
3#ifndef __COMMON_STD_OUT_STREAM_H
4#define __COMMON_STD_OUT_STREAM_H
5
6#include <stdio.h>
7
8#include "MyString.h"
9#include "MyTypes.h"
10
11class CStdOutStream
12{
13 FILE *_stream;
14 bool _streamIsOpen;
15public:
16 bool IsTerminalMode;
17 int CodePage;
18
19 CStdOutStream(FILE *stream = 0):
20 _stream(stream),
21 _streamIsOpen(false),
22 IsTerminalMode(false),
23 CodePage(-1)
24 {};
25
26 ~CStdOutStream() { Close(); }
27
28 // void AttachStdStream(FILE *stream) { _stream = stream; _streamIsOpen = false; }
29 // bool IsDefined() const { return _stream != NULL; }
30
31 operator FILE *() { return _stream; }
32 bool Open(const char *fileName) throw();
33 bool Close() throw();
34 bool Flush() throw();
35
36 CStdOutStream & operator<<(CStdOutStream & (* func)(CStdOutStream &))
37 {
38 (*func)(*this);
39 return *this;
40 }
41
42 CStdOutStream & operator<<(const char *s) throw()
43 {
44 fputs(s, _stream);
45 return *this;
46 }
47
48 CStdOutStream & operator<<(char c) throw()
49 {
50 fputc((unsigned char)c, _stream);
51 return *this;
52 }
53
54 CStdOutStream & operator<<(Int32 number) throw();
55 CStdOutStream & operator<<(Int64 number) throw();
56 CStdOutStream & operator<<(UInt32 number) throw();
57 CStdOutStream & operator<<(UInt64 number) throw();
58
59 CStdOutStream & operator<<(const wchar_t *s);
60 void PrintUString(const UString &s, AString &temp);
61 void Convert_UString_to_AString(const UString &src, AString &dest);
62
63 void Normalize_UString__LF_Allowed(UString &s);
64 void Normalize_UString(UString &s);
65
66 void NormalizePrint_UString(const UString &s, UString &tempU, AString &tempA);
67 void NormalizePrint_UString(const UString &s);
68 void NormalizePrint_wstr(const wchar_t *s);
69};
70
71CStdOutStream & endl(CStdOutStream & outStream) throw();
72
73extern CStdOutStream g_StdOut;
74extern CStdOutStream g_StdErr;
75
76#endif