Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/wabt/error.h
1 /* 2 * Copyright 2018 WebAssembly Community Group participants 3 * 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 */ 16 17 #ifndef WABT_ERROR_H_ 18 #define WABT_ERROR_H_ 19 20 #include <string> 21 #include <string_view> 22 #include <vector> 23 24 #include "wabt/common.h" 25 26 namespace wabt { 27 28 enum class ErrorLevel { 29 Warning, 30 Error, 31 }; 32 33 static inline const char* GetErrorLevelName(ErrorLevel error_level) { 34 switch (error_level) { 35 case ErrorLevel::Warning: 36 return "warning"; 37 case ErrorLevel::Error: 38 return "error"; 39 } 40 WABT_UNREACHABLE; 41 } 42 43 class Error { 44 public: 45 Error() : error_level(ErrorLevel::Error) {} 46 Error(ErrorLevel error_level, Location loc, std::string_view message) 47 : error_level(error_level), loc(loc), message(message) {} 48 49 ErrorLevel error_level; 50 Location loc; 51 std::string message; 52 }; 53 54 using Errors = std::vector<Error>; 55 56 } // namespace wabt 57 58 #endif // WABT_ERROR_H_