X-Git-Url: https://git.pterodactylus.net/?p=fms.git;a=blobdiff_plain;f=src%2Foption.cpp;h=9694a452fb399338aa4cbc2caa83a57dbbd2aff0;hp=b79e90cda67223c8356608c02d6258d5494f7327;hb=278ee758050cb7772cd95946688c5b40104f4d8b;hpb=dabd19d7f764b8275c9c8370c7b89675b6a78243 diff --git a/src/option.cpp b/src/option.cpp index b79e90c..9694a45 100644 --- a/src/option.cpp +++ b/src/option.cpp @@ -20,3 +20,24 @@ const bool Option::Get(const std::string &option, std::string &value) return false; } } + +const bool Option::GetInt(const std::string &option, int &value) +{ + std::string valstr=""; + if(Get(option,valstr)) + { + std::istringstream istr(valstr); + if(istr >> value) + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } +}