示例#1
0
VLR* getLASzipVLR(std::vector<VLR*> const& vlrs)
{
    std::string userId("laszip encoded");
    uint16_t recordId(22204);

    for(size_t i = 0; i < vlrs.size(); ++i)
    {
        VLR* vlr = vlrs[i];
        std::string const& uid = vlr->userId;
        uint16_t rid = vlr->recordId;
        //
        // std::cout << "VLR recordId: " << rid << std::endl;
        // std::cout << "VLR userid: '" << uid <<"'"<< std::endl;
        // std::cout << "uid size" << uid.size() << std::endl;
        //
        // std::cout << "uid equal: " << boost::iequals(uid, userId) << std::endl;
        // std::cout << "rid equal: " << (rid == recordId) << std::endl;

        if (uid == userId && rid == recordId)
            return vlr;
    }
    return 0;
}
示例#2
0
    // This 'database lookup' function returns a match if it exists
    std::pair<uint16, uint16> IptcDataSets::decomposeKey(const std::string& key)
    {
        // Get the type, record name and dataSet name parts of the key
        std::string::size_type pos1 = key.find('.');
        if (pos1 == std::string::npos) throw Error("Invalid key");
        std::string type = key.substr(0, pos1);
        if (type != "Iptc") throw Error("Invalid key");
        std::string::size_type pos0 = pos1 + 1;
        pos1 = key.find('.', pos0);
        if (pos1 == std::string::npos) throw Error("Invalid key");
        std::string recordName = key.substr(pos0, pos1 - pos0);
        if (recordName == "") throw Error("Invalid key");
        std::string dataSetName = key.substr(pos1 + 1);
        if (dataSetName == "") throw Error("Invalid key");

        // Use the parts of the key to find dataSet and recordInfo
        uint16 recId = recordId(recordName);
        if (recId == invalidRecord) return std::make_pair((uint16)0xffff, invalidRecord);

        int idx = dataSetIdx(dataSetName, recId);
        if (idx == -1 ) return std::make_pair((uint16)0xffff, invalidRecord);

        return std::make_pair(records_[recId][idx].number_, recId);
    } // IptcDataSets::decomposeKey