small fixes
This commit is contained in:
parent
4752b4d6b2
commit
779f9d9bab
33
TIFF.cpp
33
TIFF.cpp
@ -4,6 +4,7 @@
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <sstream>
|
||||
|
||||
static const std::map<TiffTag, std::string> tagDescriptions = {
|
||||
{NEW_SUBFILE_TYPE, "New subfile type"},
|
||||
@ -35,7 +36,8 @@ static const std::map<TiffTag, std::string> tagDescriptions = {
|
||||
{ISO_SPEED_RATINGS, "ISO"},
|
||||
{DATE_TIME_ORIGINAL, "Date/time original"},
|
||||
{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) {
|
||||
@ -107,17 +109,22 @@ std::ostream& operator<<(std::ostream& stream, PlanarConfiguration conf) {
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& stream, const std::vector<T>& vector) {
|
||||
std::ios_base::fmtflags f(stream.flags());
|
||||
if(vector.size() > 10) {
|
||||
size_t vSize = vector.size();
|
||||
if(vSize > 10) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -182,7 +189,11 @@ ImageFileDirectory::ImageFileDirectory(char* ptr, char* filePtr) {
|
||||
auto entry = _entries[i];
|
||||
|
||||
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 SHORT: parseValue<uint16_t>(filePtr, &entry); break;
|
||||
case LONG: parseValue<uint32_t>(filePtr, &entry); break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user