X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/f48b5b729bb0a1bdf88c1eebdb7e754c4d6bac92..5130ec50731e50037c30d3a1a4149fbc07cc0256:/projects/sgauth/settings_impl.cpp diff --git a/projects/sgauth/settings_impl.cpp b/projects/sgauth/settings_impl.cpp index 44088d1f..1a7b8dcd 100644 --- a/projects/sgauth/settings_impl.cpp +++ b/projects/sgauth/settings_impl.cpp @@ -38,71 +38,6 @@ SETTINGS_IMPL::SETTINGS_IMPL() { } //----------------------------------------------------------------------------- -int SETTINGS_IMPL::ParseYesNo(const string & value, bool * val) -{ -if (0 == strcasecmp(value.c_str(), "yes")) - { - *val = true; - return 0; - } -if (0 == strcasecmp(value.c_str(), "no")) - { - *val = false; - return 0; - } - -strError = "Incorrect value \'" + value + "\'."; -return -1; -} -//----------------------------------------------------------------------------- -int SETTINGS_IMPL::ParseInt(const string & value, int * val) -{ -if (str2x(value, *val)) - { - strError = "Cannot convert \'" + value + "\' to integer."; - return -1; - } -return 0; -} -//----------------------------------------------------------------------------- -int SETTINGS_IMPL::ParseUnsigned(const string & value, unsigned * val) -{ -if (str2x(value, *val)) - { - strError = "Cannot convert \'" + value + "\' to unsigned integer."; - return -1; - } -return 0; -} -//----------------------------------------------------------------------------- -int SETTINGS_IMPL::ParseIntInRange(const string & value, int min, int max, int * val) -{ -if (ParseInt(value, val) != 0) - return -1; - -if (*val < min || *val > max) - { - strError = "Value \'" + value + "\' out of range."; - return -1; - } - -return 0; -} -//----------------------------------------------------------------------------- -int SETTINGS_IMPL::ParseUnsignedInRange(const string & value, unsigned min, unsigned max, unsigned * val) -{ -if (ParseUnsigned(value, val) != 0) - return -1; - -if (*val < min || *val > max) - { - strError = "Value \'" + value + "\' out of range."; - return -1; - } - -return 0; -} -//----------------------------------------------------------------------------- int SETTINGS_IMPL::ReadSettings() { CONFIGFILE cf(confFile); @@ -150,6 +85,8 @@ if (ParseIntInRange(temp, 1, 65535, &port)) return -1; } +cf.ReadString("LocalName", &localName, ""); + cf.ReadString("LocalPort", &temp, "0"); if (ParseIntInRange(temp, 0, 65535, &localPort)) {