1# SPDX-License-Identifier: GPL-2.0 2# 3# A class that will, eventually, encapsulate all of the parsed data that we 4# then pass into the output modules. 5# 6 7""" 8Data class to store a kernel-doc Item. 9""" 10 11class KdocItem: 12 """ 13 A class that will, eventually, encapsulate all of the parsed data that we 14 then pass into the output modules. 15 """ 16 17 def __init__(self, name, fname, type, start_line, **other_stuff): 18 self.name = name 19 self.fname = fname 20 self.type = type 21 self.declaration_start_line = start_line 22 self.sections = {} 23 self.sections_start_lines = {} 24 self.parameterlist = [] 25 self.parameterdesc_start_lines = [] 26 self.parameterdescs = {} 27 self.parametertypes = {} 28 # 29 # Just save everything else into our own dict so that the output 30 # side can grab it directly as before. As we move things into more 31 # structured data, this will, hopefully, fade away. 32 # 33 self.other_stuff = other_stuff 34 35 def get(self, key, default = None): 36 """ 37 Get a value from optional keys. 38 """ 39 return self.other_stuff.get(key, default) 40 41 def __getitem__(self, key): 42 return self.get(key) 43 44 # 45 # Tracking of section and parameter information. 46 # 47 def set_sections(self, sections, start_lines): 48 """ 49 Set sections and start lines. 50 """ 51 self.sections = sections 52 self.section_start_lines = start_lines 53 54 def set_params(self, names, descs, types, starts): 55 """ 56 Set parameter list: names, descriptions, types and start lines. 57 """ 58 self.parameterlist = names 59 self.parameterdescs = descs 60 self.parametertypes = types 61 self.parameterdesc_start_lines = starts 62