16#include "StringUtils.h"
29namespace fs = ::std::filesystem;
36fs::path makeUniquePath(
const fs::path &path);
39isize getSizeOfFile(
const fs::path &path);
42bool fileExists(
const fs::path &path);
45bool isDirectory(
const fs::path &path);
48bool createDirectory(
const fs::path &path);
51isize numDirectoryItems(
const fs::path &path);
54std::vector<fs::path> files(
const fs::path &path,
const string &suffix =
"");
55std::vector<fs::path> files(
const fs::path &path, std::vector <string> &suffixes);
58bool matchingStreamHeader(std::istream &is,
const u8 *header, isize len, isize offset = 0);
59bool matchingStreamHeader(std::istream &is,
const string &header, isize offset = 0);
60bool matchingBufferHeader(
const u8 *buffer,
const u8 *header, isize len, isize offset = 0);
67void sprint8d(
char *s, u8 value);
68void sprint16d(
char *s, u16 value);
71void sprint8x(
char *s, u8 value);
72void sprint16x(
char *s, u16 value);
75void sprint8b(
char *s, u8 value);
76void sprint16b(
char *s, u16 value);
83isize streamLength(std::istream &stream);
89 dec(i64 v) : value(v) { };
90 std::ostream &operator()(std::ostream &os)
const;
98 hex(
int d, u64 v) : digits(d), value(v) { };
99 hex(u64 v) : hex(16, v) { };
100 hex(u32 v) : hex(8, v) { };
101 hex(u16 v) : hex(4, v) { };
102 hex(u8 v) : hex(2, v) { };
103 std::ostream &operator()(std::ostream &os)
const;
111 bin(isize d, u64 v) : digits(d), value(v) { };
112 bin(u64 v) : bin(64, v) { };
113 bin(u32 v) : bin(32, v) { };
114 bin(u16 v) : bin(16, v) { };
115 bin(u8 v) : bin(8, v) { };
116 std::ostream &operator()(std::ostream &os)
const;
123 flt(
double v) : value(v) { };
124 flt(
float v) : value(double(v)) { };
125 std::ostream &operator()(std::ostream &os)
const;
133 tab(
int p,
const string &s) : pads(p), str(s) { };
134 tab(
const string &s) : tab(24, s) { };
135 std::ostream &operator()(std::ostream &os)
const;
140 static const string& yes;
141 static const string& no;
144 const string &str1, &str2;
146 bol(
bool v,
const string &s1,
const string &s2) : value(v), str1(s1), str2(s2) { };
147 bol(
bool v) : bol(v, yes, no) { };
148 std::ostream &operator()(std::ostream &os)
const;
156 str(isize c, u64 v) : characters(c), value(v) { };
157 str(u64 v) : str(8, v) { };
158 str(u32 v) : str(4, v) { };
159 str(u16 v) : str(2, v) { };
160 str(u8 v) : str(1, v) { };
161 std::ostream &operator()(std::ostream &os)
const;
164inline std::ostream &operator <<(std::ostream &os, dec v) {
return v(os); }
165inline std::ostream &operator <<(std::ostream &os, hex v) {
return v(os); }
166inline std::ostream &operator <<(std::ostream &os, bin v) {
return v(os); }
167inline std::ostream &operator <<(std::ostream &os, flt v) {
return v(os); }
168inline std::ostream &operator <<(std::ostream &os, tab v) {
return v(os); }
169inline std::ostream &operator <<(std::ostream &os, bol v) {
return v(os); }
170inline std::ostream &operator <<(std::ostream &os, str v) {
return v(os); }