blob: 275ec47474472ab5ef403dd85ecab6b72a8a9386 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#pragma once
#include <string>
#include <vector>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cstdint>
#include <algorithm>
#include <filesystem>
namespace Torch {
template< typename T >
std::string to_hex(T number, const bool append0x = true) {
std::stringstream stream;
if(append0x) {
stream << "0x";
}
stream << std::setfill ('0')
<< std::hex << number;
auto format = stream.str();
std::transform(format.begin(), format.end(), format.begin(), ::toupper);
return format;
}
template <typename Container, typename Key>
constexpr bool contains(const Container& c, const Key& k) {
#if __cplusplus >= 202002L
return c.contains(k);
#else
return c.find(k) != c.end();
#endif
}
uint32_t translate(uint32_t offset);
std::vector<std::filesystem::directory_entry> getRecursiveEntries(const std::filesystem::path baseDir);
};
|