1/** 2 * Copyright (c) 2021-2024 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 LIBPANDABASE_TEMPLATES_SOURCE_LANGUAGE_H 19#define LIBPANDABASE_TEMPLATES_SOURCE_LANGUAGE_H 20 21namespace ark { 22 23enum class SourceLanguage : uint8_t { 24% Common::plugins.each do |plugin_lang, plugin_opts| 25 <%= plugin_lang %> = <%= plugin_opts["lang_enum_id"] %>, 26% if plugin_lang == "JAVA" 27 JAVA_8 = JAVA, 28% end 29% end 30 PANDA_ASSEMBLY = 1, 31 INVALID = static_cast<uint8_t>(-1) 32}; 33 34inline std::ostream &operator<<(std::ostream &stream, SourceLanguage lang) 35{ 36 switch (lang) { 37% Common::plugins.each do |plugin_lang, plugin_opts| 38 case <%= plugin_opts["lang_enum"] %>: 39% name = case plugin_lang 40% when "ECMASCRIPT" then "ECMAScript" 41% when "JAVA_8" then "Java 8" 42% when "JAVA" then "Java" 43% else plugin_lang.gsub(/_/, " ").capitalize 44% end 45 stream << "<%= name %>"; 46 break; 47% end 48 case ark::SourceLanguage::PANDA_ASSEMBLY: 49 stream << "Panda Assembly"; 50 break; 51 default: 52 UNREACHABLE(); 53 } 54 return stream; 55} 56 57inline bool IsValidSourceLang(SourceLanguage lang) { 58 switch (lang) { 59% Common::plugins.each do |plugin_lang, plugin_opts| 60 case <%= plugin_opts["lang_enum"] %>: 61% end 62 case ark::SourceLanguage::PANDA_ASSEMBLY: 63 return true; 64 default: 65 return false; 66 } 67} 68 69} // namespace ark 70 71#endif // LIBPANDABASE_TEMPLATES_SOURCE_LANGUAGE_H 72