catboost 1.25.1 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/DEPLOYMENT.md +22 -15
  2. package/README.md +37 -27
  3. package/binding.gyp +5 -7
  4. package/build_scripts/bootstrap.js +2 -1
  5. package/build_scripts/out/build.js +46 -68
  6. package/build_scripts/out/build_model.js +1 -1
  7. package/build_scripts/out/{build_ya.js → build_native.js} +1 -1
  8. package/build_scripts/out/ci.js +5 -5
  9. package/build_scripts/out/config.js +32 -18
  10. package/build_scripts/out/install.js +5 -3
  11. package/build_scripts/out/package_prepublish.js +1 -1
  12. package/build_scripts/out/packaging.js +1 -19
  13. package/build_scripts/out/run_tests.js +1 -1
  14. package/build_scripts/out/test.js +8 -3
  15. package/config.json +18 -11
  16. package/inc/catboost/libs/model_interface/c_api.h +349 -3
  17. package/lib/catboost.d.ts +65 -21
  18. package/package.json +4 -4
  19. package/src/api_helpers.cpp +100 -24
  20. package/src/api_helpers.h +8 -7
  21. package/src/api_module.cpp +1 -2
  22. package/src/model.cpp +483 -83
  23. package/src/model.h +24 -9
  24. package/inc/contrib/libs/cxxsupp/system_stl/include/stlfwd +0 -14
  25. package/inc/util/charset/recode_result.h +0 -9
  26. package/inc/util/charset/unicode_table.h +0 -123
  27. package/inc/util/charset/unidata.h +0 -421
  28. package/inc/util/charset/utf8.h +0 -384
  29. package/inc/util/charset/wide.h +0 -843
  30. package/inc/util/charset/wide_specific.h +0 -22
  31. package/inc/util/datetime/base.h +0 -669
  32. package/inc/util/datetime/constants.h +0 -7
  33. package/inc/util/datetime/cputimer.h +0 -124
  34. package/inc/util/datetime/parser.h +0 -292
  35. package/inc/util/datetime/systime.h +0 -47
  36. package/inc/util/datetime/uptime.h +0 -8
  37. package/inc/util/digest/city.h +0 -88
  38. package/inc/util/digest/fnv.h +0 -73
  39. package/inc/util/digest/multi.h +0 -14
  40. package/inc/util/digest/murmur.h +0 -57
  41. package/inc/util/digest/numeric.h +0 -86
  42. package/inc/util/digest/sequence.h +0 -48
  43. package/inc/util/draft/date.h +0 -129
  44. package/inc/util/draft/datetime.h +0 -184
  45. package/inc/util/draft/enum.h +0 -136
  46. package/inc/util/draft/holder_vector.h +0 -102
  47. package/inc/util/draft/ip.h +0 -131
  48. package/inc/util/draft/matrix.h +0 -108
  49. package/inc/util/draft/memory.h +0 -40
  50. package/inc/util/folder/dirent_win.h +0 -46
  51. package/inc/util/folder/dirut.h +0 -121
  52. package/inc/util/folder/filelist.h +0 -81
  53. package/inc/util/folder/fts.h +0 -108
  54. package/inc/util/folder/iterator.h +0 -109
  55. package/inc/util/folder/lstat_win.h +0 -20
  56. package/inc/util/folder/path.h +0 -225
  57. package/inc/util/folder/pathsplit.h +0 -113
  58. package/inc/util/folder/tempdir.h +0 -42
  59. package/inc/util/generic/adaptor.h +0 -134
  60. package/inc/util/generic/algorithm.h +0 -765
  61. package/inc/util/generic/array_ref.h +0 -282
  62. package/inc/util/generic/array_size.h +0 -24
  63. package/inc/util/generic/benchmark/vector_count_ctor/f.h +0 -9
  64. package/inc/util/generic/bitmap.h +0 -1115
  65. package/inc/util/generic/bitops.h +0 -459
  66. package/inc/util/generic/bt_exception.h +0 -24
  67. package/inc/util/generic/buffer.h +0 -232
  68. package/inc/util/generic/cast.h +0 -176
  69. package/inc/util/generic/deque.h +0 -24
  70. package/inc/util/generic/explicit_type.h +0 -42
  71. package/inc/util/generic/fastqueue.h +0 -55
  72. package/inc/util/generic/flags.h +0 -244
  73. package/inc/util/generic/function.h +0 -103
  74. package/inc/util/generic/fwd.h +0 -171
  75. package/inc/util/generic/guid.h +0 -61
  76. package/inc/util/generic/hash.h +0 -2032
  77. package/inc/util/generic/hash_primes.h +0 -140
  78. package/inc/util/generic/hash_set.h +0 -490
  79. package/inc/util/generic/hide_ptr.h +0 -3
  80. package/inc/util/generic/intrlist.h +0 -876
  81. package/inc/util/generic/is_in.h +0 -53
  82. package/inc/util/generic/iterator.h +0 -137
  83. package/inc/util/generic/iterator_range.h +0 -105
  84. package/inc/util/generic/lazy_value.h +0 -66
  85. package/inc/util/generic/list.h +0 -22
  86. package/inc/util/generic/map.h +0 -44
  87. package/inc/util/generic/mapfindptr.h +0 -60
  88. package/inc/util/generic/maybe.h +0 -713
  89. package/inc/util/generic/maybe_traits.h +0 -164
  90. package/inc/util/generic/mem_copy.h +0 -55
  91. package/inc/util/generic/noncopyable.h +0 -38
  92. package/inc/util/generic/object_counter.h +0 -53
  93. package/inc/util/generic/ptr.h +0 -1113
  94. package/inc/util/generic/queue.h +0 -57
  95. package/inc/util/generic/refcount.h +0 -162
  96. package/inc/util/generic/reserve.h +0 -11
  97. package/inc/util/generic/scope.h +0 -65
  98. package/inc/util/generic/serialized_enum.h +0 -406
  99. package/inc/util/generic/set.h +0 -42
  100. package/inc/util/generic/singleton.h +0 -136
  101. package/inc/util/generic/size_literals.h +0 -65
  102. package/inc/util/generic/stack.h +0 -18
  103. package/inc/util/generic/store_policy.h +0 -120
  104. package/inc/util/generic/strbase.h +0 -612
  105. package/inc/util/generic/strbuf.h +0 -552
  106. package/inc/util/generic/strfcpy.h +0 -17
  107. package/inc/util/generic/string.h +0 -1572
  108. package/inc/util/generic/string_hash.h +0 -21
  109. package/inc/util/generic/string_ut.h +0 -1175
  110. package/inc/util/generic/type_name.h +0 -34
  111. package/inc/util/generic/typelist.h +0 -114
  112. package/inc/util/generic/typetraits.h +0 -325
  113. package/inc/util/generic/utility.h +0 -132
  114. package/inc/util/generic/va_args.h +0 -400
  115. package/inc/util/generic/variant.h +0 -631
  116. package/inc/util/generic/variant_traits.h +0 -171
  117. package/inc/util/generic/vector.h +0 -119
  118. package/inc/util/generic/xrange.h +0 -258
  119. package/inc/util/generic/yexception.h +0 -212
  120. package/inc/util/generic/yexception_ut.h +0 -14
  121. package/inc/util/generic/ylimits.h +0 -92
  122. package/inc/util/generic/ymath.h +0 -206
  123. package/inc/util/memory/addstorage.h +0 -93
  124. package/inc/util/memory/alloc.h +0 -27
  125. package/inc/util/memory/blob.h +0 -296
  126. package/inc/util/memory/mmapalloc.h +0 -8
  127. package/inc/util/memory/pool.h +0 -432
  128. package/inc/util/memory/segmented_string_pool.h +0 -194
  129. package/inc/util/memory/segpool_alloc.h +0 -118
  130. package/inc/util/memory/smallobj.h +0 -141
  131. package/inc/util/memory/tempbuf.h +0 -111
  132. package/inc/util/network/address.h +0 -136
  133. package/inc/util/network/endpoint.h +0 -61
  134. package/inc/util/network/hostip.h +0 -16
  135. package/inc/util/network/init.h +0 -60
  136. package/inc/util/network/interface.h +0 -17
  137. package/inc/util/network/iovec.h +0 -65
  138. package/inc/util/network/ip.h +0 -116
  139. package/inc/util/network/nonblock.h +0 -8
  140. package/inc/util/network/pair.h +0 -9
  141. package/inc/util/network/poller.h +0 -58
  142. package/inc/util/network/pollerimpl.h +0 -707
  143. package/inc/util/network/sock.h +0 -608
  144. package/inc/util/network/socket.h +0 -421
  145. package/inc/util/random/common_ops.h +0 -130
  146. package/inc/util/random/easy.h +0 -47
  147. package/inc/util/random/entropy.h +0 -21
  148. package/inc/util/random/fast.h +0 -101
  149. package/inc/util/random/init_atfork.h +0 -3
  150. package/inc/util/random/lcg_engine.h +0 -66
  151. package/inc/util/random/mersenne.h +0 -46
  152. package/inc/util/random/mersenne32.h +0 -50
  153. package/inc/util/random/mersenne64.h +0 -50
  154. package/inc/util/random/normal.h +0 -38
  155. package/inc/util/random/random.h +0 -30
  156. package/inc/util/random/shuffle.h +0 -39
  157. package/inc/util/str_stl.h +0 -266
  158. package/inc/util/stream/aligned.h +0 -99
  159. package/inc/util/stream/buffer.h +0 -119
  160. package/inc/util/stream/buffered.h +0 -225
  161. package/inc/util/stream/debug.h +0 -53
  162. package/inc/util/stream/direct_io.h +0 -43
  163. package/inc/util/stream/file.h +0 -108
  164. package/inc/util/stream/format.h +0 -444
  165. package/inc/util/stream/fwd.h +0 -100
  166. package/inc/util/stream/hex.h +0 -8
  167. package/inc/util/stream/holder.h +0 -44
  168. package/inc/util/stream/input.h +0 -273
  169. package/inc/util/stream/labeled.h +0 -19
  170. package/inc/util/stream/length.h +0 -100
  171. package/inc/util/stream/mem.h +0 -255
  172. package/inc/util/stream/multi.h +0 -32
  173. package/inc/util/stream/null.h +0 -61
  174. package/inc/util/stream/output.h +0 -304
  175. package/inc/util/stream/pipe.h +0 -112
  176. package/inc/util/stream/printf.h +0 -25
  177. package/inc/util/stream/str.h +0 -207
  178. package/inc/util/stream/tee.h +0 -28
  179. package/inc/util/stream/tempbuf.h +0 -21
  180. package/inc/util/stream/tokenizer.h +0 -214
  181. package/inc/util/stream/trace.h +0 -60
  182. package/inc/util/stream/walk.h +0 -35
  183. package/inc/util/stream/zerocopy.h +0 -91
  184. package/inc/util/stream/zerocopy_output.h +0 -57
  185. package/inc/util/stream/zlib.h +0 -173
  186. package/inc/util/string/ascii.h +0 -236
  187. package/inc/util/string/builder.h +0 -39
  188. package/inc/util/string/cast.h +0 -347
  189. package/inc/util/string/cstriter.h +0 -14
  190. package/inc/util/string/escape.h +0 -70
  191. package/inc/util/string/hex.h +0 -59
  192. package/inc/util/string/join.h +0 -194
  193. package/inc/util/string/printf.h +0 -13
  194. package/inc/util/string/reverse.h +0 -16
  195. package/inc/util/string/split.h +0 -1080
  196. package/inc/util/string/strip.h +0 -257
  197. package/inc/util/string/strspn.h +0 -65
  198. package/inc/util/string/subst.h +0 -56
  199. package/inc/util/string/type.h +0 -50
  200. package/inc/util/string/util.h +0 -195
  201. package/inc/util/string/vector.h +0 -132
  202. package/inc/util/system/align.h +0 -50
  203. package/inc/util/system/atexit.h +0 -22
  204. package/inc/util/system/atomic.h +0 -51
  205. package/inc/util/system/atomic_gcc.h +0 -90
  206. package/inc/util/system/atomic_ops.h +0 -189
  207. package/inc/util/system/atomic_win.h +0 -114
  208. package/inc/util/system/backtrace.h +0 -39
  209. package/inc/util/system/byteorder.h +0 -186
  210. package/inc/util/system/compat.h +0 -84
  211. package/inc/util/system/compiler.h +0 -620
  212. package/inc/util/system/condvar.h +0 -71
  213. package/inc/util/system/context.h +0 -181
  214. package/inc/util/system/context_aarch64.h +0 -8
  215. package/inc/util/system/context_i686.h +0 -9
  216. package/inc/util/system/context_x86.h +0 -12
  217. package/inc/util/system/context_x86_64.h +0 -7
  218. package/inc/util/system/cpu_id.h +0 -159
  219. package/inc/util/system/daemon.h +0 -28
  220. package/inc/util/system/datetime.h +0 -98
  221. package/inc/util/system/defaults.h +0 -149
  222. package/inc/util/system/demangle.h +0 -5
  223. package/inc/util/system/demangle_impl.h +0 -23
  224. package/inc/util/system/direct_io.h +0 -71
  225. package/inc/util/system/dynlib.h +0 -119
  226. package/inc/util/system/env.h +0 -32
  227. package/inc/util/system/error.h +0 -95
  228. package/inc/util/system/event.h +0 -122
  229. package/inc/util/system/execpath.h +0 -17
  230. package/inc/util/system/fasttime.h +0 -6
  231. package/inc/util/system/fhandle.h +0 -27
  232. package/inc/util/system/file.h +0 -210
  233. package/inc/util/system/file_lock.h +0 -34
  234. package/inc/util/system/filemap.h +0 -383
  235. package/inc/util/system/flock.h +0 -35
  236. package/inc/util/system/fs.h +0 -156
  237. package/inc/util/system/fs_win.h +0 -29
  238. package/inc/util/system/fstat.h +0 -46
  239. package/inc/util/system/getpid.h +0 -12
  240. package/inc/util/system/guard.h +0 -179
  241. package/inc/util/system/hi_lo.h +0 -139
  242. package/inc/util/system/hostname.h +0 -10
  243. package/inc/util/system/hp_timer.h +0 -36
  244. package/inc/util/system/info.h +0 -12
  245. package/inc/util/system/interrupt_signals.h +0 -22
  246. package/inc/util/system/madvise.h +0 -30
  247. package/inc/util/system/maxlen.h +0 -32
  248. package/inc/util/system/mem_info.h +0 -18
  249. package/inc/util/system/mincore.h +0 -38
  250. package/inc/util/system/mktemp.h +0 -11
  251. package/inc/util/system/mlock.h +0 -43
  252. package/inc/util/system/mutex.h +0 -67
  253. package/inc/util/system/nice.h +0 -3
  254. package/inc/util/system/pipe.h +0 -90
  255. package/inc/util/system/platform.h +0 -246
  256. package/inc/util/system/progname.h +0 -13
  257. package/inc/util/system/protect.h +0 -25
  258. package/inc/util/system/rusage.h +0 -26
  259. package/inc/util/system/rwlock.h +0 -78
  260. package/inc/util/system/sanitizers.h +0 -122
  261. package/inc/util/system/sem.h +0 -41
  262. package/inc/util/system/shellcommand.h +0 -472
  263. package/inc/util/system/shmat.h +0 -32
  264. package/inc/util/system/sigset.h +0 -78
  265. package/inc/util/system/spin_wait.h +0 -10
  266. package/inc/util/system/spinlock.h +0 -121
  267. package/inc/util/system/src_location.h +0 -25
  268. package/inc/util/system/src_root.h +0 -68
  269. package/inc/util/system/sys_alloc.h +0 -43
  270. package/inc/util/system/sysstat.h +0 -52
  271. package/inc/util/system/tempfile.h +0 -34
  272. package/inc/util/system/thread.h +0 -167
  273. package/inc/util/system/tls.h +0 -307
  274. package/inc/util/system/types.h +0 -119
  275. package/inc/util/system/unaligned_mem.h +0 -67
  276. package/inc/util/system/user.h +0 -5
  277. package/inc/util/system/utime.h +0 -6
  278. package/inc/util/system/valgrind.h +0 -48
  279. package/inc/util/system/winint.h +0 -43
  280. package/inc/util/system/yassert.h +0 -121
  281. package/inc/util/system/yield.h +0 -4
  282. package/inc/util/thread/factory.h +0 -65
  283. package/inc/util/thread/fwd.h +0 -30
  284. package/inc/util/thread/lfqueue.h +0 -406
  285. package/inc/util/thread/lfstack.h +0 -188
  286. package/inc/util/thread/pool.h +0 -388
  287. package/inc/util/thread/singleton.h +0 -42
  288. package/inc/util/ysafeptr.h +0 -427
  289. package/inc/util/ysaveload.h +0 -700
