Gromacs  2019
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
strconvert.h File Reference
#include <string>
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/stringutil.h"
+ Include dependency graph for strconvert.h:

Description

Declares common utility functions for conversions to and from strings.

Author
Teemu Murtola teemu.nosp@m..mur.nosp@m.tola@.nosp@m.gmai.nosp@m.l.com
Mark Abraham mark..nosp@m.j.ab.nosp@m.raham.nosp@m.@gma.nosp@m.il.co.nosp@m.m

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...
 

Overloads for converting a value of a given type to a string.

Exceptions
std::bad_allocif out of memory.
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)