@@ -104,7 +104,7 @@ KeyInfo InterpretKey(std::string key)
104
104
* @return parsed settings value if it is valid, otherwise nullopt accompanied
105
105
* by a descriptive error string
106
106
*/
107
- std::optional<util ::SettingsValue> InterpretValue (const KeyInfo& key, const std::string* value,
107
+ std::optional<common ::SettingsValue> InterpretValue (const KeyInfo& key, const std::string* value,
108
108
unsigned int flags, std::string& error)
109
109
{
110
110
// Return negated settings as false values.
@@ -238,15 +238,15 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
238
238
return false ;
239
239
}
240
240
241
- std::optional<util ::SettingsValue> value = InterpretValue (keyinfo, val ? &*val : nullptr , *flags, error);
241
+ std::optional<common ::SettingsValue> value = InterpretValue (keyinfo, val ? &*val : nullptr , *flags, error);
242
242
if (!value) return false ;
243
243
244
244
m_settings.command_line_options [keyinfo.name ].push_back (*value);
245
245
}
246
246
247
247
// we do not allow -includeconf from command line, only -noincludeconf
248
- if (auto * includes = util ::FindKey (m_settings.command_line_options , " includeconf" )) {
249
- const util ::SettingsSpan values{*includes};
248
+ if (auto * includes = common ::FindKey (m_settings.command_line_options , " includeconf" )) {
249
+ const common ::SettingsSpan values{*includes};
250
250
// Range may be empty if -noincludeconf was passed
251
251
if (!values.empty ()) {
252
252
error = " -includeconf cannot be used from commandline; -includeconf=" + values.begin ()->write ();
@@ -361,7 +361,7 @@ std::optional<const ArgsManager::Command> ArgsManager::GetCommand() const
361
361
std::vector<std::string> ArgsManager::GetArgs (const std::string& strArg) const
362
362
{
363
363
std::vector<std::string> result;
364
- for (const util ::SettingsValue& value : GetSettingsList (strArg)) {
364
+ for (const common ::SettingsValue& value : GetSettingsList (strArg)) {
365
365
result.push_back (value.isFalse () ? " 0" : value.isTrue () ? " 1" : value.get_str ());
366
366
}
367
367
return result;
@@ -408,7 +408,7 @@ bool ArgsManager::ReadSettingsFile(std::vector<std::string>* errors)
408
408
LOCK (cs_args);
409
409
m_settings.rw_settings .clear ();
410
410
std::vector<std::string> read_errors;
411
- if (!util ::ReadSettings (path, m_settings.rw_settings , read_errors)) {
411
+ if (!common ::ReadSettings (path, m_settings.rw_settings , read_errors)) {
412
412
SaveErrors (read_errors, errors);
413
413
return false ;
414
414
}
@@ -430,7 +430,7 @@ bool ArgsManager::WriteSettingsFile(std::vector<std::string>* errors, bool backu
430
430
431
431
LOCK (cs_args);
432
432
std::vector<std::string> write_errors;
433
- if (!util ::WriteSettings (path_tmp, m_settings.rw_settings , write_errors)) {
433
+ if (!common ::WriteSettings (path_tmp, m_settings.rw_settings , write_errors)) {
434
434
SaveErrors (write_errors, errors);
435
435
return false ;
436
436
}
@@ -441,10 +441,10 @@ bool ArgsManager::WriteSettingsFile(std::vector<std::string>* errors, bool backu
441
441
return true ;
442
442
}
443
443
444
- util ::SettingsValue ArgsManager::GetPersistentSetting (const std::string& name) const
444
+ common ::SettingsValue ArgsManager::GetPersistentSetting (const std::string& name) const
445
445
{
446
446
LOCK (cs_args);
447
- return util ::GetSetting (m_settings, m_network, name, !UseDefaultSection (" -" + name),
447
+ return common ::GetSetting (m_settings, m_network, name, !UseDefaultSection (" -" + name),
448
448
/* ignore_nonpersistent=*/ true , /* get_chain_type=*/ false );
449
449
}
450
450
@@ -460,11 +460,11 @@ std::string ArgsManager::GetArg(const std::string& strArg, const std::string& st
460
460
461
461
std::optional<std::string> ArgsManager::GetArg (const std::string& strArg) const
462
462
{
463
- const util ::SettingsValue value = GetSetting (strArg);
463
+ const common ::SettingsValue value = GetSetting (strArg);
464
464
return SettingToString (value);
465
465
}
466
466
467
- std::optional<std::string> SettingToString (const util ::SettingsValue& value)
467
+ std::optional<std::string> SettingToString (const common ::SettingsValue& value)
468
468
{
469
469
if (value.isNull ()) return std::nullopt;
470
470
if (value.isFalse ()) return " 0" ;
@@ -473,7 +473,7 @@ std::optional<std::string> SettingToString(const util::SettingsValue& value)
473
473
return value.get_str ();
474
474
}
475
475
476
- std::string SettingToString (const util ::SettingsValue& value, const std::string& strDefault)
476
+ std::string SettingToString (const common ::SettingsValue& value, const std::string& strDefault)
477
477
{
478
478
return SettingToString (value).value_or (strDefault);
479
479
}
@@ -485,11 +485,11 @@ int64_t ArgsManager::GetIntArg(const std::string& strArg, int64_t nDefault) cons
485
485
486
486
std::optional<int64_t > ArgsManager::GetIntArg (const std::string& strArg) const
487
487
{
488
- const util ::SettingsValue value = GetSetting (strArg);
488
+ const common ::SettingsValue value = GetSetting (strArg);
489
489
return SettingToInt (value);
490
490
}
491
491
492
- std::optional<int64_t > SettingToInt (const util ::SettingsValue& value)
492
+ std::optional<int64_t > SettingToInt (const common ::SettingsValue& value)
493
493
{
494
494
if (value.isNull ()) return std::nullopt;
495
495
if (value.isFalse ()) return 0 ;
@@ -498,7 +498,7 @@ std::optional<int64_t> SettingToInt(const util::SettingsValue& value)
498
498
return LocaleIndependentAtoi<int64_t >(value.get_str ());
499
499
}
500
500
501
- int64_t SettingToInt (const util ::SettingsValue& value, int64_t nDefault)
501
+ int64_t SettingToInt (const common ::SettingsValue& value, int64_t nDefault)
502
502
{
503
503
return SettingToInt (value).value_or (nDefault);
504
504
}
@@ -510,18 +510,18 @@ bool ArgsManager::GetBoolArg(const std::string& strArg, bool fDefault) const
510
510
511
511
std::optional<bool > ArgsManager::GetBoolArg (const std::string& strArg) const
512
512
{
513
- const util ::SettingsValue value = GetSetting (strArg);
513
+ const common ::SettingsValue value = GetSetting (strArg);
514
514
return SettingToBool (value);
515
515
}
516
516
517
- std::optional<bool > SettingToBool (const util ::SettingsValue& value)
517
+ std::optional<bool > SettingToBool (const common ::SettingsValue& value)
518
518
{
519
519
if (value.isNull ()) return std::nullopt;
520
520
if (value.isBool ()) return value.get_bool ();
521
521
return InterpretBool (value.get_str ());
522
522
}
523
523
524
- bool SettingToBool (const util ::SettingsValue& value, bool fDefault )
524
+ bool SettingToBool (const common ::SettingsValue& value, bool fDefault )
525
525
{
526
526
return SettingToBool (value).value_or (fDefault );
527
527
}
@@ -738,7 +738,7 @@ std::variant<ChainType, std::string> ArgsManager::GetChainArg() const
738
738
{
739
739
auto get_net = [&](const std::string& arg) {
740
740
LOCK (cs_args);
741
- util ::SettingsValue value = util ::GetSetting (m_settings, /* section= */ " " , SettingName (arg),
741
+ common ::SettingsValue value = common ::GetSetting (m_settings, /* section= */ " " , SettingName (arg),
742
742
/* ignore_default_section_config= */ false ,
743
743
/* ignore_nonpersistent=*/ false ,
744
744
/* get_chain_type= */ true );
@@ -769,24 +769,24 @@ bool ArgsManager::UseDefaultSection(const std::string& arg) const
769
769
return m_network == ChainTypeToString (ChainType::MAIN) || m_network_only_args.count (arg) == 0 ;
770
770
}
771
771
772
- util ::SettingsValue ArgsManager::GetSetting (const std::string& arg) const
772
+ common ::SettingsValue ArgsManager::GetSetting (const std::string& arg) const
773
773
{
774
774
LOCK (cs_args);
775
- return util ::GetSetting (
775
+ return common ::GetSetting (
776
776
m_settings, m_network, SettingName (arg), !UseDefaultSection (arg),
777
777
/* ignore_nonpersistent=*/ false , /* get_chain_type=*/ false );
778
778
}
779
779
780
- std::vector<util ::SettingsValue> ArgsManager::GetSettingsList (const std::string& arg) const
780
+ std::vector<common ::SettingsValue> ArgsManager::GetSettingsList (const std::string& arg) const
781
781
{
782
782
LOCK (cs_args);
783
- return util ::GetSettingsList (m_settings, m_network, SettingName (arg), !UseDefaultSection (arg));
783
+ return common ::GetSettingsList (m_settings, m_network, SettingName (arg), !UseDefaultSection (arg));
784
784
}
785
785
786
786
void ArgsManager::logArgsPrefix (
787
787
const std::string& prefix,
788
788
const std::string& section,
789
- const std::map<std::string, std::vector<util ::SettingsValue>>& args) const
789
+ const std::map<std::string, std::vector<common ::SettingsValue>>& args) const
790
790
{
791
791
std::string section_str = section.empty () ? " " : " [" + section + " ] " ;
792
792
for (const auto & arg : args) {
0 commit comments