Explorar el Código

Added documentation and three more event constants.

Sascha Zelzer hace 14 años
padre
commit
5b249b213d

+ 6 - 2
Libs/PluginFramework/EventBus/ctkEventConstants.cpp

@@ -22,6 +22,10 @@
 #include "ctkEventConstants.h"
 
 
-  const QString EventConstants::EVENT_TOPIC = "event.topics";
-  const QString EventConstants::EVENT_FILTER = "event.filter";
+const QString EventConstants::EVENT_TOPIC = "event.topics";
+const QString EventConstants::EVENT_FILTER = "event.filter";
+
+const QString EventConstants::PLUGIN_SYMBOLICNAME = "plugin.symbolicName";
+const QString EventConstants::PLUGIN_ID = "plugin.id";
+const QString EventConstants::PLUGIN_VERSION = "plugin.version";
 

+ 65 - 4
Libs/PluginFramework/EventBus/ctkEventConstants.h

@@ -26,13 +26,74 @@
 
 #include "CTKPluginFrameworkExport.h"
 
+/**
+ * Defines standard names for event properties
+ *
+ * \see ctkEventBus::subscribeSlot()
+ */
+struct CTK_PLUGINFW_EXPORT EventConstants {
 
-  struct CTK_PLUGINFW_EXPORT EventConstants {
+  /**
+   * Qt slot property (named <code>event.topics</code>)
+   * specifying the <code>ctkEvent</code> topics of interest to a
+   * subscribed slot.
+   * <p>
+   * Subscribed slots SHOULD be registered with this property. The value of the
+   * property is a QString or a QStringList that describes the topics in
+   * which the handler is interested. An asterisk ('*') may be used as a
+   * trailing wildcard. Subscribed slots which do not have a value for this
+   * property must not receive events. More precisely, the value of each
+   * string must conform to the following grammar:
+   *
+   * <pre>
+   *  topic-description := '*' | topic ( '&#47*' )?
+   *  topic := token ( '/' token )*
+   * </pre>
+   *
+   * @see ctkEvent
+   */
+  static const QString EVENT_TOPIC; // = "event.topics"
 
-    static const QString EVENT_TOPIC; // = "event.topics"
-    static const QString EVENT_FILTER; // = "event.filter"
+  /**
+   * Qt slot property (named <code>event.filter</code>)
+   * specifying a filter to further select <code>ctkEvent</code> s of interest to
+   * a subscribed slot.
+   * <p>
+   * Subscribed slots MAY be registered with this property. The value of this
+   * property is a QString containing an LDAP-style filter specification. Any
+   * of the event's properties may be used in the filter expression. Each
+   * subscribed slot is notified for any event which belongs to the topics in
+   * which the slot has expressed an interest. If the slot is also
+   * registered with this property, then the properties of the event
+   * must also match the filter for the event to be delivered to the slot.
+   * <p>
+   * If the filter syntax is invalid, then the slot must be ignored
+   * and a warning should be logged.
+   *
+   * @see ctkEvent
+   * @see ctkLDAPSearchFilter
+   */
+  static const QString EVENT_FILTER; // = "event.filter"
 
-  };
+  /**
+   * The Plugin Symbolic Name of the plugin relevant to the event. The type of
+   * the value for this event property is <code>QString</code>.
+   */
+  static const QString PLUGIN_SYMBOLICNAME; // = "plugin.symbolicName";
+
+  /**
+   * The Plugin id of the plugin relevant to the event. The type of the value
+   * for this event property is <code>long</code>.
+   */
+  static const QString PLUGIN_ID; // = "plugin.id";
+
+  /**
+   * The version of the plugin relevant to the event. The type of the value
+   * for this event property is {@link ctkVersion}.
+   */
+  static const QString PLUGIN_VERSION; // = "plugin.version";
+
+};
 
 
 #endif // CTKEVENTCONSTANTS_H