Bitcoin Core
28.99.0
P2P Digital Currency
src
common
init.h
Go to the documentation of this file.
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
,
20
FAILED_WRITE
,
21
ABORTED
,
22
};
23
24
struct
ConfigError
{
25
ConfigStatus
status
;
26
bilingual_str
message
{};
27
std::vector<std::string>
details
{};
28
};
29
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
args
ArgsManager & args
Definition:
bitcoind.cpp:277
ArgsManager
Definition:
args.h:99
common
Definition:
args.cpp:868
common::ConfigStatus
ConfigStatus
Definition:
init.h:18
common::ConfigStatus::ABORTED
@ ABORTED
Aborted by user.
common::ConfigStatus::FAILED_WRITE
@ FAILED_WRITE
Failed to write settings.json.
common::ConfigStatus::FAILED
@ FAILED
Failed generically.
common::SettingsAbortFn
std::function< bool(const bilingual_str &message, const std::vector< std::string > &details)> SettingsAbortFn
Callback function to let the user decide whether to abort loading if settings.json file exists and ca...
Definition:
init.h:33
common::InitConfig
std::optional< ConfigError > InitConfig(ArgsManager &args, SettingsAbortFn settings_abort_fn)
Definition:
init.cpp:18
bilingual_str
Bilingual messages:
Definition:
translation.h:21
common::ConfigError
Definition:
init.h:24
common::ConfigError::message
bilingual_str message
Definition:
init.h:26
common::ConfigError::details
std::vector< std::string > details
Definition:
init.h:27
common::ConfigError::status
ConfigStatus status
Definition:
init.h:25
translation.h
Generated on Wed Dec 18 2024 20:00:10 for Bitcoin Core by
1.9.4