-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexif.hpp
More file actions
52 lines (45 loc) · 1.32 KB
/
Copy pathexif.hpp
File metadata and controls
52 lines (45 loc) · 1.32 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
#pragma once
#include <ostream>
#include <filesystem>
using TAG = uint16_t;
const TAG MARK = 0xFF;
const TAG JPEG = 0xD8FF;
const TAG EXIF = 0xE1FF;
const TAG SOF = 0xC0FF; // picture resolution
const TAG SOS = 0xDAFF; // start of frame
const TAG END = 0xD9FF;
const TAG ORNT = 0x0112;
const TAG CAM = 0x0110;
const TAG SIFD = 0x8769;
const TAG DATE = 0x9003;
const TAG WIDTH = 0xA002;
const TAG HIGHT = 0xA003;
const char EXIFID[] = "Exif";
struct File {
bool pic, exif, sos, sub, dat, res, end;
std::filesystem::path name, path, dir;
std::string date, cam;
std::string year, month, day;
uint32_t size;
uint16_t hight, width, ornt;
void operator<<(std::ifstream&);
operator bool() const {
return pic && exif && sos && sub && dat && end
&& !date.empty()
&& strtol(year.c_str(), NULL, 10)
&& strtol(month.c_str(), NULL, 10)
&& strtol(day.c_str(), NULL, 10);
}
File(const std::filesystem::path& entry) {
pic = exif = sos = sub = end = dat = res = false;
size = width = hight = ornt = 0;
name = entry.filename();
path = entry.parent_path();
}
bool operator>(const File&);
friend std::ostream& operator<<(std::ostream&, const File&);
std::filesystem::path full() const { return path / name; }
std::filesystem::path target() const { return dir / name; }
std::string dump(const File&) const;
bool commit();
};