bool OsclComponentRegistryElement::Match(OSCL_String& id, bool aExact)
{
    if (aExact)
    {
        if (id == *iId)
            return true;
    }
    else
    {
        //hierarchical string match.
        //tells whether "id" is a prefix of the component ID (or an exact match).
        if (iId->get_size() >= id.get_size()
                && oscl_CIstrncmp(id.get_cstr(), iId->get_cstr(), id.get_size()) == 0
                && (iId->get_cstr()[id.get_size()] == '/'
                    || iId->get_cstr()[id.get_size()] == '\0'))
        {
            return true;
        }
    }
    return false;
}
/* ========================================================================
 *  Function : oscl_str_unescape_uri
 *  Date     : 11/04/2002
 *  Purpose  : see oscl_string_uri.h
 *  Modified :
 * ========================================================================
 */
OSCL_EXPORT_REF bool  oscl_str_unescape_uri(const OSCL_String& srcString, OSCL_String& destString, uint32& out_buf_len)
{
    const char *src = srcString.get_cstr();
    int srcStrLen = srcString.get_size();

    destString = "";
    out_buf_len = 0;

    if ((srcStrLen <= 0) || (src == NULL))
    {
        return false;
    }

    char buf[2];
    buf[1] = '\0';

    for (int32 i = 0; srcStrLen > 0;)
    {
        if (src[i] == '%')
        {
            i++;
            srcStrLen--;

            if ((srcStrLen >= 2))
            {
                uint32 val;
                if (PV_atoi(&src[i], 'x', 2, val) == false)
                {
                    return false;
                }

                //check capacity before appending to avoid any leave.
                if (destString.get_size() == destString.get_maxsize())
                    return false;
                buf[0] = (char)val;
                destString += buf;
                out_buf_len++;

                i += 2;
                srcStrLen -= 2;
            }
            else
            {
                return false;
            }
        }
        else
        {
            if (src[i] == (char)'\0')
                break;

            //check capacity before appending to avoid any leave.
            if (destString.get_size() == destString.get_maxsize())
                return false;
            buf[0] = src[i];
            destString += buf;
            out_buf_len++;

            i++;
            srcStrLen--;
        }
    }

    return true;
}