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 7class KdocItem: 8 def __init__(self, name, type, start_line, **other_stuff): 9 self.name = name 10 self.type = type 11 self.declaration_start_line = start_line 12 self.sections = {} 13 self.sections_start_lines = {} 14 self.parameterlist = [] 15 self.parameterdesc_start_lines = [] 16 self.parameterdescs = {} 17 self.parametertypes = {} 18 # 19 # Just save everything else into our own dict so that the output 20 # side can grab it directly as before. As we move things into more 21 # structured data, this will, hopefully, fade away. 22 # 23 self.other_stuff = other_stuff 24 25 def get(self, key, default = None): 26 return self.other_stuff.get(key, default) 27 28 def __getitem__(self, key): 29 return self.get(key) 30 31 # 32 # Tracking of section and parameter information. 33 # 34 def set_sections(self, sections, start_lines): 35 self.sections = sections 36 self.section_start_lines = start_lines 37 38 def set_params(self, names, descs, types, starts): 39 self.parameterlist = names 40 self.parameterdescs = descs 41 self.parametertypes = types 42 self.parameterdesc_start_lines = starts 43