Exemple #1
0
void LLSideTrayListener::getTabs(const LLSD& event) const
{
    LLSD reply;

    LLSideTray* tray = mGetter();
    LLSD::Integer ord(0);
    for (LLSideTray::child_list_const_iter_t chi(tray->beginChild()), chend(tray->endChild());
         chi != chend; ++chi, ++ord)
    {
        LLView* child = *chi;
        // How much info is important? Toss in as much as seems reasonable for
        // each tab. But to me, at least for the moment, the most important
        // item is the tab name.
        LLSD info;
        // I like the idea of returning a map keyed by tab name. But as
        // compared to an array of maps, that loses sequence information.
        // Address that by indicating the original order in each map entry.
        info["ord"] = ord;
        info["visible"] = bool(child->getVisible());
        info["enabled"] = bool(child->getEnabled());
        info["available"] = child->isAvailable();
        reply[child->getName()] = info;
    }

    sendReply(reply, event);
}
LLSD LLCommandDispatcher::enumerate()
{
    LLSD response;
    LLCommandHandlerRegistry& registry(LLCommandHandlerRegistry::instance());
    for (std::map<std::string, LLCommandHandlerInfo>::const_iterator chi(registry.mMap.begin()),
            chend(registry.mMap.end());
            chi != chend; ++chi)
    {
        LLSD info;
        info["untrusted"] = chi->second.mUntrustedBrowserAccess;
        info["untrusted_str"] = lookup(chi->second.mUntrustedBrowserAccess);
        response[chi->first] = info;
    }
    return response;
}