1/** 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16// Autogenerated file -- DO NOT EDIT! 17 18#ifndef ES2PANDA_UTIL_DIAGNOSTIC_KIND_H 19#define ES2PANDA_UTIL_DIAGNOSTIC_KIND_H 20 21#include "util/diagnostic.h" 22#include <tuple> 23 24namespace ark::es2panda::diagnostic { 25 26class DiagnosticKind { 27public: 28 constexpr DiagnosticKind(util::DiagnosticType type, uint32_t id, std::string_view message) : 29 type_(type), id_(id), message_(message) {} 30 31 bool operator==(const DiagnosticKind &other) const 32 { 33 return std::tie(type_, id_) == std::tie(other.type_, other.id_); 34 } 35 36 bool operator<(const DiagnosticKind &other) const 37 { 38 return std::tie(type_, id_) < std::tie(other.type_, other.id_); 39 } 40 41 util::DiagnosticType Type() const 42 { 43 return type_; 44 } 45 46 uint32_t Id() const 47 { 48 return id_; 49 } 50 51 std::string_view Message() const 52 { 53 return message_; 54 } 55 56private: 57 const util::DiagnosticType type_; 58 const uint32_t id_; 59 const std::string_view message_; 60}; 61 62% Diagnostic::diagnostics.each do |desc| 63 constexpr static DiagnosticKind <%= desc.name %> {util::DiagnosticType::<%= desc.type.upcase %>, <%= desc.id %>, "<%= desc.message %>"}; 64% end 65} // namespace ark::es2panda::diagnostic 66 67#endif // ES2PANDA_UTIL_DIAGNOSTIC_KIND_H 68