View | Details | Raw Unified
Collapse All | Expand All

(-) ../../tags/gatt-0.6.1/src/atom.cc (-6 / +16 lines)
 Lines 36-41    Link Here 
bool toNextPotenialExactAtom(string::const_iterator& p, const string::const_iterator& end, bool ignoreMissingPrefix);
bool toNextPotenialExactAtom(string::const_iterator& p, const string::const_iterator& end, bool ignoreMissingPrefix);
bool sequenceAdvance(const string& sequence, string::const_iterator& p, const string::const_iterator& end);
bool sequenceAdvance(const string& sequence, string::const_iterator& p, const string::const_iterator& end);
int versionNumberCompare(const string& ls, const string& rs);
int versionNumberCompare(const string& ls, const string& rs);
int toCannocalValue(int arg);
class PVSuffixToken
class PVSuffixToken
{
{
 Lines 190-196    Link Here 
        }
        }
    }
    }
    return lls.compare(rrs);
    
    //we want this function to return -1, 0 or 1!
    return toCannocalValue(lls.compare(rrs));
}
inline int toCannocalValue(int arg)
{
    if(arg != 0)
        return (arg < 0 ? -1 : 1);
    return 0;
}
}
PVSuffixToken::PVSuffixToken(const string& str)
PVSuffixToken::PVSuffixToken(const string& str)
 Lines 463-469    Link Here 
{
{
    string opMe(getCategory() + getPN());
    string opMe(getCategory() + getPN());
    string opOther(other.getCategory() + other.getPN());
    string opOther(other.getCategory() + other.getPN());
    return opMe.compare(opOther);
    return local::toCannocalValue(opMe.compare(opOther));
}
}
int Atom::comparePV(const ExactAtom& other) const
int Atom::comparePV(const ExactAtom& other) const
 Lines 478-484    Link Here 
        string ov(other._pv);
        string ov(other._pv);
        if(ov.size() > mv.size())
        if(ov.size() > mv.size())
            ov.erase(mv.size());
            ov.erase(mv.size());
        return mv.compare(ov);
        return local::toCannocalValue(mv.compare(ov));
    }
    }
    if(_pv.empty() || other._pv.empty())
    if(_pv.empty() || other._pv.empty())
 Lines 518-524    Link Here 
    {
    {
        hlp = mTok[i].compare(oTok[i]);
        hlp = mTok[i].compare(oTok[i]);
        if(hlp != 0)
        if(hlp != 0)
            return hlp;
            return local::toCannocalValue(hlp);
        ++i;
        ++i;
    }
    }
    else if(isPVOptionalLetterComponentIndex(i))
    else if(isPVOptionalLetterComponentIndex(i))
 Lines 570-576    Link Here 
        local::PVSuffixToken tokO(oTok[i]);
        local::PVSuffixToken tokO(oTok[i]);
        int hlp = tokL.compare(tokO);
        int hlp = tokL.compare(tokO);
        if(hlp != 0)
        if(hlp != 0)
            return hlp;
            return local::toCannocalValue(hlp);
    }
    }
    return trailingPVPartIncoperate(other);
    return trailingPVPartIncoperate(other);
}
}
 Lines 882-888    Link Here 
bool ExactAtom::operator<(const ExactAtom& other) const
bool ExactAtom::operator<(const ExactAtom& other) const
{
{
    return compare(other) == -1;
    return compare(other) < 0;
}
}
int ExactAtom::compare(const ExactAtom& other) const
int ExactAtom::compare(const ExactAtom& other) const