LCOV - code coverage report
Current view: top level - src/common - init.h (source / functions) Hit Total Coverage
Test: fuzz_coverage.info Lines: 0 1 0.0 %
Date: 2023-11-10 23:46:46 Functions: 0 2 0.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // Copyright (c) 2023 The Bitcoin Core developers
       2                 :            : // Distributed under the MIT software license, see the accompanying
       3                 :            : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4                 :            : 
       5                 :            : #ifndef BITCOIN_COMMON_INIT_H
       6                 :            : #define BITCOIN_COMMON_INIT_H
       7                 :            : 
       8                 :            : #include <util/translation.h>
       9                 :            : 
      10                 :            : #include <functional>
      11                 :            : #include <optional>
      12                 :            : #include <string>
      13                 :            : #include <vector>
      14                 :            : 
      15                 :            : class ArgsManager;
      16                 :            : 
      17                 :            : namespace common {
      18                 :            : enum class ConfigStatus {
      19                 :            :     FAILED,       //!< Failed generically.
      20                 :            :     FAILED_WRITE, //!< Failed to write settings.json
      21                 :            :     ABORTED,      //!< Aborted by user
      22                 :            : };
      23                 :            : 
      24                 :          0 : struct ConfigError {
      25                 :            :     ConfigStatus status;
      26                 :            :     bilingual_str message{};
      27                 :            :     std::vector<std::string> details{};
      28                 :            : };
      29                 :            : 
      30                 :            : //! Callback function to let the user decide whether to abort loading if
      31                 :            : //! settings.json file exists and can't be parsed, or to ignore the error and
      32                 :            : //! overwrite the file.
      33                 :            : using SettingsAbortFn = std::function<bool(const bilingual_str& message, const std::vector<std::string>& details)>;
      34                 :            : 
      35                 :            : /* Read config files, and create datadir and settings.json if they don't exist. */
      36                 :            : std::optional<ConfigError> InitConfig(ArgsManager& args, SettingsAbortFn settings_abort_fn = nullptr);
      37                 :            : } // namespace common
      38                 :            : 
      39                 :            : #endif // BITCOIN_COMMON_INIT_H

Generated by: LCOV version 1.14