From 062d0a13db505636b186084d42c527a49637f380 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 11 Nov 2009 07:41:50 -0500 Subject: Add LLEventAPI class, formalizing the mechanism by which we wrap a C++ API with an event API. In addition to the LLEventPump name on which to listen, LLEventAPI accepts a documentation string for event API introspection. Give every LLEventDispatcher::add() overload a new documentation string parameter for event API introspection. Convert every existing event API to new conventions, introducing suitable documentation strings for the API and each of its operations. --- indra/llmessage/llares.cpp | 2 +- indra/llmessage/llareslistener.cpp | 13 +++++++++---- indra/llmessage/llareslistener.h | 9 ++++----- 3 files changed, 14 insertions(+), 10 deletions(-) (limited to 'indra/llmessage') diff --git a/indra/llmessage/llares.cpp b/indra/llmessage/llares.cpp index acbf51d75c..104629c157 100644 --- a/indra/llmessage/llares.cpp +++ b/indra/llmessage/llares.cpp @@ -106,7 +106,7 @@ void LLAres::QueryResponder::queryError(int code) LLAres::LLAres() : chan_(NULL), mInitSuccess(false), - mListener(new LLAresListener("LLAres", this)) + mListener(new LLAresListener(this)) { if (ares_init(&chan_) != ARES_SUCCESS) { diff --git a/indra/llmessage/llareslistener.cpp b/indra/llmessage/llareslistener.cpp index a8beb8cbde..7db3675b77 100644 --- a/indra/llmessage/llareslistener.cpp +++ b/indra/llmessage/llareslistener.cpp @@ -22,13 +22,18 @@ #include "llevents.h" #include "llsdutil.h" -LLAresListener::LLAresListener(const std::string& pumpname, LLAres* llares): - LLDispatchListener(pumpname, "op"), +LLAresListener::LLAresListener(LLAres* llares): + LLEventAPI("LLAres", + "LLAres listener to request DNS operations"), mAres(llares) { // add() every method we want to be able to invoke via this event API. - // Optional third parameter validates expected LLSD request structure. - add("rewriteURI", &LLAresListener::rewriteURI, + // Optional last parameter validates expected LLSD request structure. + add("rewriteURI", + "Given [\"uri\"], return on [\"reply\"] an array of alternative URIs.\n" + "On failure, returns an array containing only the original URI, so\n" + "failure case can be processed like success case.", + &LLAresListener::rewriteURI, LLSD().insert("uri", LLSD()).insert("reply", LLSD())); } diff --git a/indra/llmessage/llareslistener.h b/indra/llmessage/llareslistener.h index bf093b3d3d..33cef79c09 100644 --- a/indra/llmessage/llareslistener.h +++ b/indra/llmessage/llareslistener.h @@ -14,18 +14,17 @@ #if ! defined(LL_LLARESLISTENER_H) #define LL_LLARESLISTENER_H -#include "lleventdispatcher.h" +#include "lleventapi.h" class LLAres; class LLSD; /// Listen on an LLEventPump with specified name for LLAres request events. -class LLAresListener: public LLDispatchListener +class LLAresListener: public LLEventAPI { public: - /// Specify the pump name on which to listen, and bind the LLAres instance - /// to use (e.g. gAres) - LLAresListener(const std::string& pumpname, LLAres* llares); + /// Bind the LLAres instance to use (e.g. gAres) + LLAresListener(LLAres* llares); private: /// command["op"] == "rewriteURI" -- cgit v1.2.3