forked from hasherezade/tiny_tracer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Util.h
32 lines (23 loc) · 811 Bytes
/
Util.h
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
#pragma once
#include <cctype>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <vector>
#define IS_PRINTABLE(c) (c >= 0x20 && c < 0x7f)
#define IS_ENDLINE(c) (c == 0x0A || c == 0xD)
#ifndef PAGE_SIZE
#define PAGE_SIZE 0x1000
#endif
namespace util {
std::wstring hexdump(const uint8_t* in_buf, const size_t max_size);
size_t getAsciiLen(const char *inp, size_t maxInp);
size_t getAsciiLenW(const wchar_t *inp, size_t maxInp);
std::string getDllName(const std::string& str);
bool iequals(const std::string& a, const std::string& b);
size_t splitList(const std::string &sline, const char delimiter, std::vector<std::string> &args);
// trim from both ends (in place)
void trim(std::string &s);
int loadInt(const std::string &str);
};