Gromacs
2022.2
|
#include <algorithm>
#include <array>
#include <optional>
#include <string>
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/stringutil.h"
Declares common utility functions for conversions to and from strings.
Functions | |||
bool | gmx::boolFromString (const char *str) | ||
Parses a boolean from a string. More... | |||
int | gmx::intFromString (const char *str) | ||
Parses an integer from a string. More... | |||
int64_t | gmx::int64FromString (const char *str) | ||
Parses a 64-bit integer from a string. More... | |||
float | gmx::floatFromString (const char *str) | ||
Parses a float value from a string. More... | |||
double | gmx::doubleFromString (const char *str) | ||
Parses a double value from a string. More... | |||
template<typename T > | |||
static T | gmx::fromString (const char *str) | ||
Parses a value from a string to a given type. More... | |||
template<typename T > | |||
static T | gmx::fromString (const std::string &str) | ||
Parses a value from a string to a given type. More... | |||
template<typename T > | |||
static T | gmx::fromStdString (const std::string &str) | ||
Parses a value from a string to a given type. More... | |||
template<> | |||
bool | gmx::fromString< bool > (const char *str) | ||
Implementation for boolean values. | |||
template<> | |||
int | gmx::fromString< int > (const char *str) | ||
Implementation for integer values. | |||
template<> | |||
int64_t | gmx::fromString< int64_t > (const char *str) | ||
Implementation for 64-bit integer values. | |||
template<> | |||
float | gmx::fromString< float > (const char *str) | ||
Implementation for float values. | |||
template<> | |||
double | gmx::fromString< double > (const char *str) | ||
Implementation for double values. | |||
static const char * | gmx::boolToString (bool value) | ||
Converts a boolean to a "true"/"false" string. More... | |||
static std::string | gmx::intToString (int t) | ||
Returns a string containing the value of t . More... | |||
static std::string | gmx::int64ToString (int64_t t) | ||
Returns a string containing the value of t . More... | |||
static std::string | gmx::doubleToString (double t) | ||
Returns a string containing the value of t . More... | |||
template<typename ValueType , int NumExpectedValues> | |||
static std::optional < std::array< ValueType, NumExpectedValues > > | gmx::parsedArrayFromInputString (const std::string &str) | ||
Convert a string into an array of values. More... | |||
template<typename ValueType , int NumExpectedValues> | |||
static std::string | gmx::stringIdentityTransformWithArrayCheck (const std::string &toConvert, const std::string &errorContextMessage) | ||
Returns the input string, throwing an excpetion if the demanded conversion to an array will not succeed. More... | |||
Overloads for converting a value of a given type to a string.
| |||
static std::string | gmx::toString (bool t) | ||
static std::string | gmx::toString (int t) | ||
static std::string | gmx::toString (int64_t t) | ||
static std::string | gmx::toString (float t) | ||
static std::string | gmx::toString (double t) | ||
static std::string | gmx::toString (std::string t) | ||