blob: 176f7ef456a532ca118b9611e7882058c3a9b973 [file] [log] [blame]
James Feist3cb5fec2018-01-23 14:41:51 -08001/*
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 Tanous072e25d2018-12-16 21:45:20 -080018#include "filesystem.hpp"
James Feistb4383f42018-08-06 16:54:10 -070019#include <nlohmann/json.hpp>
James Feist68500ff2018-08-08 15:40:42 -070020#include <sdbusplus/exception.hpp>
James Feist3cb5fec2018-01-23 14:41:51 -080021
Ed Tanous072e25d2018-12-16 21:45:20 -080022bool findFiles(const std::filesystem::path &dirPath,
James Feista3c180a2018-08-09 16:06:04 -070023 const std::string &matchString,
Ed Tanous072e25d2018-12-16 21:45:20 -080024 std::vector<std::filesystem::path> &foundPaths);
James Feistb4383f42018-08-06 16:54:10 -070025
26bool validateJson(const nlohmann::json &schemaFile,
27 const nlohmann::json &input);
James Feist68500ff2018-08-08 15:40:42 -070028struct 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};