...

Source file src/github.com/emicklei/proto/noop_visitor.go

Documentation: github.com/emicklei/proto

     1  // Copyright (c) 2022 Ernest Micklei
     2  //
     3  // MIT License
     4  //
     5  // Permission is hereby granted, free of charge, to any person obtaining
     6  // a copy of this software and associated documentation files (the
     7  // "Software"), to deal in the Software without restriction, including
     8  // without limitation the rights to use, copy, modify, merge, publish,
     9  // distribute, sublicense, and/or sell copies of the Software, and to
    10  // permit persons to whom the Software is furnished to do so, subject to
    11  // the following conditions:
    12  //
    13  // The above copyright notice and this permission notice shall be
    14  // included in all copies or substantial portions of the Software.
    15  //
    16  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    17  // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    18  // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    19  // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    20  // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    21  // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    22  // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    23  
    24  package proto
    25  
    26  // NoopVisitor is a no-operation visitor that can be used when creating your own visitor that is interested in only one or a few types.
    27  // It implements the Visitor interface.
    28  type NoopVisitor struct{}
    29  
    30  // VisitMessage is part of Visitor interface
    31  func (n NoopVisitor) VisitMessage(m *Message) {}
    32  
    33  // VisitService is part of Visitor interface
    34  func (n NoopVisitor) VisitService(v *Service) {}
    35  
    36  // VisitSyntax is part of Visitor interface
    37  func (n NoopVisitor) VisitSyntax(s *Syntax) {}
    38  
    39  // VisitPackage is part of Visitor interface
    40  func (n NoopVisitor) VisitPackage(p *Package) {}
    41  
    42  // VisitOption is part of Visitor interface
    43  func (n NoopVisitor) VisitOption(o *Option) {}
    44  
    45  // VisitImport is part of Visitor interface
    46  func (n NoopVisitor) VisitImport(i *Import) {}
    47  
    48  // VisitNormalField is part of Visitor interface
    49  func (n NoopVisitor) VisitNormalField(i *NormalField) {}
    50  
    51  // VisitEnumField is part of Visitor interface
    52  func (n NoopVisitor) VisitEnumField(i *EnumField) {}
    53  
    54  // VisitEnum is part of Visitor interface
    55  func (n NoopVisitor) VisitEnum(e *Enum) {}
    56  
    57  // VisitComment is part of Visitor interface
    58  func (n NoopVisitor) VisitComment(e *Comment) {}
    59  
    60  // VisitOneof is part of Visitor interface
    61  func (n NoopVisitor) VisitOneof(o *Oneof) {}
    62  
    63  // VisitOneofField is part of Visitor interface
    64  func (n NoopVisitor) VisitOneofField(o *OneOfField) {}
    65  
    66  // VisitReserved is part of Visitor interface
    67  func (n NoopVisitor) VisitReserved(r *Reserved) {}
    68  
    69  // VisitRPC is part of Visitor interface
    70  func (n NoopVisitor) VisitRPC(r *RPC) {}
    71  
    72  // VisitMapField is part of Visitor interface
    73  func (n NoopVisitor) VisitMapField(f *MapField) {}
    74  
    75  // VisitGroup is part of Visitor interface
    76  func (n NoopVisitor) VisitGroup(g *Group) {}
    77  
    78  // VisitExtensions is part of Visitor interface
    79  func (n NoopVisitor) VisitExtensions(e *Extensions) {}
    80  

View as plain text