1#!/usr/bin/env python 2# -*- coding: utf-8 -*- 3# Copyright (c) 2023 Huawei Device Co., Ltd. 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16import enum 17 18 19class ParserGetResultTable: 20 compare_result_list = [] 21 head_name = "" 22 generate_data_only = [] 23 original_data_only = [] 24 parser_data = [] 25 26 def __init__(self, compare_result_list, head_name_need, generate_data_only, original_data_only, parser_data): 27 self.compare_result_list = compare_result_list 28 self.head_name = head_name_need 29 self.generate_data_only = generate_data_only 30 self.original_data_only = original_data_only 31 self.parser_data = parser_data 32 33 34class OneFileApiMessage: 35 file_path = '' 36 kit_name = '' 37 sub_system = '' 38 api_number = 0 39 40 def __init__(self, file_path, kit_name, sub_system, api_number): 41 self.file_path = file_path 42 self.kit_name = kit_name 43 self.sub_system = sub_system 44 self.api_number = api_number 45 46 def set_file_path(self, file_path): 47 self.file_path = file_path 48 49 def get_file_path(self): 50 return self.file_path 51 52 def set_kit_name(self, kit_name): 53 self.kit_name = kit_name 54 55 def get_kit_name(self): 56 return self.kit_name 57 58 def set_sub_system(self, sub_system): 59 self.sub_system = sub_system 60 61 def get_sub_system(self): 62 return self.sub_system 63 64 def set_api_number(self, api_number): 65 self.api_number = api_number 66 67 def get_api_number(self): 68 return self.api_number 69 70 71class NodeKind(enum.Enum): 72 MACRO_DEFINITION = 'MACRO_DEFINITION' 73 STRUCT_DECL = 'STRUCT_DECL' 74 UNION_DECL = 'UNION_DECL' 75 ENUM_DECL = 'ENUM_DECL' 76 FUNCTION_DECL = 'FUNCTION_DECL' 77 VAR_DECL = 'VAR_DECL' 78 79 80class DifferApiRegular(enum.Enum): 81 OPEN_SOURCE_API_REGULAR = r'^(OH_|ffrt|tee).*' 82 CLOSED_SOURCE_API_REGULAR = r'^HMS_.*' 83 84 85class DifferApiInfor(enum.Enum): 86 OPEN_SOURCE_API = '开源API' 87 CLOSED_SOURCE_API = '闭源API' 88 THIRD_PARTY_API = '三方库API' 89