@@ -1,444 +0,0 @@
1
- #pragma once
2
-
3
- #include "mem.h"
4
- #include "output.h"
5
-
6
- #include <util/datetime/base.h>
7
- #include <util/generic/strbuf.h>
8
- #include <util/generic/flags.h>
9
- #include <util/memory/tempbuf.h>
10
- #include <util/string/cast.h>
11
-
12
- enum ENumberFormatFlag {
13
- HF_FULL = 0x01, /**< Output number with leading zeros. */
14
- HF_ADDX = 0x02, /**< Output '0x' or '0b' before hex/bin digits. */
15
- };
16
- Y_DECLARE_FLAGS(ENumberFormat, ENumberFormatFlag)
17
- Y_DECLARE_OPERATORS_FOR_FLAGS(ENumberFormat)
18
-
19
- enum ESizeFormat {
20
- SF_QUANTITY, /**< Base 1000, usual suffixes. 1100 gets turned into "1.1K". */
21
- SF_BYTES, /**< Base 1024, byte suffix. 1100 gets turned into "1.07KiB". */
22
- };
23
-
24
- namespace NFormatPrivate {
25
- template <size_t Value>
26
- struct TLog2 : std::integral_constant<size_t, TLog2<Value / 2>::value + 1> {};
27
-
28
- template <>
29
- struct TLog2<1> : std::integral_constant<size_t, 0> {};
30
-
31
- static inline void WriteChars(IOutputStream& os, char c, size_t count) {
32
- if (count == 0)
33
- return;
34
- TTempBuf buf(count);
35
- memset(buf.Data(), c, count);
36
- os.Write(buf.Data(), count);
37
- }
38
-
39
- template <typename T>
40
- struct TLeftPad {
41
- T Value;
42
- size_t Width;
43
- char Padc;
44
-
45
- inline TLeftPad(const T& value, size_t width, char padc)
46
- : Value(value)
47
- , Width(width)
48
- , Padc(padc)
49
- {
50
- }
51
- };
52
-
53
- template <typename T>
54
- IOutputStream& operator<<(IOutputStream& o, const TLeftPad<T>& lp) {
55
- TTempBuf buf;
56
- TMemoryOutput ss(buf.Data(), buf.Size());
57
- ss << lp.Value;
58
- size_t written = buf.Size() - ss.Avail();
59
- if (lp.Width > written) {
60
- WriteChars(o, lp.Padc, lp.Width - written);
61
- }
62
- o.Write(buf.Data(), written);
63
- return o;
64
- }
65
-
66
- template <typename T>
67
- struct TRightPad {
68
- T Value;
69
- size_t Width;
70
- char Padc;
71
-
72
- inline TRightPad(const T& value, size_t width, char padc)
73
- : Value(value)
74
- , Width(width)
75
- , Padc(padc)
76
- {
77
- }
78
- };
79
-
80
- template <typename T>
81
- IOutputStream& operator<<(IOutputStream& o, const TRightPad<T>& lp) {
82
- TTempBuf buf;
83
- TMemoryOutput ss(buf.Data(), buf.Size());
84
- ss << lp.Value;
85
- size_t written = buf.Size() - ss.Avail();
86
- o.Write(buf.Data(), written);
87
- if (lp.Width > written) {
88
- WriteChars(o, lp.Padc, lp.Width - written);
89
- }
90
- return o;
91
- }
92
-
93
- template <typename T, size_t Base>
94
- struct TBaseNumber {
95
- T Value;
96
- ENumberFormat Flags;
97
-
98
- template <typename OtherT>
99
- inline TBaseNumber(OtherT value, ENumberFormat flags)
100
- : Value(value)
101
- , Flags(flags)
102
- {
103
- }
104
- };
105
-
106
- template <typename T, size_t Base>
107
- using TUnsignedBaseNumber = TBaseNumber<std::make_unsigned_t<std::remove_cv_t<T>>, Base>;
108
-
109
- template <typename T, size_t Base>
110
- IOutputStream& operator<<(IOutputStream& stream, const TBaseNumber<T, Base>& value) {
111
- char buf[8 * sizeof(T) + 1]; /* Add 1 for sign. */
112
- TStringBuf str(buf, IntToString<Base>(value.Value, buf, sizeof(buf)));
113
-
114
- if (str[0] == '-') {
115
- stream << '-';
116
- str.Skip(1);
117
- }
118
-
119
- if (value.Flags & HF_ADDX) {
120
- if (Base == 16) {
121
- stream << TStringBuf("0x");
122
- } else if (Base == 2) {
123
- stream << TStringBuf("0b");
124
- }
125
- }
126
-
127
- if (value.Flags & HF_FULL) {
128
- WriteChars(stream, '0', (8 * sizeof(T) + TLog2<Base>::value - 1) / TLog2<Base>::value - str.size());
129
- }
130
-
131
- stream << str;
132
- return stream;
133
- }
134
-
135
- template <typename Char, size_t Base>
136
- struct TBaseText {
137
- TBasicStringBuf<Char> Text;
138
-
139
- inline TBaseText(const TBasicStringBuf<Char> text)
140
- : Text(text)
141
- {
142
- }
143
- };
144
-
145
- template <typename Char, size_t Base>
146
- IOutputStream& operator<<(IOutputStream& os, const TBaseText<Char, Base>& text) {
147
- for (size_t i = 0; i < text.Text.size(); ++i) {
148
- if (i != 0) {
149
- os << ' ';
150
- }
151
- os << TUnsignedBaseNumber<Char, Base>(text.Text[i], HF_FULL);
152
- }
153
- return os;
154
- }
155
-
156
- template <typename T>
157
- struct TFloatPrecision {
158
- using TdVal = std::remove_cv_t<T>;
159
- static_assert(std::is_floating_point<TdVal>::value, "expect std::is_floating_point<TdVal>::value");
160
-
161
- TdVal Value;
162
- EFloatToStringMode Mode;
163
- int NDigits;
164
- };
165
-
166
- template <typename T>
167
- IOutputStream& operator<<(IOutputStream& o, const TFloatPrecision<T>& prec) {
168
- char buf[512];
169
- size_t count = FloatToString(prec.Value, buf, sizeof(buf), prec.Mode, prec.NDigits);
170
- o << TStringBuf(buf, count);
171
- return o;
172
- }
173
-
174
- struct THumanReadableDuration {
175
- TDuration Value;
176
-
177
- constexpr THumanReadableDuration(const TDuration& value)
178
- : Value(value)
179
- {
180
- }
181
- };
182
-
183
- struct THumanReadableSize {
184
- double Value;
185
- ESizeFormat Format;
186
- };
187
- }
188
-
189
- /**
190
- * Output manipulator basically equivalent to `std::setw` and `std::setfill`
191
- * combined.
192
- *
193
- * When written into a `IOutputStream`, writes out padding characters first,
194
- * and then provided value.
195
- *
196
- * Example usage:
197
- * @code
198
- * stream << LeftPad(12345, 10, '0'); // Will output "0000012345"
199
- * @endcode
200
- *
201
- * @param value Value to output.
202
- * @param width Target total width.
203
- * @param padc Character to use for padding.
204
- * @see RightPad
205
- */
206
- template <typename T>
207
- static constexpr ::NFormatPrivate::TLeftPad<T> LeftPad(const T& value, const size_t width, const char padc = ' ') noexcept {
208
- return ::NFormatPrivate::TLeftPad<T>(value, width, padc);
209
- }
210
-
211
- template <typename T, int N>
212
- static constexpr ::NFormatPrivate::TLeftPad<const T*> LeftPad(const T (&value)[N], const size_t width, const char padc = ' ') noexcept {
213
- return ::NFormatPrivate::TLeftPad<const T*>(value, width, padc);
214
- }
215
-
216
- /**
217
- * Output manipulator similar to `std::setw` and `std::setfill`.
218
- *
219
- * When written into a `IOutputStream`, writes provided value first, and then
220
- * the padding characters.
221
- *
222
- * Example usage:
223
- * @code
224
- * stream << RightPad("column1", 10, ' '); // Will output "column1 "
225
- * @endcode
226
- *
227
- * @param value Value to output.
228
- * @param width Target total width.
229
- * @param padc Character to use for padding.
230
- * @see LeftPad
231
- */
232
- template <typename T>
233
- static constexpr ::NFormatPrivate::TRightPad<T> RightPad(const T& value, const size_t width, const char padc = ' ') noexcept {
234
- return ::NFormatPrivate::TRightPad<T>(value, width, padc);
235
- }
236
-
237
- template <typename T, int N>
238
- static constexpr ::NFormatPrivate::TRightPad<const T*> RightPad(const T (&value)[N], const size_t width, const char padc = ' ') noexcept {
239
- return ::NFormatPrivate::TRightPad<const T*>(value, width, padc);
240
- }
241
-
242
- /**
243
- * Output manipulator similar to `std::setbase(16)`.
244
- *
245
- * When written into a `IOutputStream`, writes out the provided value in
246
- * hexadecimal form. The value is treated as unsigned, even if its type is in
247
- * fact signed.
248
- *
249
- * Example usage:
250
- * @code
251
- * stream << Hex(-1); // Will output "0xFFFFFFFF"
252
- * stream << Hex(1ull); // Will output "0x0000000000000001"
253
- * @endcode
254
- *
255
- * @param value Value to output.
256
- * @param flags Output flags.
257
- */
258
- template <typename T>
259
- static constexpr ::NFormatPrivate::TUnsignedBaseNumber<T, 16> Hex(const T& value, const ENumberFormat flags = HF_FULL | HF_ADDX) noexcept {
260
- return {value, flags};
261
- }
262
-
263
- /**
264
- * Output manipulator similar to `std::setbase(16)`.
265
- *
266
- * When written into a `IOutputStream`, writes out the provided value in
267
- * hexadecimal form.
268
- *
269
- * Example usage:
270
- * @code
271
- * stream << SHex(-1); // Will output "-0x00000001"
272
- * stream << SHex(1ull); // Will output "0x0000000000000001"
273
- * @endcode
274
- *
275
- * @param value Value to output.
276
- * @param flags Output flags.
277
- */
278
- template <typename T>
279
- static constexpr ::NFormatPrivate::TBaseNumber<T, 16> SHex(const T& value, const ENumberFormat flags = HF_FULL | HF_ADDX) noexcept {
280
- return {value, flags};
281
- }
282
-
283
- /**
284
- * Output manipulator similar to `std::setbase(2)`.
285
- *
286
- * When written into a `IOutputStream`, writes out the provided value in
287
- * binary form. The value is treated as unsigned, even if its type is in
288
- * fact signed.
289
- *
290
- * Example usage:
291
- * @code
292
- * stream << Bin(-1); // Will output "0b11111111111111111111111111111111"
293
- * stream << Bin(1); // Will output "0b00000000000000000000000000000001"
294
- * @endcode
295
- *
296
- * @param value Value to output.
297
- * @param flags Output flags.
298
- */
299
- template <typename T>
300
- static constexpr ::NFormatPrivate::TUnsignedBaseNumber<T, 2> Bin(const T& value, const ENumberFormat flags = HF_FULL | HF_ADDX) noexcept {
301
- return {value, flags};
302
- }
303
-
304
- /**
305
- * Output manipulator similar to `std::setbase(2)`.
306
- *
307
- * When written into a `IOutputStream`, writes out the provided value in
308
- * binary form.
309
- *
310
- * Example usage:
311
- * @code
312
- * stream << SBin(-1); // Will output "-0b00000000000000000000000000000001"
313
- * stream << SBin(1); // Will output "0b00000000000000000000000000000001"
314
- * @endcode
315
- *
316
- * @param value Value to output.
317
- * @param flags Output flags.
318
- */
319
- template <typename T>
320
- static constexpr ::NFormatPrivate::TBaseNumber<T, 2> SBin(const T& value, const ENumberFormat flags = HF_FULL | HF_ADDX) noexcept {
321
- return {value, flags};
322
- }
323
-
324
- /**
325
- * Output manipulator for hexadecimal string output.
326
- *
327
- * When written into a `IOutputStream`, writes out the provided characters
328
- * in hexadecimal form divided by space character.
329
- *
330
- * Example usage:
331
- * @code
332
- * stream << HexText(TStringBuf("abcи")); // Will output "61 62 63 D0 B8"
333
- * stream << HexText(TWtringBuf(u"abcи")); // Will output "0061 0062 0063 0438"
334
- * @endcode
335
- *
336
- * @param value String to output.
337
- */
338
- template <typename TChar>
339
- static inline ::NFormatPrivate::TBaseText<TChar, 16> HexText(const TBasicStringBuf<TChar> value) {
340
- return ::NFormatPrivate::TBaseText<TChar, 16>(value);
341
- }
342
-
343
- /**
344
- * Output manipulator for binary string output.
345
- *
346
- * When written into a `IOutputStream`, writes out the provided characters
347
- * in binary form divided by space character.
348
- *
349
- * Example usage:
350
- * @code
351
- * stream << BinText(TStringBuf("aaa")); // Will output "01100001 01100001 01100001"
352
- * @endcode
353
- *
354
- * @param value String to output.
355
- */
356
- template <typename TChar>
357
- static inline ::NFormatPrivate::TBaseText<TChar, 2> BinText(const TBasicStringBuf<TChar> value) {
358
- return ::NFormatPrivate::TBaseText<TChar, 2>(value);
359
- }
360
-
361
- /**
362
- * Output manipulator for printing `TDuration` values.
363
- *
364
- * When written into a `IOutputStream`, writes out the provided `TDuration`
365
- * in auto-adjusted human-readable format.
366
- *
367
- * Example usage:
368
- * @code
369
- * stream << HumanReadable(TDuration::MicroSeconds(100)); // Will output "100us"
370
- * stream << HumanReadable(TDuration::Seconds(3672)); // Will output "1h 1m 12s"
371
- * @endcode
372
- *
373
- * @param value Value to output.
374
- */
375
- static constexpr ::NFormatPrivate::THumanReadableDuration HumanReadable(const TDuration duration) noexcept {
376
- return ::NFormatPrivate::THumanReadableDuration(duration);
377
- }
378
-
379
- /**
380
- * Output manipulator for writing out human-readable number of elements / memory
381
- * amount in `ls -h` style.
382
- *
383
- * When written into a `IOutputStream`, writes out the provided unsigned integer
384
- * variable with small precision and a suffix (like 'K', 'M', 'G' for numbers, or
385
- * 'B', 'KiB', 'MiB', 'GiB' for bytes).
386
- *
387
- * For quantities, base 1000 is used. For bytes, base is 1024.
388
- *
389
- * Example usage:
390
- * @code
391
- * stream << HumanReadableSize(1024, SF_QUANTITY); // Will output "1.02K"
392
- * stream << HumanReadableSize(1024, SF_BYTES); // Will output "1KiB"
393
- * stream << "average usage " << HumanReadableSize(100 / 3., SF_BYTES); // Will output "average usage "33.3B""
394
- * @endcode
395
- *
396
- * @param value Value to output.
397
- * @param format Format to use.
398
- */
399
- static constexpr ::NFormatPrivate::THumanReadableSize HumanReadableSize(const double size, ESizeFormat format) noexcept {
400
- return {size, format};
401
- }
402
-
403
- void Time(IOutputStream& l);
404
- void TimeHumanReadable(IOutputStream& l);
405
-
406
- /**
407
- * Output manipulator for adjusting precision of floating point values.
408
- *
409
- * When written into a `IOutputStream`, writes out the provided floating point
410
- * variable with given precision. The behavior depends on provided `mode`.
411
- *
412
- * Example usage:
413
- * @code
414
- * stream << Prec(1.2345678901234567, PREC_AUTO); // Will output "1.2345678901234567"
415
- * @endcode
416
- *
417
- * @param value float or double to output.
418
- * @param mode Output mode.
419
- * @param ndigits Number of significant digits (in `PREC_NDIGITS` and `PREC_POINT_DIGITS` mode).
420
- * @see EFloatToStringMode
421
- */
422
- template <typename T>
423
- static constexpr ::NFormatPrivate::TFloatPrecision<T> Prec(const T& value, const EFloatToStringMode mode, const int ndigits = 0) noexcept {
424
- return {value, mode, ndigits};
425
- }
426
-
427
- /**
428
- * Output manipulator for adjusting precision of floating point values.
429
- *
430
- * When written into a `IOutputStream`, writes out the provided floating point
431
- * variable with given precision. The behavior is equivalent to `Prec(value, PREC_NDIGITS, ndigits)`.
432
- *
433
- * Example usage:
434
- * @code
435
- * stream << Prec(1.2345678901234567, 3); // Will output "1.23"
436
- * @endcode
437
- *
438
- * @param value float or double to output.
439
- * @param ndigits Number of significant digits.
440
- */
441
- template <typename T>
442
- static constexpr ::NFormatPrivate::TFloatPrecision<T> Prec(const T& value, const int ndigits) noexcept {
443
- return {value, PREC_NDIGITS, ndigits};
444
- }
@@ -1,100 +0,0 @@
1
- #pragma once
2
-
3
- #include <util/system/types.h>
4
-
5
- class IInputStream;
6
- class IOutputStream;
7
-
8
- class IZeroCopyInput;
9
- class IZeroCopyInputFastReadTo;
10
- class IZeroCopyOutput;
11
-
12
- using TStreamManipulator = void (*)(IOutputStream&);
13
-
14
- class TLengthLimitedInput;
15
- class TCountingInput;
16
- class TCountingOutput;
17
-
18
- class TMemoryInput;
19
- class TMemoryOutput;
20
- class TMemoryWriteBuffer;
21
-
22
- class TMultiInput;
23
-
24
- class TNullInput;
25
- class TNullOutput;
26
- class TNullIO;
27
-
28
- class TPipeBase;
29
- class TPipeInput;
30
- class TPipeOutput;
31
- class TPipedBase;
32
- class TPipedInput;
33
- class TPipedOutput;
34
-
35
- class TStringInput;
36
- class TStringOutput;
37
- class TStringStream;
38
-
39
- class TTeeOutput;
40
-
41
- class TTempBufOutput;
42
-
43
- struct TEol;
44
-
45
- template <typename TEndOfToken>
46
- class TStreamTokenizer;
47
-
48
- enum ETraceLevel : ui8;
49
-
50
- class IWalkInput;
51
-
52
- struct TZLibError;
53
- struct TZLibCompressorError;
54
- struct TZLibDecompressorError;
55
-
56
- namespace ZLib {
57
- enum StreamType : ui8;
58
- }
59
-
60
- class TZLibDecompress;
61
- class TZLibCompress;
62
- class TBufferedZLibDecompress;
63
-
64
- using TZDecompress = TBufferedZLibDecompress;
65
-
66
- class TAlignedInput;
67
- class TAlignedOutput;
68
-
69
- class TBufferInput;
70
- class TBufferOutput;
71
- class TBufferStream;
72
-
73
- class TBufferedInput;
74
- class TBufferedOutputBase;
75
- class TBufferedOutput;
76
- class TAdaptiveBufferedOutput;
77
-
78
- template <class TSlave>
79
- class TBuffered;
80
-
81
- template <class TSlave>
82
- class TAdaptivelyBuffered;
83
-
84
- class TDebugOutput;
85
-
86
- class TRandomAccessFileInput;
87
- class TRandomAccessFileOutput;
88
- class TBufferedFileOutputEx;
89
-
90
- class TUnbufferedFileInput;
91
- class TMappedFileInput;
92
- class TUnbufferedFileOutput;
93
-
94
- class TFileInput;
95
- using TIFStream = TFileInput;
96
-
97
- class TFixedBufferFileOutput;
98
- using TOFStream = TFixedBufferFileOutput;
99
-
100
- using TFileOutput = TAdaptivelyBuffered<TUnbufferedFileOutput>;
@@ -1,8 +0,0 @@
1
- #pragma once
2
-
3
- #include <util/system/types.h>
4
-
5
- class IOutputStream;
6
-
7
- void HexEncode(const void* in, size_t len, IOutputStream& out);
8
- void HexDecode(const void* in, size_t len, IOutputStream& out);
@@ -1,44 +0,0 @@
1
- #pragma once
2
-
3
- #include <util/generic/ptr.h>
4
-
5
- #include <utility>
6
- #include <type_traits>
7
-
8
- class IInputStream;
9
- class IOutputStream;
10
-
11
- namespace NPrivate {
12
- template <class Stream, bool isInput = std::is_base_of<IInputStream, Stream>::value>
13
- struct TStreamBase {
14
- using TType = IInputStream;
15
- };
16
-
17
- template <class Stream>
18
- struct TStreamBase<Stream, false> {
19
- using TType = IOutputStream;
20
- };
21
-
22
- }
23
-
24
- /**
25
- * An ownership-gaining wrapper for proxy streams.
26
- *
27
- * Example usage:
28
- * \code
29
- * TCountingInput* input = new THoldingStream<TCountingInput>(new TStringInput(s));
30
- * \encode
31
- *
32
- * In this example, resulting counting input also owns a string input that it
33
- * was constructed on top of.
34
- */
35
- template <class Base, class StreamBase = typename ::NPrivate::TStreamBase<Base>::TType>
36
- class THoldingStream: private THolder<StreamBase>, public Base {
37
- public:
38
- template <class... Args>
39
- inline THoldingStream(THolder<StreamBase> stream, Args&&... args)
40
- : THolder<StreamBase>(std::move(stream))
41
- , Base(this->Get(), std::forward<Args>(args)...)
42
- {
43
- }
44
- };