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