static folly::Optional FSPInternalEntry()

in ios/SpectrumKit/SpectrumKit/Image/FSPImageMetadata.mm [179:201]


static folly::Optional<Entry> FSPInternalEntry(NSArray<NSNumber *> *mapping, id value)
{
  const auto tag = static_cast<Entry::Tag>([mapping.firstObject unsignedShortValue]);
  const auto type = static_cast<Entry::Type>([mapping.lastObject unsignedIntegerValue]);

  switch (type) {
    case facebook::spectrum::image::metadata::Entry::BYTE:
    case facebook::spectrum::image::metadata::Entry::UNDEFINED:
      return FSPEntryWithTagTypeAndUntypedValue<std::uint8_t>(tag, type, value);
    case facebook::spectrum::image::metadata::Entry::ASCII:
      return FSPEntryWithTagTypeAndUntypedValue<char>(tag, type, value);
    case facebook::spectrum::image::metadata::Entry::SHORT:
      return FSPEntryWithTagTypeAndUntypedValue<std::uint16_t>(tag, type, value);
    case facebook::spectrum::image::metadata::Entry::LONG:
      return FSPEntryWithTagTypeAndUntypedValue<std::uint32_t>(tag, type, value);
    case facebook::spectrum::image::metadata::Entry::RATIONAL:
      return FSPEntryWithTagTypeAndUntypedValue<Rational>(tag, type, value);
    case facebook::spectrum::image::metadata::Entry::SLONG:
      return FSPEntryWithTagTypeAndUntypedValue<int32_t>(tag, type, value);
    case facebook::spectrum::image::metadata::Entry::SRATIONAL:
      return FSPEntryWithTagTypeAndUntypedValue<SRational>(tag, type, value);
  }
}