@@ -113,8 +113,6 @@ void ConfigParser::processIncludedFile(const std::string &fname) {
113113 baseDirs.pop_back ();
114114}
115115
116-
117-
118116bool ConfigParser::parseKeyValue (const std::string& trimmedLine, std::string& key, std::string& value) {
119117 // Parse trimmed line, taking into account comments and quoting.
120118 key.clear ();
@@ -598,14 +596,7 @@ enabled_t ConfigParser::getEnabled(const string& key) {
598596 return x;
599597}
600598
601- int ConfigParser::getInt (const string& key) {
602- string value = getString (key);
603- int x;
604- if (!Global::tryStringToInt (value,x))
605- throw IOError (" Could not parse '" + value + " ' as int for key '" + key + " ' in config file " + fileName);
606- return x;
607- }
608- int ConfigParser::getInt (const string& key, int min, int max) {
599+ int ConfigParser::getInt (const string& key, const int min, const int max) {
609600 assert (min <= max);
610601 string value = getString (key);
611602 int x;
@@ -615,19 +606,8 @@ int ConfigParser::getInt(const string& key, int min, int max) {
615606 throw IOError (" Key '" + key + " ' must be in the range " + Global::intToString (min) + " to " + Global::intToString (max) + " in config file " + fileName);
616607 return x;
617608}
618- vector<int > ConfigParser::getInts (const string& key) {
619- vector<string> values = getStrings (key);
620- vector<int > ret;
621- for (size_t i = 0 ; i<values.size (); i++) {
622- const string& value = values[i];
623- int x;
624- if (!Global::tryStringToInt (value,x))
625- throw IOError (" Could not parse '" + value + " ' as int for key '" + key + " ' in config file " + fileName);
626- ret.push_back (x);
627- }
628- return ret;
629- }
630- vector<int > ConfigParser::getInts (const string& key, int min, int max) {
609+
610+ vector<int > ConfigParser::getInts (const string& key, const int min, const int max) {
631611 vector<string> values = getStrings (key);
632612 vector<int > ret;
633613 for (size_t i = 0 ; i<values.size (); i++) {
@@ -670,15 +650,7 @@ vector<std::pair<int,int>> ConfigParser::getNonNegativeIntDashedPairs(const stri
670650 return ret;
671651}
672652
673-
674- int64_t ConfigParser::getInt64 (const string& key) {
675- string value = getString (key);
676- int64_t x;
677- if (!Global::tryStringToInt64 (value,x))
678- throw IOError (" Could not parse '" + value + " ' as int64_t for key '" + key + " ' in config file " + fileName);
679- return x;
680- }
681- int64_t ConfigParser::getInt64 (const string& key, int64_t min, int64_t max) {
653+ int64_t ConfigParser::getInt64 (const string& key, const int64_t min, const int64_t max) {
682654 assert (min <= max);
683655 string value = getString (key);
684656 int64_t x;
@@ -688,19 +660,8 @@ int64_t ConfigParser::getInt64(const string& key, int64_t min, int64_t max) {
688660 throw IOError (" Key '" + key + " ' must be in the range " + Global::int64ToString (min) + " to " + Global::int64ToString (max) + " in config file " + fileName);
689661 return x;
690662}
691- vector<int64_t > ConfigParser::getInt64s (const string& key) {
692- vector<string> values = getStrings (key);
693- vector<int64_t > ret;
694- for (size_t i = 0 ; i<values.size (); i++) {
695- const string& value = values[i];
696- int64_t x;
697- if (!Global::tryStringToInt64 (value,x))
698- throw IOError (" Could not parse '" + value + " ' as int64_t for key '" + key + " ' in config file " + fileName);
699- ret.push_back (x);
700- }
701- return ret;
702- }
703- vector<int64_t > ConfigParser::getInt64s (const string& key, int64_t min, int64_t max) {
663+
664+ vector<int64_t > ConfigParser::getInt64s (const string& key, const int64_t min, const int64_t max) {
704665 vector<string> values = getStrings (key);
705666 vector<int64_t > ret;
706667 for (size_t i = 0 ; i<values.size (); i++) {
@@ -715,15 +676,7 @@ vector<int64_t> ConfigParser::getInt64s(const string& key, int64_t min, int64_t
715676 return ret;
716677}
717678
718-
719- uint64_t ConfigParser::getUInt64 (const string& key) {
720- string value = getString (key);
721- uint64_t x;
722- if (!Global::tryStringToUInt64 (value,x))
723- throw IOError (" Could not parse '" + value + " ' as uint64_t for key '" + key + " ' in config file " + fileName);
724- return x;
725- }
726- uint64_t ConfigParser::getUInt64 (const string& key, uint64_t min, uint64_t max) {
679+ uint64_t ConfigParser::getUInt64 (const string& key, const uint64_t min, const uint64_t max) {
727680 assert (min <= max);
728681 string value = getString (key);
729682 uint64_t x;
@@ -733,19 +686,8 @@ uint64_t ConfigParser::getUInt64(const string& key, uint64_t min, uint64_t max)
733686 throw IOError (" Key '" + key + " ' must be in the range " + Global::uint64ToString (min) + " to " + Global::uint64ToString (max) + " in config file " + fileName);
734687 return x;
735688}
736- vector<uint64_t > ConfigParser::getUInt64s (const string& key) {
737- vector<string> values = getStrings (key);
738- vector<uint64_t > ret;
739- for (size_t i = 0 ; i<values.size (); i++) {
740- const string& value = values[i];
741- uint64_t x;
742- if (!Global::tryStringToUInt64 (value,x))
743- throw IOError (" Could not parse '" + value + " ' as uint64_t for key '" + key + " ' in config file " + fileName);
744- ret.push_back (x);
745- }
746- return ret;
747- }
748- vector<uint64_t > ConfigParser::getUInt64s (const string& key, uint64_t min, uint64_t max) {
689+
690+ vector<uint64_t > ConfigParser::getUInt64s (const string& key, const uint64_t min, const uint64_t max) {
749691 vector<string> values = getStrings (key);
750692 vector<uint64_t > ret;
751693 for (size_t i = 0 ; i<values.size (); i++) {
@@ -760,15 +702,7 @@ vector<uint64_t> ConfigParser::getUInt64s(const string& key, uint64_t min, uint6
760702 return ret;
761703}
762704
763-
764- float ConfigParser::getFloat (const string& key) {
765- string value = getString (key);
766- float x;
767- if (!Global::tryStringToFloat (value,x))
768- throw IOError (" Could not parse '" + value + " ' as float for key '" + key + " ' in config file " + fileName);
769- return x;
770- }
771- float ConfigParser::getFloat (const string& key, float min, float max) {
705+ float ConfigParser::getFloat (const string& key, const float min, const float max) {
772706 assert (min <= max);
773707 string value = getString (key);
774708 float x;
@@ -780,19 +714,8 @@ float ConfigParser::getFloat(const string& key, float min, float max) {
780714 throw IOError (" Key '" + key + " ' must be in the range " + Global::floatToString (min) + " to " + Global::floatToString (max) + " in config file " + fileName);
781715 return x;
782716}
783- vector<float > ConfigParser::getFloats (const string& key) {
784- vector<string> values = getStrings (key);
785- vector<float > ret;
786- for (size_t i = 0 ; i<values.size (); i++) {
787- const string& value = values[i];
788- float x;
789- if (!Global::tryStringToFloat (value,x))
790- throw IOError (" Could not parse '" + value + " ' as float for key '" + key + " ' in config file " + fileName);
791- ret.push_back (x);
792- }
793- return ret;
794- }
795- vector<float > ConfigParser::getFloats (const string& key, float min, float max) {
717+
718+ vector<float > ConfigParser::getFloats (const string& key, const float min, const float max) {
796719 vector<string> values = getStrings (key);
797720 vector<float > ret;
798721 for (size_t i = 0 ; i<values.size (); i++) {
@@ -809,15 +732,7 @@ vector<float> ConfigParser::getFloats(const string& key, float min, float max) {
809732 return ret;
810733}
811734
812-
813- double ConfigParser::getDouble (const string& key) {
814- string value = getString (key);
815- double x;
816- if (!Global::tryStringToDouble (value,x))
817- throw IOError (" Could not parse '" + value + " ' as double for key '" + key + " ' in config file " + fileName);
818- return x;
819- }
820- double ConfigParser::getDouble (const string& key, double min, double max) {
735+ double ConfigParser::getDouble (const string& key, const double min, const double max) {
821736 assert (min <= max);
822737 string value = getString (key);
823738 double x;
@@ -829,19 +744,8 @@ double ConfigParser::getDouble(const string& key, double min, double max) {
829744 throw IOError (" Key '" + key + " ' must be in the range " + Global::doubleToString (min) + " to " + Global::doubleToString (max) + " in config file " + fileName);
830745 return x;
831746}
832- vector<double > ConfigParser::getDoubles (const string& key) {
833- vector<string> values = getStrings (key);
834- vector<double > ret;
835- for (size_t i = 0 ; i<values.size (); i++) {
836- const string& value = values[i];
837- double x;
838- if (!Global::tryStringToDouble (value,x))
839- throw IOError (" Could not parse '" + value + " ' as double for key '" + key + " ' in config file " + fileName);
840- ret.push_back (x);
841- }
842- return ret;
843- }
844- vector<double > ConfigParser::getDoubles (const string& key, double min, double max) {
747+
748+ vector<double > ConfigParser::getDoubles (const string& key, const double min, const double max) {
845749 vector<string> values = getStrings (key);
846750 vector<double > ret;
847751 for (size_t i = 0 ; i<values.size (); i++) {
0 commit comments