mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
sys: Cleanup libmagic mess
This commit is contained in:
23
plugins/libimhex/include/hex/helpers/literals.hpp
Normal file
23
plugins/libimhex/include/hex/helpers/literals.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
namespace hex::literals {
|
||||
|
||||
/* Byte literals */
|
||||
|
||||
unsigned long long operator ""_Bytes(unsigned long long bytes) {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
unsigned long long operator ""_kiB(unsigned long long kiB) {
|
||||
return operator ""_Bytes(kiB * 1024);
|
||||
}
|
||||
|
||||
unsigned long long operator ""_MiB(unsigned long long MiB) {
|
||||
return operator ""_kiB(MiB * 1024);
|
||||
}
|
||||
|
||||
unsigned long long operator ""_GiB(unsigned long long GiB) {
|
||||
return operator ""_MiB(GiB * 1024);
|
||||
}
|
||||
|
||||
}
|
||||
22
plugins/libimhex/include/hex/helpers/magic.hpp
Normal file
22
plugins/libimhex/include/hex/helpers/magic.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <hex.hpp>
|
||||
|
||||
#include <hex/helpers/literals.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace hex::prv { class Provider; }
|
||||
|
||||
namespace hex::magic {
|
||||
|
||||
using namespace hex::literals;
|
||||
|
||||
bool compile();
|
||||
std::string getDescription(const std::vector<u8> &data);
|
||||
std::string getDescription(prv::Provider *provider, size_t size = 5_MiB);
|
||||
std::string getMIMEType(const std::vector<u8> &data);
|
||||
std::string getMIMEType(prv::Provider *provider, size_t size = 5_MiB);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user