Ejemplo n.º 1
0
int UTF8::icompare(const std::string& str, std::string::size_type pos, std::string::size_type n, const std::string::value_type* ptr)
{
    static UTF8Encoding utf8;

    poco_check_ptr (ptr);
    std::string::size_type sz = str.size();
    if (pos > sz) pos = sz;
    if (pos + n > sz) n = sz - pos;
    TextIterator uit(str.begin() + pos, str.begin() + pos + n, utf8);
    TextIterator uend(str.begin() + pos + n);
    while (uit != uend && *ptr)
    {
        int c1 = Unicode::toLower(*uit);
        int c2 = Unicode::toLower(*ptr);
        if (c1 < c2)
            return -1;
        else if (c1 > c2)
            return 1;
        ++uit;
        ++ptr;
    }

    if (uit == uend)
        return *ptr == 0 ? 0 : -1;
    else
        return 1;
}
Ejemplo n.º 2
0
 /// Called by base class with results. This is called in both the
 /// success and error cases. On error, the calling logic passes the
 /// original URI.
 virtual void rewriteResult(const std::vector<std::string>& uris)
 {
     LLSD result;
     for (std::vector<std::string>::const_iterator ui(uris.begin()), uend(uris.end());
          ui != uend; ++ui)
     {
         result.append(*ui);
     }
     // This call knows enough to avoid trying to insert a map key into an
     // LLSD array. It's there so that if, for any reason, we ever decide
     // to change the response from array to map, it will Just Start Working.
     mReqID.stamp(result);
     LLEventPumps::instance().obtain(mPumpName).post(result);
 }