Changeset View
Changeset View
Standalone View
Standalone View
src/util.h
| Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | |||||
| inline bool IsSwitchChar(char c) { | inline bool IsSwitchChar(char c) { | ||||
| #ifdef WIN32 | #ifdef WIN32 | ||||
| return c == '-' || c == '/'; | return c == '-' || c == '/'; | ||||
| #else | #else | ||||
| return c == '-'; | return c == '-'; | ||||
| #endif | #endif | ||||
| } | } | ||||
| // ArgsManager Defaults | |||||
| static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false; | |||||
| static const bool DEFAULT_PERSIST_MEMPOOL = true; | |||||
| class ArgsManager { | class ArgsManager { | ||||
| protected: | protected: | ||||
| CCriticalSection cs_args; | CCriticalSection cs_args; | ||||
| std::map<std::string, std::string> mapArgs; | std::map<std::string, std::string> mapArgs; | ||||
| std::map<std::string, std::vector<std::string>> mapMultiArgs; | std::map<std::string, std::vector<std::string>> mapMultiArgs; | ||||
| public: | public: | ||||
| void ParseParameters(int argc, const char *const argv[]); | void ParseParameters(int argc, const char *const argv[]); | ||||
| ▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | public: | ||||
| void ForceSetArg(const std::string &strArg, const std::string &strValue); | void ForceSetArg(const std::string &strArg, const std::string &strValue); | ||||
| // Forces a multi arg setting, used only in testing | // Forces a multi arg setting, used only in testing | ||||
| void ForceSetMultiArg(const std::string &strArg, | void ForceSetMultiArg(const std::string &strArg, | ||||
| const std::string &strValue); | const std::string &strValue); | ||||
| // Remove an arg setting, used only in testing | // Remove an arg setting, used only in testing | ||||
| void ClearArg(const std::string &strArg); | void ClearArg(const std::string &strArg); | ||||
| // Specific arguments | |||||
| bool IsHelpSet(); | |||||
| bool IsVersionSet(); | |||||
| // datadir | |||||
| bool IsDataDirSet(); | |||||
| std::string GetDataDir(); | |||||
| std::string DataDirHelp(); | |||||
| bool SoftSetDataDir(const std::string &strValue); | |||||
| // stopafterblockimport | |||||
| bool IsStopAfterBlockImportSet(); | |||||
| std::string StopAfterBlockImportHelp(); | |||||
| // persistmempool | |||||
| bool IsPersistMempoolSet(); | |||||
| std::string PersistMempoolHelp(); | |||||
| bool SoftSetPersistMempool(bool fValue); | |||||
| }; | }; | ||||
| extern ArgsManager gArgs; | extern ArgsManager gArgs; | ||||
| /** | /** | ||||
| * Format a string to be used as group of options in help messages. | * Format a string to be used as group of options in help messages. | ||||
| * | * | ||||
| * @param message Group name (e.g. "RPC server options:") | * @param message Group name (e.g. "RPC server options:") | ||||
| ▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines | |||||