当前位置: 首页>>代码示例>>C++>>正文


C++ IptcData::begin方法代码示例

本文整理汇总了C++中IptcData::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ IptcData::begin方法的具体用法?C++ IptcData::begin怎么用?C++ IptcData::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IptcData的用法示例。


在下文中一共展示了IptcData::begin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: encode

    DataBuf IptcParser::encode(const IptcData& iptcData)
    {
        DataBuf buf(iptcData.size());
        byte *pWrite = buf.pData_;

        IptcData::const_iterator iter = iptcData.begin();
        IptcData::const_iterator end = iptcData.end();
        for ( ; iter != end; ++iter) {
            // marker, record Id, dataset num
            *pWrite++ = marker_;
            *pWrite++ = static_cast<byte>(iter->record());
            *pWrite++ = static_cast<byte>(iter->tag());

            // extended or standard dataset?
            long dataSize = iter->size();
            if (dataSize > 32767) {
                // always use 4 bytes for extended length
                uint16_t sizeOfSize = 4 | 0x8000;
                us2Data(pWrite, sizeOfSize, bigEndian);
                pWrite += 2;
                ul2Data(pWrite, dataSize, bigEndian);
                pWrite += 4;
            }
            else {
                us2Data(pWrite, static_cast<uint16_t>(dataSize), bigEndian);
                pWrite += 2;
            }
            pWrite += iter->value().copy(pWrite, bigEndian);
        }

        return buf;
    } // IptcParser::encode
开发者ID:dtbinh,项目名称:dviz,代码行数:32,代码来源:iptc.cpp

示例2: encode

DataBuf IptcParser::encode(const IptcData& iptcData)
{
    DataBuf buf(iptcData.size());
    byte *pWrite = buf.pData_;

    // Copy the iptc data sets and sort them by record but preserve the order of datasets
    IptcMetadata sortedIptcData;
    std::copy(iptcData.begin(), iptcData.end(), std::back_inserter(sortedIptcData));
    std::stable_sort(sortedIptcData.begin(), sortedIptcData.end(), cmpIptcdataByRecord);

    IptcData::const_iterator iter = sortedIptcData.begin();
    IptcData::const_iterator end = sortedIptcData.end();
    for ( ; iter != end; ++iter) {
        // marker, record Id, dataset num
        *pWrite++ = marker_;
        *pWrite++ = static_cast<byte>(iter->record());
        *pWrite++ = static_cast<byte>(iter->tag());

        // extended or standard dataset?
        long dataSize = iter->size();
        if (dataSize > 32767) {
            // always use 4 bytes for extended length
            uint16_t sizeOfSize = 4 | 0x8000;
            us2Data(pWrite, sizeOfSize, bigEndian);
            pWrite += 2;
            ul2Data(pWrite, dataSize, bigEndian);
            pWrite += 4;
        }
        else {
            us2Data(pWrite, static_cast<uint16_t>(dataSize), bigEndian);
            pWrite += 2;
        }
        pWrite += iter->value().copy(pWrite, bigEndian);
    }

    return buf;
} // IptcParser::encode
开发者ID:ahuggel,项目名称:exiv2,代码行数:37,代码来源:iptc.cpp


注:本文中的IptcData::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。