findPublisher

Finds a sub-publisher in an object's publications tree.

Parameters

pub

The root publisher, either a class or a struct.

accessChain
Type: string

A string made of property names separated by dots. It must not starts with the name of the root.

Return Value

null if the sub-publisher could not be found. null if the sub-publisher could be found but doesn't exist yet. The matching publisher otherwise.

Examples

1 class AU: PropertyPublisher
2 {mixin PropertyPublisherImpl;}
3 
4 class B: PropertyPublisher
5 {
6     mixin PropertyPublisherImpl;
7     mixin inheritedDtor;
8 
9     @SetGet AU _a;
10     this()
11     {
12         _a = construct!AU;
13         collectPublications!B;
14     }
15     ~this()
16     {
17         destruct(_a);
18     }
19 }
20 
21 class C: PropertyPublisher
22 {
23     mixin PropertyPublisherImpl;
24     mixin inheritedDtor;
25 
26     @SetGet B _b;
27     this()
28     {
29         _b = construct!B;
30         collectPublications!C;
31     }
32     ~this()
33     {
34         destruct(_b);
35     }
36 }
37 
38 C c = construct!C;
39 
40 assert(c.findPublisher("b") == c._b);
41 assert(c.findPublisher("b.a") == c._b._a);
42 assert(c.findPublisher("b.a.g") is null);
43 destruct(c);

Meta