2121from index_transform import IndexTransform
2222from xml_utils import xml_escape
2323from link_map import LinkMap
24+ from functools import total_ordering
2425import sys
2526
2627if len (sys .argv ) != 4 :
@@ -51,6 +52,7 @@ class ItemKind:
5152 TYPEDEF = 3 ,
5253 NAMESPACE = 4
5354
55+ @total_ordering
5456class Item :
5557
5658 def __init__ (self ):
@@ -60,6 +62,12 @@ def __init__(self):
6062 self .link = ""
6163 self .members = {}
6264
65+ def __eq__ (self , other ):
66+ return self .full_name == other .full_name
67+
68+ def __lt__ (self , other ):
69+ return self .full_name < other .full_name
70+
6371ns_map = Item ()
6472
6573def add_to_map (full_name , full_link , item_kind ):
@@ -108,7 +116,7 @@ def add_to_map(full_name, full_link, item_kind):
108116
109117def print_members (out_f , curr_item ):
110118 global link_map
111- for item in curr_item .members .values ():
119+ for item in sorted ( curr_item .members .values () ):
112120 if link_map :
113121 link = link_map .get_dest (item .link )
114122 if link == None and item .kind != ItemKind .NAMESPACE :
@@ -151,12 +159,12 @@ def print_map_item(out_f, curr_item):
151159 print_members (out_f , curr_item )
152160 out_f .write (' </compound>\n ' )
153161
154- for item in curr_item .members .values ():
162+ for item in sorted ( curr_item .members .values () ):
155163 if item .kind in [ ItemKind .NAMESPACE , ItemKind .CLASS ]:
156164 print_map_item (out_f , item )
157165
158166def print_map (out_f , ns_map ):
159- for item in ns_map .members .values ():
167+ for item in sorted ( ns_map .members .values () ):
160168 if item .kind in [ ItemKind .NAMESPACE , ItemKind .CLASS ]:
161169 print_map_item (out_f , item )
162170 else :
0 commit comments