1 /* 2 * Copyright (c) 2021 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 #include "message_string.h" 17 #include <array> 18 #include "libpandabase/macros.h" 19 20 namespace panda::ecmascript { 21 // NOLINTNEXTLINE(fuchsia-statically-constructed-objects) 22 static std::array<std::string, MessageString::MAX_MESSAGE_COUNT> g_messageString = { 23 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) 24 #define DEF_MESSAGE_ID(name, string) #string, 25 MESSAGE_STRING_LIST(DEF_MESSAGE_ID) 26 #undef DEF_MESSAGE_ID 27 }; 28 GetMessageString(int id)29const std::string& MessageString::GetMessageString(int id) 30 { 31 ASSERT(id < MessageString::MAX_MESSAGE_COUNT); 32 return g_messageString[id]; 33 } 34 } // namespace panda::ecmascript