Bitcoin ABC 0.32.4
P2P Digital Currency
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
15class ArgsManager;
16
17namespace common {
18enum class ConfigStatus {
20 FAILED,
24 ABORTED,
25};
26
30 std::vector<std::string> details{};
31};
32
36using SettingsAbortFn = std::function<bool(
37 const bilingual_str &message, const std::vector<std::string> &details)>;
38
42std::optional<ConfigError>
43InitConfig(ArgsManager &args, SettingsAbortFn settings_abort_fn = nullptr);
44} // namespace common
45
46#endif // BITCOIN_COMMON_INIT_H
Definition: args.cpp:865
std::optional< ConfigError > InitConfig(ArgsManager &args, SettingsAbortFn settings_abort_fn)
Read config files, and create datadir and settings.json if they don't exist.
Definition: init.cpp:19
ConfigStatus
Definition: init.h:18
@ ABORTED
Aborted by user.
@ FAILED_WRITE
Failed to write settings.json.
@ FAILED
Failed generically.
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:37
Bilingual messages:
Definition: translation.h:17
bilingual_str message
Definition: init.h:29
std::vector< std::string > details
Definition: init.h:30
ConfigStatus status
Definition: init.h:28