You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

357 regels
8.4 KiB

  1. // Copyright 2018 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated by generate-types. DO NOT EDIT.
  5. package filedesc
  6. import (
  7. "fmt"
  8. "sync"
  9. "google.golang.org/protobuf/internal/descfmt"
  10. "google.golang.org/protobuf/internal/pragma"
  11. "google.golang.org/protobuf/reflect/protoreflect"
  12. )
  13. type Enums struct {
  14. List []Enum
  15. once sync.Once
  16. byName map[protoreflect.Name]*Enum // protected by once
  17. }
  18. func (p *Enums) Len() int {
  19. return len(p.List)
  20. }
  21. func (p *Enums) Get(i int) protoreflect.EnumDescriptor {
  22. return &p.List[i]
  23. }
  24. func (p *Enums) ByName(s protoreflect.Name) protoreflect.EnumDescriptor {
  25. if d := p.lazyInit().byName[s]; d != nil {
  26. return d
  27. }
  28. return nil
  29. }
  30. func (p *Enums) Format(s fmt.State, r rune) {
  31. descfmt.FormatList(s, r, p)
  32. }
  33. func (p *Enums) ProtoInternal(pragma.DoNotImplement) {}
  34. func (p *Enums) lazyInit() *Enums {
  35. p.once.Do(func() {
  36. if len(p.List) > 0 {
  37. p.byName = make(map[protoreflect.Name]*Enum, len(p.List))
  38. for i := range p.List {
  39. d := &p.List[i]
  40. if _, ok := p.byName[d.Name()]; !ok {
  41. p.byName[d.Name()] = d
  42. }
  43. }
  44. }
  45. })
  46. return p
  47. }
  48. type EnumValues struct {
  49. List []EnumValue
  50. once sync.Once
  51. byName map[protoreflect.Name]*EnumValue // protected by once
  52. byNum map[protoreflect.EnumNumber]*EnumValue // protected by once
  53. }
  54. func (p *EnumValues) Len() int {
  55. return len(p.List)
  56. }
  57. func (p *EnumValues) Get(i int) protoreflect.EnumValueDescriptor {
  58. return &p.List[i]
  59. }
  60. func (p *EnumValues) ByName(s protoreflect.Name) protoreflect.EnumValueDescriptor {
  61. if d := p.lazyInit().byName[s]; d != nil {
  62. return d
  63. }
  64. return nil
  65. }
  66. func (p *EnumValues) ByNumber(n protoreflect.EnumNumber) protoreflect.EnumValueDescriptor {
  67. if d := p.lazyInit().byNum[n]; d != nil {
  68. return d
  69. }
  70. return nil
  71. }
  72. func (p *EnumValues) Format(s fmt.State, r rune) {
  73. descfmt.FormatList(s, r, p)
  74. }
  75. func (p *EnumValues) ProtoInternal(pragma.DoNotImplement) {}
  76. func (p *EnumValues) lazyInit() *EnumValues {
  77. p.once.Do(func() {
  78. if len(p.List) > 0 {
  79. p.byName = make(map[protoreflect.Name]*EnumValue, len(p.List))
  80. p.byNum = make(map[protoreflect.EnumNumber]*EnumValue, len(p.List))
  81. for i := range p.List {
  82. d := &p.List[i]
  83. if _, ok := p.byName[d.Name()]; !ok {
  84. p.byName[d.Name()] = d
  85. }
  86. if _, ok := p.byNum[d.Number()]; !ok {
  87. p.byNum[d.Number()] = d
  88. }
  89. }
  90. }
  91. })
  92. return p
  93. }
  94. type Messages struct {
  95. List []Message
  96. once sync.Once
  97. byName map[protoreflect.Name]*Message // protected by once
  98. }
  99. func (p *Messages) Len() int {
  100. return len(p.List)
  101. }
  102. func (p *Messages) Get(i int) protoreflect.MessageDescriptor {
  103. return &p.List[i]
  104. }
  105. func (p *Messages) ByName(s protoreflect.Name) protoreflect.MessageDescriptor {
  106. if d := p.lazyInit().byName[s]; d != nil {
  107. return d
  108. }
  109. return nil
  110. }
  111. func (p *Messages) Format(s fmt.State, r rune) {
  112. descfmt.FormatList(s, r, p)
  113. }
  114. func (p *Messages) ProtoInternal(pragma.DoNotImplement) {}
  115. func (p *Messages) lazyInit() *Messages {
  116. p.once.Do(func() {
  117. if len(p.List) > 0 {
  118. p.byName = make(map[protoreflect.Name]*Message, len(p.List))
  119. for i := range p.List {
  120. d := &p.List[i]
  121. if _, ok := p.byName[d.Name()]; !ok {
  122. p.byName[d.Name()] = d
  123. }
  124. }
  125. }
  126. })
  127. return p
  128. }
  129. type Fields struct {
  130. List []Field
  131. once sync.Once
  132. byName map[protoreflect.Name]*Field // protected by once
  133. byJSON map[string]*Field // protected by once
  134. byText map[string]*Field // protected by once
  135. byNum map[protoreflect.FieldNumber]*Field // protected by once
  136. }
  137. func (p *Fields) Len() int {
  138. return len(p.List)
  139. }
  140. func (p *Fields) Get(i int) protoreflect.FieldDescriptor {
  141. return &p.List[i]
  142. }
  143. func (p *Fields) ByName(s protoreflect.Name) protoreflect.FieldDescriptor {
  144. if d := p.lazyInit().byName[s]; d != nil {
  145. return d
  146. }
  147. return nil
  148. }
  149. func (p *Fields) ByJSONName(s string) protoreflect.FieldDescriptor {
  150. if d := p.lazyInit().byJSON[s]; d != nil {
  151. return d
  152. }
  153. return nil
  154. }
  155. func (p *Fields) ByTextName(s string) protoreflect.FieldDescriptor {
  156. if d := p.lazyInit().byText[s]; d != nil {
  157. return d
  158. }
  159. return nil
  160. }
  161. func (p *Fields) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDescriptor {
  162. if d := p.lazyInit().byNum[n]; d != nil {
  163. return d
  164. }
  165. return nil
  166. }
  167. func (p *Fields) Format(s fmt.State, r rune) {
  168. descfmt.FormatList(s, r, p)
  169. }
  170. func (p *Fields) ProtoInternal(pragma.DoNotImplement) {}
  171. func (p *Fields) lazyInit() *Fields {
  172. p.once.Do(func() {
  173. if len(p.List) > 0 {
  174. p.byName = make(map[protoreflect.Name]*Field, len(p.List))
  175. p.byJSON = make(map[string]*Field, len(p.List))
  176. p.byText = make(map[string]*Field, len(p.List))
  177. p.byNum = make(map[protoreflect.FieldNumber]*Field, len(p.List))
  178. for i := range p.List {
  179. d := &p.List[i]
  180. if _, ok := p.byName[d.Name()]; !ok {
  181. p.byName[d.Name()] = d
  182. }
  183. if _, ok := p.byJSON[d.JSONName()]; !ok {
  184. p.byJSON[d.JSONName()] = d
  185. }
  186. if _, ok := p.byText[d.TextName()]; !ok {
  187. p.byText[d.TextName()] = d
  188. }
  189. if _, ok := p.byNum[d.Number()]; !ok {
  190. p.byNum[d.Number()] = d
  191. }
  192. }
  193. }
  194. })
  195. return p
  196. }
  197. type Oneofs struct {
  198. List []Oneof
  199. once sync.Once
  200. byName map[protoreflect.Name]*Oneof // protected by once
  201. }
  202. func (p *Oneofs) Len() int {
  203. return len(p.List)
  204. }
  205. func (p *Oneofs) Get(i int) protoreflect.OneofDescriptor {
  206. return &p.List[i]
  207. }
  208. func (p *Oneofs) ByName(s protoreflect.Name) protoreflect.OneofDescriptor {
  209. if d := p.lazyInit().byName[s]; d != nil {
  210. return d
  211. }
  212. return nil
  213. }
  214. func (p *Oneofs) Format(s fmt.State, r rune) {
  215. descfmt.FormatList(s, r, p)
  216. }
  217. func (p *Oneofs) ProtoInternal(pragma.DoNotImplement) {}
  218. func (p *Oneofs) lazyInit() *Oneofs {
  219. p.once.Do(func() {
  220. if len(p.List) > 0 {
  221. p.byName = make(map[protoreflect.Name]*Oneof, len(p.List))
  222. for i := range p.List {
  223. d := &p.List[i]
  224. if _, ok := p.byName[d.Name()]; !ok {
  225. p.byName[d.Name()] = d
  226. }
  227. }
  228. }
  229. })
  230. return p
  231. }
  232. type Extensions struct {
  233. List []Extension
  234. once sync.Once
  235. byName map[protoreflect.Name]*Extension // protected by once
  236. }
  237. func (p *Extensions) Len() int {
  238. return len(p.List)
  239. }
  240. func (p *Extensions) Get(i int) protoreflect.ExtensionDescriptor {
  241. return &p.List[i]
  242. }
  243. func (p *Extensions) ByName(s protoreflect.Name) protoreflect.ExtensionDescriptor {
  244. if d := p.lazyInit().byName[s]; d != nil {
  245. return d
  246. }
  247. return nil
  248. }
  249. func (p *Extensions) Format(s fmt.State, r rune) {
  250. descfmt.FormatList(s, r, p)
  251. }
  252. func (p *Extensions) ProtoInternal(pragma.DoNotImplement) {}
  253. func (p *Extensions) lazyInit() *Extensions {
  254. p.once.Do(func() {
  255. if len(p.List) > 0 {
  256. p.byName = make(map[protoreflect.Name]*Extension, len(p.List))
  257. for i := range p.List {
  258. d := &p.List[i]
  259. if _, ok := p.byName[d.Name()]; !ok {
  260. p.byName[d.Name()] = d
  261. }
  262. }
  263. }
  264. })
  265. return p
  266. }
  267. type Services struct {
  268. List []Service
  269. once sync.Once
  270. byName map[protoreflect.Name]*Service // protected by once
  271. }
  272. func (p *Services) Len() int {
  273. return len(p.List)
  274. }
  275. func (p *Services) Get(i int) protoreflect.ServiceDescriptor {
  276. return &p.List[i]
  277. }
  278. func (p *Services) ByName(s protoreflect.Name) protoreflect.ServiceDescriptor {
  279. if d := p.lazyInit().byName[s]; d != nil {
  280. return d
  281. }
  282. return nil
  283. }
  284. func (p *Services) Format(s fmt.State, r rune) {
  285. descfmt.FormatList(s, r, p)
  286. }
  287. func (p *Services) ProtoInternal(pragma.DoNotImplement) {}
  288. func (p *Services) lazyInit() *Services {
  289. p.once.Do(func() {
  290. if len(p.List) > 0 {
  291. p.byName = make(map[protoreflect.Name]*Service, len(p.List))
  292. for i := range p.List {
  293. d := &p.List[i]
  294. if _, ok := p.byName[d.Name()]; !ok {
  295. p.byName[d.Name()] = d
  296. }
  297. }
  298. }
  299. })
  300. return p
  301. }
  302. type Methods struct {
  303. List []Method
  304. once sync.Once
  305. byName map[protoreflect.Name]*Method // protected by once
  306. }
  307. func (p *Methods) Len() int {
  308. return len(p.List)
  309. }
  310. func (p *Methods) Get(i int) protoreflect.MethodDescriptor {
  311. return &p.List[i]
  312. }
  313. func (p *Methods) ByName(s protoreflect.Name) protoreflect.MethodDescriptor {
  314. if d := p.lazyInit().byName[s]; d != nil {
  315. return d
  316. }
  317. return nil
  318. }
  319. func (p *Methods) Format(s fmt.State, r rune) {
  320. descfmt.FormatList(s, r, p)
  321. }
  322. func (p *Methods) ProtoInternal(pragma.DoNotImplement) {}
  323. func (p *Methods) lazyInit() *Methods {
  324. p.once.Do(func() {
  325. if len(p.List) > 0 {
  326. p.byName = make(map[protoreflect.Name]*Method, len(p.List))
  327. for i := range p.List {
  328. d := &p.List[i]
  329. if _, ok := p.byName[d.Name()]; !ok {
  330. p.byName[d.Name()] = d
  331. }
  332. }
  333. }
  334. })
  335. return p
  336. }