File: RelationshipKind.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (134 lines) | stat: -rw-r--r-- 4,787 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
 This source file is part of the Swift.org open source project

 Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
 Licensed under Apache License v2.0 with Runtime Library Exception

 See https://swift.org/LICENSE.txt for license information
 See https://swift.org/CONTRIBUTORS.txt for Swift project authors
*/

import Foundation

extension SymbolGraph.Relationship {
    /// The kind of relationship.
    public struct Kind: Codable, RawRepresentable, Equatable, Hashable {
        public var rawValue: String
        
        public init(rawValue: String) {
            self.rawValue = rawValue
        }

        /**
         A symbol `A` is a member of another symbol `B`.

         For example, a method or field of a class would be
         a member of that class.

         The implied inverse of this relationship is that
         symbol `B` is the owner of a member symbol `A`.
         */
        public static let memberOf = Kind(rawValue: "memberOf")

        /**
         A symbol `A` is an optional member of another symbol `B`.

         For example, a key for a dictionary could be
         a member of that dictionary, but the key is not guaranteed
         to be present.

         The implied inverse of this relationship is that
         symbol `B` is the owner of a member symbol `A`.
         */
        public static let optionalMemberOf = Kind(rawValue: "optionalMemberOf")

        /**
         A symbol `A` conforms to an interface/protocol symbol `B`.

         For example, a class `C` that conforms to protocol `P` in Swift would
         use this relationship.

         The implied inverse of this relationship is that
         a symbol `B` that has a conformer `A`.
         */
        public static let conformsTo = Kind(rawValue: "conformsTo")

        /**
         A symbol `A` inherits another symbol `B`.

         For example, a derived class inherits from a base class,
         or a protocol that refines another protocol would use this relationship.

         The implied inverse of this relationship is that
         a symbol `B` is a base of another symbol `A`.
         */
        public static let inheritsFrom = Kind(rawValue: "inheritsFrom")

        /**
         A symbol `A` serves as a default implementation of
         an interface requirement `B`.

         The implied inverse of this relationship is that
         an interface requirement `B` has a default implementation of `A`.
         */
        public static let defaultImplementationOf = Kind(rawValue: "defaultImplementationOf")

        /**
         A symbol `A` overrides another symbol `B`, typically through inheritance.

         The implied inverse of this relationship is that
         a symbol `A` is the base of symbol `B`.
         */
        public static let overrides = Kind(rawValue: "overrides")

        /**
         A symbol `A` is a requirement of interface `B`.

         The implied inverse of this relationship is that
         an interface `B` has a requirement of `A`.
         */
        public static let requirementOf = Kind(rawValue: "requirementOf")

        /**
         A symbol `A` is an optional requirement of interface `B`.

         The implied inverse of this relationship is that
         an interface `B` has an optional requirement of `A`.
         */
        public static let optionalRequirementOf = Kind(rawValue: "optionalRequirementOf")
        
        /**
         A symbol `A` extends a symbol `B` with members or conformances.

         This relationship describes the connection between extension blocks
         (swift.extension symbols) and the type they extend.

         The implied inverse of this relationship is a symbol `B` that is extended
         by an extension block symbol `A`.
         */
        public static let extensionTo = Kind(rawValue: "extensionTo")

        /**
         A symbol `A` references a symbol `B` in its implementation.

         This relationship can be used to describe implementation details of functions or
         properties, by noting which symbols are used in its implementation.

         The implied inverse of this relationship is that the symbol `B` is referenced by the
         symbol `A`.
         */
        public static let references = Kind(rawValue: "references")

        /**
         A symbol `A` overloads other symbols referenced by `B`.

         This relationship can be added by the unified symbol graph collector
         to reference a synthesized "overload group" symbol that collects
         together a group of overloaded symbols.

         The implied inverse of this relationship is that the symbol `B` is an
         overload group containing `A`.
         */
        public static let overloadOf = Kind(rawValue: "overloadOf")
    }
}