James Feist | 3cb5fec | 2018-01-23 14:41:51 -0800 | [diff] [blame] | 1 | /* |
| 2 | // Copyright (c) 2017 Intel Corporation |
| 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 | #pragma once |
Ed Tanous | 072e25d | 2018-12-16 21:45:20 -0800 | [diff] [blame] | 18 | #include "filesystem.hpp" |
James Feist | a465ccc | 2019-02-08 12:51:01 -0800 | [diff] [blame] | 19 | |
James Feist | b4383f4 | 2018-08-06 16:54:10 -0700 | [diff] [blame] | 20 | #include <nlohmann/json.hpp> |
James Feist | 68500ff | 2018-08-08 15:40:42 -0700 | [diff] [blame] | 21 | #include <sdbusplus/exception.hpp> |
James Feist | 3cb5fec | 2018-01-23 14:41:51 -0800 | [diff] [blame] | 22 | |
James Feist | a465ccc | 2019-02-08 12:51:01 -0800 | [diff] [blame] | 23 | bool findFiles(const std::filesystem::path& dirPath, |
| 24 | const std::string& matchString, |
| 25 | std::vector<std::filesystem::path>& foundPaths); |
James Feist | b4383f4 | 2018-08-06 16:54:10 -0700 | [diff] [blame] | 26 | |
James Feist | a465ccc | 2019-02-08 12:51:01 -0800 | [diff] [blame] | 27 | bool validateJson(const nlohmann::json& schemaFile, |
| 28 | const nlohmann::json& input); |
James Feist | 68500ff | 2018-08-08 15:40:42 -0700 | [diff] [blame] | 29 | struct DBusInternalError final : public sdbusplus::exception_t |
| 30 | { |
James Feist | a465ccc | 2019-02-08 12:51:01 -0800 | [diff] [blame] | 31 | const char* name() const noexcept override |
James Feist | 68500ff | 2018-08-08 15:40:42 -0700 | [diff] [blame] | 32 | { |
| 33 | return "org.freedesktop.DBus.Error.Failed"; |
| 34 | }; |
James Feist | a465ccc | 2019-02-08 12:51:01 -0800 | [diff] [blame] | 35 | const char* description() const noexcept override |
James Feist | 68500ff | 2018-08-08 15:40:42 -0700 | [diff] [blame] | 36 | { |
| 37 | return "internal error"; |
| 38 | }; |
James Feist | a465ccc | 2019-02-08 12:51:01 -0800 | [diff] [blame] | 39 | const char* what() const noexcept override |
James Feist | 68500ff | 2018-08-08 15:40:42 -0700 | [diff] [blame] | 40 | { |
| 41 | return "org.freedesktop.DBus.Error.Failed: " |
| 42 | "internal error"; |
| 43 | }; |
| 44 | }; |