2021-03-27 08:39:03 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
|
|
|
/*
|
2023-11-09 12:23:00 -06:00
|
|
|
* Copyright the Collabora Online contributors.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*
|
2021-03-27 08:39:03 -05:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Configuration related utilities.
|
|
|
|
// Placed here to reduce avoid polluting
|
|
|
|
// Util.hpp with the config headers.
|
2021-03-27 16:39:45 -05:00
|
|
|
// This is designed to be used from both wsd and kit.
|
2021-03-27 08:39:03 -05:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2021-03-27 16:39:45 -05:00
|
|
|
namespace Poco
|
|
|
|
{
|
|
|
|
namespace Util
|
|
|
|
{
|
|
|
|
class AbstractConfiguration;
|
|
|
|
}
|
|
|
|
} // namespace Poco
|
2021-03-27 08:39:03 -05:00
|
|
|
|
|
|
|
namespace config
|
|
|
|
{
|
2021-03-27 16:39:45 -05:00
|
|
|
/// Initialize the config from an XML string.
|
|
|
|
void initialize(const std::string& xml);
|
|
|
|
|
|
|
|
/// Initialize the config given a pointer to a long-lived pointer.
|
|
|
|
void initialize(const Poco::Util::AbstractConfiguration* config);
|
|
|
|
|
2021-06-21 03:34:58 -05:00
|
|
|
/// Check if the config has been initialized
|
|
|
|
bool isInitialized();
|
|
|
|
|
2021-03-27 08:39:03 -05:00
|
|
|
/// Returns the value of an entry as string or @def if it is not found.
|
2021-03-27 16:39:45 -05:00
|
|
|
std::string getString(const std::string& key, const std::string& def);
|
2021-03-27 08:39:03 -05:00
|
|
|
|
2022-07-05 07:03:14 -05:00
|
|
|
/// Returns true if and only if the property with the given key exists.
|
|
|
|
bool has(const std::string& key);
|
|
|
|
|
2021-03-27 08:39:03 -05:00
|
|
|
/// Returns the value of an entry as string or @def if it is not found.
|
2021-03-27 16:39:45 -05:00
|
|
|
bool getBool(const std::string& key, const bool def);
|
|
|
|
|
|
|
|
/// Return true if SSL is enabled in the config and no fuzzing is enabled.
|
|
|
|
bool isSslEnabled();
|
2021-03-27 08:39:03 -05:00
|
|
|
|
2021-06-21 03:34:58 -05:00
|
|
|
} // namespace config
|