- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpp-utils.h
More file actions
Latest commit
59 lines (53 loc) · 1.71 KB
/
Copy pathcpp-utils.h
File metadata and controls
59 lines (53 loc) · 1.71 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef FILENAME_UTILS_H
#defineFILENAME_UTILS_H
#include<ctime>
#include<stdarg.h>
#include<stdio.h>
#ifdef _WIN32
#include<wchar.h>
#endif
#include<string>
#include<vector>
#ifdef _WIN32
#define__attribute__(x)
#endif
std::string filename_sans_directory(const std::string &filename);
std::string filename_directory(const std::string &filename);
std::string filename_sans_suffix(const std::string &filename);
std::string filename_suffix(const std::string &filename);
std::string string_vprintf(constchar *fmt, va_list args);
std::string string_printf(constchar *fmt, ...) __attribute__((format(printf,1,2)));
voidmake_directory(const std::string &dirname);
voidmake_directory_and_parents(const std::string &dirname);
boolfilename_exists(const std::string &filename);
voidrename_file(const std::string &src, const std::string &dest);
FILE *fopen_utf8(const std::string &path, constchar *mode);
booliequals(const std::string &a, const std::string &b);
std::string temporary_path(const std::string &path);
std::string hostname();
voidthrow_error(constchar *fmt, ...) __attribute__((format(printf,1,2))) __attribute__((noreturn));
std::string executable_suffix();
std::string executable_path();
std::string application_user_state_directory(const std::string &application_name);
std::string os(); // osx, windows, linux
voidget_cpu_usage(double &user, double &system);
classUnicode {
std::string m_utf8;
#ifdef _WIN32
std::vector<wchar_t> m_utf16;
#endif
public:
Unicode(const std::string &utf8);
Unicode(constchar *utf8);
#ifdef _WIN32
Unicode(constwchar_t *utf16);
constwchar_t *path();
constwchar_t *utf16();
#else
constchar *path();
#endif
constchar *utf8();
private:
voidinit_from_utf8();
};
#endif