Changeset View
Changeset View
Standalone View
Standalone View
src/util.h
Show All 19 Lines | |||||
#include "sync.h" | #include "sync.h" | ||||
#include "tinyformat.h" | #include "tinyformat.h" | ||||
#include "utiltime.h" | #include "utiltime.h" | ||||
#include <atomic> | #include <atomic> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <exception> | #include <exception> | ||||
#include <map> | #include <map> | ||||
#include <set> | |||||
#include <string> | #include <string> | ||||
#include <unordered_set> | #include <unordered_set> | ||||
#include <vector> | #include <vector> | ||||
#include <boost/signals2/signal.hpp> | #include <boost/signals2/signal.hpp> | ||||
#include <boost/thread/condition_variable.hpp> // for boost::thread_interrupted | #include <boost/thread/condition_variable.hpp> // for boost::thread_interrupted | ||||
// Application startup time (used for uptime calculation) | // Application startup time (used for uptime calculation) | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
class ArgsManager { | class ArgsManager { | ||||
protected: | protected: | ||||
friend class ArgsManagerHelper; | friend class ArgsManagerHelper; | ||||
mutable CCriticalSection cs_args; | mutable CCriticalSection cs_args; | ||||
std::map<std::string, std::vector<std::string>> m_override_args; | std::map<std::string, std::vector<std::string>> m_override_args; | ||||
std::map<std::string, std::vector<std::string>> m_config_args; | std::map<std::string, std::vector<std::string>> m_config_args; | ||||
std::string m_network; | std::string m_network; | ||||
std::set<std::string> m_network_only_args; | |||||
void ReadConfigStream(std::istream &stream); | void ReadConfigStream(std::istream &stream); | ||||
public: | public: | ||||
ArgsManager(); | |||||
/** | /** | ||||
* Select the network in use | * Select the network in use | ||||
*/ | */ | ||||
void SelectConfigNetwork(const std::string &network); | void SelectConfigNetwork(const std::string &network); | ||||
void ParseParameters(int argc, const char *const argv[]); | void ParseParameters(int argc, const char *const argv[]); | ||||
void ReadConfigFile(const std::string &confPath); | void ReadConfigFile(const std::string &confPath); | ||||
/** | /** | ||||
* Log warnings for options in m_section_only_args when they are specified | |||||
* in the default section but not overridden on the command line or in a | |||||
* network-specific section in the config file. | |||||
*/ | |||||
void WarnForSectionOnlyArgs(); | |||||
/** | |||||
* Return a vector of strings of the given argument | * Return a vector of strings of the given argument | ||||
* | * | ||||
* @param strArg Argument to get (e.g. "-foo") | * @param strArg Argument to get (e.g. "-foo") | ||||
* @return command-line arguments | * @return command-line arguments | ||||
*/ | */ | ||||
std::vector<std::string> GetArgs(const std::string &strArg) const; | std::vector<std::string> GetArgs(const std::string &strArg) const; | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 146 Lines • Show Last 20 Lines |