Example #1
0
void processRemove(const std::string& line, int num, IptcData &iptcData)
{
    std::string::size_type keyStart = line.find_first_not_of(" \t", 1);

    if (keyStart == std::string::npos) {
        std::ostringstream os;
        os << "Invalid \'r\' command at line " << num;
        throw Error(1, os.str());
    }

    const std::string key( line.substr(keyStart) );
    IptcKey iptcKey(key);

    IptcData::iterator iter = iptcData.findKey(iptcKey);
    if (iter != iptcData.end()) {
        iptcData.erase(iter);
    }
}
Example #2
0
void processRemove(const std::string& line, int num)
{
    std::string::size_type keyStart = line.find_first_not_of(" \t", 1);

    if (keyStart == std::string::npos) {
        std::ostringstream os;
        os << "Invalid \'r\' command at line " << num;
        throw Error(os.str());
    }

    const std::string key( line.substr(keyStart) );
    std::pair<uint16, uint16> p = IptcDataSets::decomposeKey(key);
    if (p.first == 0xffff) throw Error("Invalid key" + key);
    if (p.second == IptcDataSets::invalidRecord) throw Error("Invalid key" + key);

    IptcData::iterator iter = g_iptcData.findId(p.first, p.second);
    if (iter != g_iptcData.end()) {
        g_iptcData.erase(iter);
    }
}