Diffusion .NET Classic API - Core and Common  5.9.4
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector Class Referenceabstract

A Topic Selector is a mechanism for selecting topics either by name or by a topic selector pattern. More...

Inheritance diagram for PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector:
PushTechnology.DiffusionCore.Messaging.Topic.TopicSelectorAll PushTechnology.DiffusionCore.Messaging.Topic.TopicSelectorName PushTechnology.DiffusionCore.Messaging.Topic.TopicSelectorPatterns PushTechnology.DiffusionCore.Messaging.Topic.TopicSelectorSinglePattern

Public Types

enum  SelectorType { SelectorType.ALL, SelectorType.NAME, SelectorType.PATTERN, SelectorType.PATTERNS }
 

Public Member Functions

bool IsSimpleTopicNameSelector ()
 Is the selector a simple topic name selector that selects only a named topic and not its children? More...
 
bool SelectsChildren ()
 This indicates whether the selector selects the children of any selected topic also. More...
 
abstract bool IsTopicNameSelector ()
 Is the selector a single topic name? More...
 
abstract bool Matches (string topicName)
 This does a match to check if a specified topic name (or name subset) matches with the selector. More...
 
abstract new SelectorType GetType ()
 
override string ToString ()
 Returns the string representation of this object. More...
 

Static Public Member Functions

static TopicSelector Parse (string selector)
 Parses a topic selector. More...
 
static bool IsTopicName (string name)
 Checks if a supplied string is a valid topic name (as opposed to a topic selector). More...
 
static bool IsValidSelector (string selector)
 Check if the supplied string is a valid topic selector. This allows for regex metachars in the string, but does not check that the regex is valid. Only regex characters or valid codepoint characters are allowed. Also, the selector cannot start with a name delimiter. More...
 
static bool IsValidTopicNodeName (string topicName)
 Validates a topic node name to ensure that it does not contain invalid characters. More...
 

Protected Member Functions

 TopicSelector (string selectorString, bool selectsAllBelow, bool selectsAllInclusive)
 Constructor. More...
 

Protected Attributes

const char NameDelimiterChar = '/'
 

Properties

int HashCode [get, set]
 This allows for efficient equality matching of selectors. More...
 
bool SelectsAllBelow [get, set]
 Does this topic selector select all topics beneath it? More...
 
bool SelectsAllInclusive [get, set]
 
string SelectorString [get, set]
 
string Name [get, set]
 

Detailed Description

A Topic Selector is a mechanism for selecting topics either by name or by a topic selector pattern.

Member Enumeration Documentation

Enumerator
ALL 

Selects all topics under a topic node (optionally including the topic node itself).

NAME 

Selects a topic node by full name returning either the node, all topics subordinate to it or the the node AND all topic nodes subordinate to it.

PATTERN 

Selects topic nodes by a single regular expression pattern applied to the full hierarchic name.

The nodes selected can be returned, or all nodes beneath them, or all selected nodes AND all nodes beneath them.

PATTERNS 

Selects topic nodes by nested regular expression patterns, each pattern separated by a '/' representing a level of the topic tree hierarchy.

Constructor & Destructor Documentation

PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.TopicSelector ( string  selectorString,
bool  selectsAllBelow,
bool  selectsAllInclusive 
)
protected

Constructor.

Parameters
selectorString
selectsAllBelow
selectsAllInclusive

Member Function Documentation

bool PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.IsSimpleTopicNameSelector ( )

Is the selector a simple topic name selector that selects only a named topic and not its children?

Returns
static bool PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.IsTopicName ( string  name)
static

Checks if a supplied string is a valid topic name (as opposed to a topic selector).

This validates a full hierarchic topic name (e.g. A/B/C) to ensure that it is correctly structured and each element is a valid topic node name.

Parameters
namethe hierarchic topic name to validate which can be a simple topic name or a name representing a topic within a topic tree where the individual topic names are separated by topic name delimiters.
Returns
abstract bool PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.IsTopicNameSelector ( )
pure virtual
static bool PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.IsValidSelector ( string  selector)
static

Check if the supplied string is a valid topic selector. This allows for regex metachars in the string, but does not check that the regex is valid. Only regex characters or valid codepoint characters are allowed. Also, the selector cannot start with a name delimiter.

Parameters
selectorThe selector string.
Returns
true if a valid selector.
static bool PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.IsValidTopicNodeName ( string  topicName)
static

Validates a topic node name to ensure that it does not contain invalid characters.

A topic name may comprise any UTF-8 encodable character except ',' '/' or any of the regular expression metacharacters.

This validates a topic node name and not a full hierarchic topic name and thus would reject a name that contained topic name delimiters.

Parameters
topicName
Returns
abstract bool PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.Matches ( string  topicName)
pure virtual

This does a match to check if a specified topic name (or name subset) matches with the selector.

Parameters
topicNameThe topic name which must be a valid hierarchic topic name.
Returns
true if matches.

Implemented in PushTechnology.DiffusionCore.Messaging.Topic.TopicSelectorName, PushTechnology.DiffusionCore.Messaging.Topic.TopicSelectorPatterns, PushTechnology.DiffusionCore.Messaging.Topic.TopicSelectorSinglePattern, and PushTechnology.DiffusionCore.Messaging.Topic.TopicSelectorAll.

static TopicSelector PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.Parse ( string  selector)
static

Parses a topic selector.

Parameters
selector
Returns
bool PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.SelectsChildren ( )

This indicates whether the selector selects the children of any selected topic also.

Returns
override string PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.ToString ( )

Returns the string representation of this object.

Returns

Property Documentation

int PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.HashCode
getset

This allows for efficient equality matching of selectors.

string PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.Name
getset

string PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.SelectorString
getset

bool PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.SelectsAllBelow
getset

Does this topic selector select all topics beneath it?

bool PushTechnology.DiffusionCore.Messaging.Topic.TopicSelector.SelectsAllInclusive
getset