102 std::string
const& docString,
156 double convertStringToDouble(std::string
str)
const
158 #ifdef HAVE_TEUCHOSCORE_CXX11
161 if(idx !=
str.length()) {
162 throw std::invalid_argument(
"String: '" +
str +
"' had bad formatting for converting to a double." );
166 return std::atof(str.c_str());
170 int convertStringToInt(std::string str)
const
172 #ifdef HAVE_TEUCHOSCORE_CXX11
174 int result = std::stoi(str, &idx);
175 if(idx != str.length()) {
176 throw std::invalid_argument(
"String: '" + str +
"' had bad formatting for converting to an int." );
180 return std::atoi(str.c_str());
184 int convertStringToLongLong(std::string str)
const
187 long long result = std::stoll(str, &idx);
188 if(idx != str.length()) {
189 throw std::invalid_argument(
"String: '" + str +
"' had bad formatting for converting to a long long." );
Abstract interface for an object that can validate a ParameterEntry's value.
virtual void printDoc(std::string const &docString, std::ostream &out) const =0
Print documentation for this parameter.
virtual ValidStringsList validStringValues() const =0
Return an array of strings of valid values if applicable.
virtual void validate(ParameterEntry const &entry, std::string const ¶mName, std::string const &sublistName) const =0
Validate a parameter entry value and throw std::exception (with a great error message) if validation ...
virtual void validateAndModify(std::string const ¶mName, std::string const &sublistName, ParameterEntry *entry) const
Validate and perhaps modify a parameter entry's value.
virtual const std::string getXMLTypeName() const =0
Get a string that should be used as a value of the type attribute when serializing it to XML.
RCP< const Array< std::string > > ValidStringsList
ParameterEntryValidator()
Default Constructor.
This object is held as the "value" in the Teuchos::ParameterList std::map.