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