-
Notifications
You must be signed in to change notification settings - Fork 0
/
IVUtil.hpp
70 lines (56 loc) · 1.31 KB
/
IVUtil.hpp
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
60
61
62
63
64
65
66
67
68
69
70
/*
IVUTIL.HPP
NICK WILSON
2020
*/
#include <SDL2/SDL.h>
#include <cstdint> //standard number formats
#include <string> //string type
#include <iostream> //console io
#include <fstream> //file io
#include <filesystem> //filesystem components
#ifndef IVUTIL_H
#define IVUTIL_H
namespace IVUTIL {
/* LOGGING */
const std::string APPLICATION_TITLE = "Image Viewer";
const std::string LOG_ERROR = "<ERROR> ";
const std::string LOG_WARNING = "<WARNING> ";
const std::string LOG_NOTICE = "<NOTICE> ";
/* From sdl_image documentation */
/* Less common formats omitted */
enum FILE_TYPE {
JPG,
PNG,
GIF,
BMP,
TIF,
TGA,
HEIF
};
enum LIB_TYPE_SUPPORT {
TYPE_SDL,
TYPE_GIFLIB,
TYPE_LIBHEIF
};
/* Home cooked exception codes */
enum IVEXCEPT {
EXCEPT_IMG_LOAD_FAIL,
EXCEPT_IMG_OPEN_FAIL
};
// This the data read from and written to settings file.
// Adding a new value here will cause old config files to be discarded on first read.
struct IVSETTINGS {
int WIN_X;
int WIN_Y;
int WIN_W;
int WIN_H;
bool MAXIMIZED;
bool DISPLAY_MODE_DARK;
};
int formatSupport(std::string extension);
int libSupport(std::string extension);
void readSettings(std::filesystem::path target, IVSETTINGS* settings);
void writeSettings(std::filesystem::path target, IVSETTINGS* settings);
};
#endif