|
|
@ -19,72 +19,51 @@ Value::Value(TypeId typeId) : type_(typeId) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Value::UniquePtr Value::create(TypeId typeId) {
|
|
|
|
Value::UniquePtr Value::create(TypeId typeId) {
|
|
|
|
std::unique_ptr<Value> value;
|
|
|
|
|
|
|
|
switch (typeId) {
|
|
|
|
switch (typeId) {
|
|
|
|
case invalidTypeId:
|
|
|
|
case invalidTypeId:
|
|
|
|
case signedByte:
|
|
|
|
case signedByte:
|
|
|
|
case unsignedByte:
|
|
|
|
case unsignedByte:
|
|
|
|
value = std::make_unique<DataValue>(typeId);
|
|
|
|
return std::make_unique<DataValue>(typeId);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case asciiString:
|
|
|
|
case asciiString:
|
|
|
|
value = std::make_unique<AsciiValue>();
|
|
|
|
return std::make_unique<AsciiValue>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case unsignedShort:
|
|
|
|
case unsignedShort:
|
|
|
|
value = std::make_unique<ValueType<uint16_t>>();
|
|
|
|
return std::make_unique<ValueType<uint16_t>>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case unsignedLong:
|
|
|
|
case unsignedLong:
|
|
|
|
case tiffIfd:
|
|
|
|
case tiffIfd:
|
|
|
|
value = std::make_unique<ValueType<uint32_t>>(typeId);
|
|
|
|
return std::make_unique<ValueType<uint32_t>>(typeId);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case unsignedRational:
|
|
|
|
case unsignedRational:
|
|
|
|
value = std::make_unique<ValueType<URational>>();
|
|
|
|
return std::make_unique<ValueType<URational>>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case undefined:
|
|
|
|
case undefined:
|
|
|
|
value = std::make_unique<DataValue>();
|
|
|
|
return std::make_unique<DataValue>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case signedShort:
|
|
|
|
case signedShort:
|
|
|
|
value = std::make_unique<ValueType<int16_t>>();
|
|
|
|
return std::make_unique<ValueType<int16_t>>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case signedLong:
|
|
|
|
case signedLong:
|
|
|
|
value = std::make_unique<ValueType<int32_t>>();
|
|
|
|
return std::make_unique<ValueType<int32_t>>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case signedRational:
|
|
|
|
case signedRational:
|
|
|
|
value = std::make_unique<ValueType<Rational>>();
|
|
|
|
return std::make_unique<ValueType<Rational>>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case tiffFloat:
|
|
|
|
case tiffFloat:
|
|
|
|
value = std::make_unique<ValueType<float>>();
|
|
|
|
return std::make_unique<ValueType<float>>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case tiffDouble:
|
|
|
|
case tiffDouble:
|
|
|
|
value = std::make_unique<ValueType<double>>();
|
|
|
|
return std::make_unique<ValueType<double>>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case string:
|
|
|
|
case string:
|
|
|
|
value = std::make_unique<StringValue>();
|
|
|
|
return std::make_unique<StringValue>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case date:
|
|
|
|
case date:
|
|
|
|
value = std::make_unique<DateValue>();
|
|
|
|
return std::make_unique<DateValue>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case time:
|
|
|
|
case time:
|
|
|
|
value = std::make_unique<TimeValue>();
|
|
|
|
return std::make_unique<TimeValue>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case comment:
|
|
|
|
case comment:
|
|
|
|
value = std::make_unique<CommentValue>();
|
|
|
|
return std::make_unique<CommentValue>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case xmpText:
|
|
|
|
case xmpText:
|
|
|
|
value = std::make_unique<XmpTextValue>();
|
|
|
|
return std::make_unique<XmpTextValue>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case xmpBag:
|
|
|
|
case xmpBag:
|
|
|
|
case xmpSeq:
|
|
|
|
case xmpSeq:
|
|
|
|
case xmpAlt:
|
|
|
|
case xmpAlt:
|
|
|
|
value = std::make_unique<XmpArrayValue>(typeId);
|
|
|
|
return std::make_unique<XmpArrayValue>(typeId);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case langAlt:
|
|
|
|
case langAlt:
|
|
|
|
value = std::make_unique<LangAltValue>();
|
|
|
|
return std::make_unique<LangAltValue>();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
value = std::make_unique<DataValue>(typeId);
|
|
|
|
return std::make_unique<DataValue>(typeId);
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return value;
|
|
|
|
|
|
|
|
} // Value::create
|
|
|
|
} // Value::create
|
|
|
|
|
|
|
|
|
|
|
|
int Value::setDataArea(const byte* /*buf*/, size_t /*len*/) {
|
|
|
|
int Value::setDataArea(const byte* /*buf*/, size_t /*len*/) {
|
|
|
|