本文整理汇总了C++中exiv2::value::AutoPtr::typeId方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoPtr::typeId方法的具体用法?C++ AutoPtr::typeId怎么用?C++ AutoPtr::typeId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exiv2::value::AutoPtr
的用法示例。
在下文中一共展示了AutoPtr::typeId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deviceSettingDescriptionExifToKMD
KisMetaData::Value deviceSettingDescriptionExifToKMD(const Exiv2::Value::AutoPtr value)
{
QMap<QString, KisMetaData::Value> deviceSettingStructure;
QByteArray array;
const Exiv2::DataValue* dvalue = dynamic_cast<const Exiv2::DataValue*>(&*value);
if(dvalue)
{
array.resize(dvalue->count());
dvalue->copy((Exiv2::byte*)array.data());
} else {
Q_ASSERT(value->typeId() == Exiv2::unsignedShort);
array.resize(2 * value->count());
value->copy((Exiv2::byte*)array.data(), Exiv2::littleEndian);
}
int columns = (reinterpret_cast<quint16*>(array.data()))[0];
int rows = (reinterpret_cast<quint16*>(array.data()))[1];
deviceSettingStructure["Columns"] = KisMetaData::Value(columns);
deviceSettingStructure["Rows"] = KisMetaData::Value(rows);
QList<KisMetaData::Value> settings;
QByteArray null(2, 0);
for (int index = 4; index < array.size(); )
{
int lastIndex = array.indexOf(null, index);
QString setting = QString::fromUtf16((ushort*)(void*)( array.data() + index), lastIndex - index + 2);
index = lastIndex + 2;
dbgFile << "Setting << " << setting;
settings.append(KisMetaData::Value(setting));
}
deviceSettingStructure["Settings"] = KisMetaData::Value(settings, KisMetaData::Value::OrderedArray);
return KisMetaData::Value(deviceSettingStructure);
}
示例2: exifVersionToKMDValue
// convert ExifVersion and FlashpixVersion to a KisMetaData value
KisMetaData::Value exifVersionToKMDValue(const Exiv2::Value::AutoPtr value)
{
const Exiv2::DataValue* dvalue = dynamic_cast<const Exiv2::DataValue*>(&*value);
if(dvalue)
{
Q_ASSERT(dvalue);
QByteArray array(dvalue->count(), 0);
dvalue->copy((Exiv2::byte*)array.data());
return KisMetaData::Value(QString(array));
} else {
Q_ASSERT(value->typeId() == Exiv2::asciiString);
return KisMetaData::Value(QString::fromLatin1(value->toString().c_str()));
}
}
示例3: exifArrayToKMDIntOrderedArray
// Convert an exif array of integer string to a KisMetaData array of integer
KisMetaData::Value exifArrayToKMDIntOrderedArray(const Exiv2::Value::AutoPtr value)
{
QList<KisMetaData::Value> v;
const Exiv2::DataValue* dvalue = dynamic_cast<const Exiv2::DataValue*>(&*value);
if(dvalue)
{
QByteArray array(dvalue->count(), 0);
dvalue->copy((Exiv2::byte*)array.data());
for (int i = 0; i < array.size(); i++) {
QChar c((char)array[i]);
v.push_back(KisMetaData::Value(QString(c).toInt(0)));
}
} else {
Q_ASSERT(value->typeId() == Exiv2::asciiString);
QString str = QString::fromLatin1(value->toString().c_str());
v.push_back(KisMetaData::Value(str.toInt()));
}
return KisMetaData::Value(v, KisMetaData::Value::OrderedArray);
}
示例4: exivValueToKMDValue
// Convert an exiv value to a KisMetaData value
KisMetaData::Value exivValueToKMDValue(const Exiv2::Value::AutoPtr value, bool forceSeq, KisMetaData::Value::ValueType arrayType)
{
switch (value->typeId()) {
case Exiv2::signedByte:
case Exiv2::invalidTypeId:
case Exiv2::lastTypeId:
case Exiv2::directory:
dbgFile << "Invalid value :" << value->typeId() << " value =" << value->toString().c_str();
return KisMetaData::Value();
case Exiv2::undefined: {
dbgFile << "Undefined value :" << value->typeId() << " value =" << value->toString().c_str();
QByteArray array(value->count() , 0);
value->copy((Exiv2::byte*)array.data(), Exiv2::invalidByteOrder);
return KisMetaData::Value(QString(array.toBase64()));
}
case Exiv2::unsignedByte:
case Exiv2::unsignedShort:
case Exiv2::unsignedLong:
case Exiv2::signedShort:
case Exiv2::signedLong: {
if (value->count() == 1 && !forceSeq) {
return KisMetaData::Value((int)value->toLong());
} else {
QList<KisMetaData::Value> array;
for (int i = 0; i < value->count(); i++)
array.push_back(KisMetaData::Value((int)value->toLong(i)));
return KisMetaData::Value(array, arrayType);
}
}
case Exiv2::asciiString:
case Exiv2::string:
case Exiv2::comment: // look at kexiv2 for the problem about decoding correctly that tag
return KisMetaData::Value(value->toString().c_str());
case Exiv2::unsignedRational:
if(value->size() < 2)
{
dbgFile << "Invalid size :" << value->size() << " value =" << value->toString().c_str();
return KisMetaData::Value();
}
return KisMetaData::Value(KisMetaData::Rational(value->toRational().first , value->toRational().second));
case Exiv2::signedRational:
if(value->size() < 2)
{
dbgFile << "Invalid size :" << value->size() << " value =" << value->toString().c_str();
return KisMetaData::Value();
}
return KisMetaData::Value(KisMetaData::Rational(value->toRational().first , value->toRational().second));
case Exiv2::date:
case Exiv2::time:
return KisMetaData::Value(QDateTime::fromString(value->toString().c_str(), Qt::ISODate));
case Exiv2::xmpText:
case Exiv2::xmpAlt:
case Exiv2::xmpBag:
case Exiv2::xmpSeq:
case Exiv2::langAlt:
default: {
dbgFile << "Unknown type id :" << value->typeId() << " value =" << value->toString().c_str();
//Q_ASSERT(false); // This point must never be reached !
return KisMetaData::Value();
}
}
dbgFile << "Unknown type id :" << value->typeId() << " value =" << value->toString().c_str();
//Q_ASSERT(false); // This point must never be reached !
return KisMetaData::Value();
}
示例5: loadFrom
bool KisXMPIO::loadFrom(KisMetaData::Store* store, QIODevice* ioDevice) const
{
ioDevice->open(QIODevice::ReadOnly);
dbgFile << "Load XMP Data";
std::string xmpPacket_;
QByteArray arr = ioDevice->readAll();
xmpPacket_.assign(arr.data(), arr.length());
dbgFile << xmpPacket_.length();
// dbgFile << xmpPacket_.c_str();
Exiv2::XmpData xmpData_;
Exiv2::XmpParser::decode(xmpData_, xmpPacket_);
QMap< const KisMetaData::Schema*, QMap<QString, QMap<QString, KisMetaData::Value> > > structures;
QMap< const KisMetaData::Schema*, QMap<QString, QVector< QMap<QString, KisMetaData::Value> > > > arraysOfStructures;
for (Exiv2::XmpData::iterator it = xmpData_.begin(); it != xmpData_.end(); ++it) {
dbgFile << it->key().c_str();
Exiv2::XmpKey key(it->key());
dbgFile << key.groupName().c_str() << " " << key.tagName().c_str() << " " << key.ns().c_str();
if ((key.groupName() == "exif" || key.groupName() == "tiff") && key.tagName() == "NativeDigest") { // TODO: someone who has time to lose can look in adding support for NativeDigest, it's undocumented use by the XMP SDK to check if exif data has been changed while XMP hasn't been updated
dbgFile << "dropped";
} else {
const KisMetaData::Schema* schema = KisMetaData::SchemaRegistry::instance()->schemaFromPrefix(key.groupName().c_str());
if (!schema) {
schema = KisMetaData::SchemaRegistry::instance()->schemaFromUri(key.ns().c_str());
if (!schema) {
schema = KisMetaData::SchemaRegistry::instance()->create(key.ns().c_str(), key.groupName().c_str());
Q_ASSERT(schema);
}
}
const Exiv2::Value::AutoPtr value = it->getValue();
// Decrypt key
QString structName = "";
QString tagName = key.tagName().c_str();
int arrayIndex = -1;
const KisMetaData::TypeInfo* typeInfo = 0;
bool isStructureEntry = false;
bool isStructureInArrayEntry = false;
if (tagName.contains("/")) {
QRegExp regexp("([A-Za-z]\\w+)/([A-Za-z]\\w+):([A-Za-z]\\w+)");
if (regexp.indexIn(tagName) != -1) {
structName = regexp.capturedTexts()[1];
tagName = regexp.capturedTexts()[3];
typeInfo = schema->propertyType(structName);
Q_ASSERT(typeInfo == schema->propertyType(structName));
if (typeInfo && typeInfo->propertyType() == KisMetaData::TypeInfo::StructureType) {
typeInfo = typeInfo->structureSchema()->propertyType(tagName);
}
isStructureEntry = true;
} else {
QRegExp regexp2("([A-Za-z]\\w+)\\[(\\d+)\\]/([A-Za-z]\\w+):([A-Za-z]\\w+)");
if (regexp2.indexIn(tagName) != -1) {
dbgFile << ppVar(tagName);
structName = regexp2.capturedTexts()[1];
arrayIndex = regexp2.capturedTexts()[2].toInt() - 1;
tagName = regexp2.capturedTexts()[4];
dbgFile << ppVar(structName) << ppVar(regexp2.capturedTexts()[3]);
//Q_ASSERT(schema->propertyType(structName));
if (schema->propertyType(structName)) {
typeInfo = schema->propertyType(structName)->embeddedPropertyType();
Q_ASSERT(typeInfo);
if (typeInfo && typeInfo->propertyType() == KisMetaData::TypeInfo::StructureType) {
typeInfo = typeInfo->structureSchema()->propertyType(tagName);
}
}
isStructureInArrayEntry = true;
} else {
dbgFile << "Decoding structure name/entry failed: " << tagName;
}
}
} else {
typeInfo = schema->propertyType(tagName);
}
KisMetaData::Value v;
bool ignoreValue = false;
// Compute the value
if (value->typeId() == Exiv2::xmpBag
|| value->typeId() == Exiv2::xmpSeq
|| value->typeId() == Exiv2::xmpAlt) {
const KisMetaData::TypeInfo* embeddedTypeInfo = 0;
if (typeInfo) {
embeddedTypeInfo = typeInfo->embeddedPropertyType();
}
const KisMetaData::Parser* parser = 0;
if (embeddedTypeInfo) {
parser = embeddedTypeInfo->parser();
}
const Exiv2::XmpArrayValue* xav = dynamic_cast<const Exiv2::XmpArrayValue*>(value.get());
Q_ASSERT(xav);
QList<KisMetaData::Value> array;
for (std::vector< std::string >::const_iterator it = xav->value_.begin();
it != xav->value_.end(); ++it) {
QString value = it->c_str();
if (parser) {
array.push_back(parser->parse(value));
} else {
dbgImage << "No parser " << tagName;
array.push_back(KisMetaData::Value(value));
}
}
KisMetaData::Value::ValueType vt = KisMetaData::Value::Invalid;
//.........这里部分代码省略.........