本文整理汇总了C++中IptcData::copy方法的典型用法代码示例。如果您正苦于以下问题:C++ IptcData::copy方法的具体用法?C++ IptcData::copy怎么用?C++ IptcData::copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IptcData
的用法示例。
在下文中一共展示了IptcData::copy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setIptcIrb
DataBuf Photoshop::setIptcIrb(const byte* pPsData,
long sizePsData,
const IptcData& iptcData)
{
if (sizePsData > 0) assert(pPsData);
#ifdef DEBUG
std::cerr << "IRB block at the beginning of Photoshop::setIptcIrb\n";
if (sizePsData == 0) std::cerr << " None.\n";
else hexdump(std::cerr, pPsData, sizePsData);
#endif
const byte* record = pPsData;
uint32_t sizeIptc = 0;
uint32_t sizeHdr = 0;
DataBuf rc;
// Safe to call with zero psData.size_
if (0 > Photoshop::locateIptcIrb(pPsData, sizePsData,
&record, &sizeHdr, &sizeIptc)) {
return rc;
}
Blob psBlob;
const uint32_t sizeFront = static_cast<uint32_t>(record - pPsData);
// Write data before old record.
if (sizePsData > 0 && sizeFront > 0) {
append(psBlob, pPsData, sizeFront);
}
// Write new iptc record if we have it
DataBuf rawIptc(iptcData.copy());
if (rawIptc.size_ > 0) {
byte tmpBuf[12];
memcpy(tmpBuf, Photoshop::bimId_, 4);
us2Data(tmpBuf + 4, iptc_, bigEndian);
tmpBuf[6] = 0;
tmpBuf[7] = 0;
ul2Data(tmpBuf + 8, rawIptc.size_, bigEndian);
append(psBlob, tmpBuf, 12);
append(psBlob, rawIptc.pData_, rawIptc.size_);
// Data is padded to be even (but not included in size)
if (rawIptc.size_ & 1) psBlob.push_back(0x00);
}
// Write existing stuff after record, data is rounded to be even.
const uint32_t sizeOldData = sizeHdr + sizeIptc + (sizeIptc & 1);
// Note: Because of the rounding, sizeFront + sizeOldData can be
// _greater_ than sizePsData by 1 (not just equal), if the original
// data was not padded.
if (static_cast<uint32_t>(sizePsData) > sizeFront + sizeOldData) {
append(psBlob, record + sizeOldData,
sizePsData - sizeFront - sizeOldData);
}
if (psBlob.size() > 0) rc = DataBuf(&psBlob[0], static_cast<long>(psBlob.size()));
#ifdef DEBUG
std::cerr << "IRB block at the end of Photoshop::setIptcIrb\n";
if (rc.size_ == 0) std::cerr << " None.\n";
else hexdump(std::cerr, rc.pData_, rc.size_);
#endif
return rc;
} // Photoshop::setIptcIrb