本文整理汇总了C++中exiv2::value::AutoPtr::toString方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoPtr::toString方法的具体用法?C++ AutoPtr::toString怎么用?C++ AutoPtr::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exiv2::value::AutoPtr
的用法示例。
在下文中一共展示了AutoPtr::toString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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()));
}
}
示例2: 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);
}
示例3: 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();
}
示例4: exivValueToDateTime
QDateTime exivValueToDateTime(const Exiv2::Value::AutoPtr value)
{
return QDateTime::fromString(value->toString().c_str(), Qt::ISODate);
}
示例5: loadFrom
//.........这里部分代码省略.........
array.push_back(parser->parse(value));
} else {
dbgImage << "No parser " << tagName;
array.push_back(KisMetaData::Value(value));
}
}
KisMetaData::Value::ValueType vt = KisMetaData::Value::Invalid;
switch (xav->xmpArrayType()) {
case Exiv2::XmpValue::xaNone:
warnKrita << "KisXMPIO: Unsupported array";
break;
case Exiv2::XmpValue::xaAlt:
vt = KisMetaData::Value::AlternativeArray;
break;
case Exiv2::XmpValue::xaBag:
vt = KisMetaData::Value::UnorderedArray;
break;
case Exiv2::XmpValue::xaSeq:
vt = KisMetaData::Value::OrderedArray;
break;
}
v = KisMetaData::Value(array, vt);
} else if (value->typeId() == Exiv2::langAlt) {
const Exiv2::LangAltValue* xav = dynamic_cast<const Exiv2::LangAltValue*>(value.get());
QList<KisMetaData::Value> alt;
for (std::map< std::string, std::string>::const_iterator it = xav->value_.begin();
it != xav->value_.end(); ++it) {
KisMetaData::Value valt(it->second.c_str());
valt.addPropertyQualifier("xml:lang", KisMetaData::Value(it->first.c_str()));
alt.push_back(valt);
}
v = KisMetaData::Value(alt, KisMetaData::Value::LangArray);
} else {
QString valTxt = value->toString().c_str();
if (typeInfo && typeInfo->parser()) {
v = typeInfo->parser()->parse(valTxt);
} else {
dbgFile << "No parser " << tagName;
v = KisMetaData::Value(valTxt);
}
if (valTxt == "type=\"Struct\"") {
if (!typeInfo || typeInfo->propertyType() == KisMetaData::TypeInfo::StructureType) {
ignoreValue = true;
}
}
}
// set the value
dbgFile << ppVar(tagName);
if (isStructureEntry) {
structures[schema][structName][tagName] = v;
} else if (isStructureInArrayEntry) {
if (arraysOfStructures[schema][structName].size() <= arrayIndex) {
arraysOfStructures[schema][structName].resize(arrayIndex + 1);
}
arraysOfStructures[schema][structName][arrayIndex][tagName] = v;
} else {
if (!ignoreValue) {
store->addEntry(KisMetaData::Entry(schema, tagName, v));
} else {
dbgFile << "Ignoring value for " << tagName << " " << v;
}
}
}
}