Coverage Report

Created: 2026-12-01 06:15

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/exiv2/src/sigmamn_int.cpp
Line
Count
Source
1
// SPDX-License-Identifier: GPL-2.0-or-later
2
3
// included header files
4
#include "sigmamn_int.hpp"
5
#include "i18n.h"  // NLS support.
6
#include "tags.hpp"
7
#include "tags_int.hpp"
8
#include "types.hpp"
9
#include "value.hpp"
10
11
// + standard includes
12
#include <ostream>
13
#include <string>
14
15
// *****************************************************************************
16
// class member definitions
17
namespace Exiv2::Internal {
18
// Sigma (Foveon) MakerNote Tag Info
19
constexpr TagInfo SigmaMakerNote::tagInfo_[] = {
20
    {0x0002, "SerialNumber", N_("Serial Number"), N_("Camera serial number"), IfdId::sigmaId, SectionId::makerTags,
21
     asciiString, -1, printValue},
22
    {0x0003, "DriveMode", N_("Drive Mode"), N_("Drive mode"), IfdId::sigmaId, SectionId::makerTags, asciiString, -1,
23
     printValue},
24
    {0x0004, "ResolutionMode", N_("Resolution Mode"), N_("Resolution mode"), IfdId::sigmaId, SectionId::makerTags,
25
     asciiString, -1, printValue},
26
    {0x0005, "AutofocusMode", N_("Autofocus Mode"), N_("Autofocus mode"), IfdId::sigmaId, SectionId::makerTags,
27
     asciiString, -1, printValue},
28
    {0x0006, "FocusSetting", N_("Focus Setting"), N_("Focus setting"), IfdId::sigmaId, SectionId::makerTags,
29
     asciiString, -1, printValue},
30
    {0x0007, "WhiteBalance", N_("White Balance"), N_("White balance"), IfdId::sigmaId, SectionId::makerTags,
31
     asciiString, -1, printValue},
32
    {0x0008, "ExposureMode", N_("Exposure Mode"), N_("Exposure mode"), IfdId::sigmaId, SectionId::makerTags,
33
     asciiString, -1, print0x0008},
34
    {0x0009, "MeteringMode", N_("Metering Mode"), N_("Metering mode"), IfdId::sigmaId, SectionId::makerTags,
35
     asciiString, -1, print0x0009},
36
    {0x000a, "LensRange", N_("Lens Range"), N_("Lens focal length range"), IfdId::sigmaId, SectionId::makerTags,
37
     asciiString, -1, printValue},
38
    {0x000b, "ColorSpace", N_("Color Space"), N_("Color space"), IfdId::sigmaId, SectionId::makerTags, asciiString, -1,
39
     printValue},
40
    {0x000c, "Exposure", N_("Exposure"), N_("Exposure"), IfdId::sigmaId, SectionId::makerTags, asciiString, -1,
41
     printStripLabel},
42
    {0x000d, "Contrast", N_("Contrast"), N_("Contrast"), IfdId::sigmaId, SectionId::makerTags, asciiString, -1,
43
     printStripLabel},
44
    {0x000e, "Shadow", N_("Shadow"), N_("Shadow"), IfdId::sigmaId, SectionId::makerTags, asciiString, -1,
45
     printStripLabel},
46
    {0x000f, "Highlight", N_("Highlight"), N_("Highlight"), IfdId::sigmaId, SectionId::makerTags, asciiString, -1,
47
     printStripLabel},
48
    {0x0010, "Saturation", N_("Saturation"), N_("Saturation"), IfdId::sigmaId, SectionId::makerTags, asciiString, -1,
49
     printStripLabel},
50
    {0x0011, "Sharpness", N_("Sharpness"), N_("Sharpness"), IfdId::sigmaId, SectionId::makerTags, asciiString, -1,
51
     printStripLabel},
52
    {0x0012, "FillLight", N_("Fill Light"), N_("X3 Fill light"), IfdId::sigmaId, SectionId::makerTags, asciiString, -1,
53
     printStripLabel},
54
    {0x0014, "ColorAdjustment", N_("Color Adjustment"), N_("Color adjustment"), IfdId::sigmaId, SectionId::makerTags,
55
     asciiString, -1, printStripLabel},
56
    {0x0015, "AdjustmentMode", N_("Adjustment Mode"), N_("Adjustment mode"), IfdId::sigmaId, SectionId::makerTags,
57
     asciiString, -1, printValue},
58
    {0x0016, "Quality", N_("Quality"), N_("Quality"), IfdId::sigmaId, SectionId::makerTags, asciiString, -1,
59
     printStripLabel},
60
    {0x0017, "Firmware", N_("Firmware"), N_("Firmware"), IfdId::sigmaId, SectionId::makerTags, asciiString, -1,
61
     printValue},
62
    {0x0018, "Software", N_("Software"), N_("Software"), IfdId::sigmaId, SectionId::makerTags, asciiString, -1,
63
     printValue},
64
    {0x0019, "AutoBracket", N_("Auto Bracket"), N_("Auto bracket"), IfdId::sigmaId, SectionId::makerTags, asciiString,
65
     -1, printValue},
66
    // End of list marker
67
    {0xffff, "(UnknownSigmaMakerNoteTag)", "(UnknownSigmaMakerNoteTag)", N_("Unknown SigmaMakerNote tag"),
68
     IfdId::sigmaId, SectionId::makerTags, asciiString, -1, printValue},
69
};
70
71
544
std::ostream& SigmaMakerNote::printStripLabel(std::ostream& os, const Value& value, const ExifData*) {
72
544
  std::string v = value.toString();
73
544
  if (auto pos = v.find(':'); pos != std::string::npos) {
74
196
    if (v.at(pos + 1) == ' ')
75
74
      ++pos;
76
196
    v = v.substr(pos + 1);
77
196
  }
78
544
  return os << v;
79
544
}
80
81
580
std::ostream& SigmaMakerNote::print0x0008(std::ostream& os, const Value& value, const ExifData*) {
82
580
  std::string v = value.toString();
83
580
  if (v.empty()) {
84
166
    return os;
85
166
  }
86
414
  switch (v.front()) {
87
32
    case 'P':
88
32
      return os << _("Program");
89
56
    case 'A':
90
56
      return os << _("Aperture priority");
91
16
    case 'S':
92
16
      return os << _("Shutter priority");
93
32
    case 'M':
94
32
      return os << _("Manual");
95
278
    default:
96
278
      return os << "(" << value << ")";
97
414
  }
98
414
}
99
100
504
std::ostream& SigmaMakerNote::print0x0009(std::ostream& os, const Value& value, const ExifData*) {
101
504
  std::string v = value.toString();
102
504
  if (v.empty()) {
103
76
    return os;
104
76
  }
105
428
  switch (v.front()) {
106
68
    case 'A':
107
68
      return os << _("Average");
108
96
    case 'C':
109
96
      return os << _("Center");
110
38
    case '8':
111
38
      return os << _("8-Segment");
112
226
    default:
113
226
      return os << "(" << value << ")";
114
428
  }
115
428
}
116
117
}  // namespace Exiv2::Internal