本文整理汇总了C++中IptcData::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ IptcData::clear方法的具体用法?C++ IptcData::clear怎么用?C++ IptcData::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IptcData
的用法示例。
在下文中一共展示了IptcData::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decode
int IptcParser::decode(
IptcData& iptcData,
const byte* pData,
uint32_t size
)
{
#ifdef DEBUG
std::cerr << "IptcParser::decode, size = " << size << "\n";
#endif
const byte* pRead = pData;
iptcData.clear();
uint16_t record = 0;
uint16_t dataSet = 0;
uint32_t sizeData = 0;
byte extTest = 0;
while (pRead + 3 < pData + size) {
// First byte should be a marker. If it isn't, scan forward and skip
// the chunk bytes present in some images. This deviates from the
// standard, which advises to treat such cases as errors.
if (*pRead++ != marker_) continue;
record = *pRead++;
dataSet = *pRead++;
extTest = *pRead;
if (extTest & 0x80) {
// extended dataset
uint16_t sizeOfSize = (getUShort(pRead, bigEndian) & 0x7FFF);
if (sizeOfSize > 4) return 5;
pRead += 2;
sizeData = 0;
for (; sizeOfSize > 0; --sizeOfSize) {
sizeData |= *pRead++ << (8 *(sizeOfSize-1));
}
}
else {
// standard dataset
sizeData = getUShort(pRead, bigEndian);
pRead += 2;
}
if (pRead + sizeData <= pData + size) {
int rc = 0;
if ((rc = readData(iptcData, dataSet, record, pRead, sizeData)) != 0) {
#ifndef SUPPRESS_WARNINGS
EXV_WARNING << "Failed to read IPTC dataset "
<< IptcKey(dataSet, record)
<< " (rc = " << rc << "); skipped.\n";
#endif
}
}
#ifndef SUPPRESS_WARNINGS
else {
EXV_WARNING << "IPTC dataset " << IptcKey(dataSet, record)
<< " has invalid size " << sizeData << "; skipped.\n";
}
#endif
pRead += sizeData;
}
return 0;
} // IptcParser::decode