]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/dnsdistdist/docs/reference/dnsnameset.rst
2344dc3a63c496fff8d0cb803d44c27a4fe45213
[thirdparty/pdns.git] / pdns / dnsdistdist / docs / reference / dnsnameset.rst
1 .. _DNSNameSet:
2
3 DNSNameSet objects
4 ==================
5
6 A :class:`DNSNameSet` object is a set of :class:`DNSName` objects.
7 Based on std::set (usually implemented as red-black trees).
8 Creating a ``DNSName`` is done with the :func:`newDNSNameSet`::
9
10 myset = newDNSNameSet()
11
12 The set can be filled by func:`DNSNameSet:add`::
13
14 myset.add(newDNSName("domain1.tld"))
15 myset.add(newDNSName("domain2.tld"))
16
17 Functions and methods of a ``DNSNameSet``
18 -----------------------------------------
19
20 .. function:: newDNSNameSet(name) -> DNSNameSet
21
22 Returns the :class:`DNSNameSet`.
23
24 .. class:: DNSNameSet
25
26 A ``DNSNameSet`` object is a set of :class:`DNSName` objects.
27
28 .. method:: DNSNameSet:add(name)
29
30 Adds the name to the set.
31
32 :param DNSName name The name to add.
33
34 .. method:: DNSNameSet:empty() -> bool
35
36 Returns true is the DNSNameSet is empty.
37
38 .. method:: DNSNameSet:clear()
39
40 Clean up the set.
41
42 .. method:: DNSNameSet:toString() -> string
43
44 Returns a human-readable form of the DNSName.
45
46 .. method:: DNSNameSet:size() -> int
47
48 Returns the number of names in the set.
49
50 .. method:: DNSNameSet:delete(name) -> int
51
52 Removes the name from the set. Returns the number of deleted elements.
53
54 :param DNSName name The name to remove.
55
56 .. method:: DNSNameSet:check(name) -> bool
57
58 Returns true if the set contains the name.
59
60 :param DNSname name The name.