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