small fixes
This commit is contained in:
parent
4752b4d6b2
commit
779f9d9bab
33
TIFF.cpp
33
TIFF.cpp
@ -4,6 +4,7 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
static const std::map<TiffTag, std::string> tagDescriptions = {
|
static const std::map<TiffTag, std::string> tagDescriptions = {
|
||||||
{NEW_SUBFILE_TYPE, "New subfile type"},
|
{NEW_SUBFILE_TYPE, "New subfile type"},
|
||||||
@ -35,7 +36,8 @@ static const std::map<TiffTag, std::string> tagDescriptions = {
|
|||||||
{ISO_SPEED_RATINGS, "ISO"},
|
{ISO_SPEED_RATINGS, "ISO"},
|
||||||
{DATE_TIME_ORIGINAL, "Date/time original"},
|
{DATE_TIME_ORIGINAL, "Date/time original"},
|
||||||
{FOCAL_LENGTH, "Focal length (mm)"},
|
{FOCAL_LENGTH, "Focal length (mm)"},
|
||||||
{TIFF_EP_STANDARD_ID, "TIFF/EP standard ID"}
|
{TIFF_EP_STANDARD_ID, "TIFF/EP standard ID"},
|
||||||
|
{COPYRIGHT_NOTICE, "Copyright notice"}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &stream, Compression compression) {
|
std::ostream &operator<<(std::ostream &stream, Compression compression) {
|
||||||
@ -107,17 +109,22 @@ std::ostream& operator<<(std::ostream& stream, PlanarConfiguration conf) {
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
std::ostream& operator<<(std::ostream& stream, const std::vector<T>& vector) {
|
std::ostream& operator<<(std::ostream& stream, const std::vector<T>& vector) {
|
||||||
std::ios_base::fmtflags f(stream.flags());
|
size_t vSize = vector.size();
|
||||||
if(vector.size() > 10) {
|
if(vSize > 10) {
|
||||||
stream << "<vector> (" + std::to_string(vector.size()) + ")";
|
stream << "<vector> (" + std::to_string(vector.size()) + ")";
|
||||||
} else {
|
|
||||||
stream << std::setw(0) << "[" << vector[0];
|
|
||||||
std::accumulate(std::next(vector.begin()), vector.end(), std::string(), [&stream](std::string a, T elem){
|
|
||||||
stream << ", " << elem;
|
|
||||||
});
|
|
||||||
stream << "]";
|
|
||||||
}
|
}
|
||||||
stream.flags(f);
|
else {
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::setw(0) << "[";
|
||||||
|
for(size_t i = 0; i < vSize; ++i) {
|
||||||
|
ss << vector[i];
|
||||||
|
if(i < vSize - 1) {
|
||||||
|
ss << ", ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ss << "]";
|
||||||
|
stream << ss.str();
|
||||||
|
}
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +189,11 @@ ImageFileDirectory::ImageFileDirectory(char* ptr, char* filePtr) {
|
|||||||
auto entry = _entries[i];
|
auto entry = _entries[i];
|
||||||
|
|
||||||
switch (entry.type) {
|
switch (entry.type) {
|
||||||
case ASCII: _entriesMap.emplace(entry.tag, EntryValueType(std::string(filePtr + entry.valueOrOffset))); break;
|
case ASCII: {
|
||||||
|
auto str = entry.numberOfValues > 1 ? std::string(filePtr + entry.valueOrOffset) : std::string();
|
||||||
|
_entriesMap.emplace(entry.tag, EntryValueType(str));
|
||||||
|
break;
|
||||||
|
}
|
||||||
case BYTE: parseValue<uint8_t>(filePtr, &entry); break;
|
case BYTE: parseValue<uint8_t>(filePtr, &entry); break;
|
||||||
case SHORT: parseValue<uint16_t>(filePtr, &entry); break;
|
case SHORT: parseValue<uint16_t>(filePtr, &entry); break;
|
||||||
case LONG: parseValue<uint32_t>(filePtr, &entry); break;
|
case LONG: parseValue<uint32_t>(filePtr, &entry); break;
|
||||||
|
|||||||
1
TIFF.h
1
TIFF.h
@ -54,6 +54,7 @@ enum TiffTag: uint16_t {
|
|||||||
XML_PACKET = 0x2BC,
|
XML_PACKET = 0x2BC,
|
||||||
CFA_REPEAT_PATTERN_DIM = 0x828D,
|
CFA_REPEAT_PATTERN_DIM = 0x828D,
|
||||||
CFA_PATTERN = 0x828E,
|
CFA_PATTERN = 0x828E,
|
||||||
|
COPYRIGHT_NOTICE = 0x8298,
|
||||||
EXPOSURE_TIME = 0x829A,
|
EXPOSURE_TIME = 0x829A,
|
||||||
F_NUMBER = 0x829D,
|
F_NUMBER = 0x829D,
|
||||||
EXIF_IFD = 0x8769,
|
EXIF_IFD = 0x8769,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user