MeVisLab Toolbox Reference
|
The class StringConversion provides static methods to convert ML objects to and from strings. More...
#include <mlStringConversion.h>
Static Public Member Functions | |
String construction and destruction: | |
Convenience method to create a copy of the string On allocation failures and exceptions it posts a fatal error and returns NULL if error handling allows continuing. | |
static char * | newString (const std::string &str) |
static void | deleteString (char *str) |
Dispose a string created by newString(); NULL values as str are legal and will be ignored. | |
writeToStdString-Versions: | |
static std::string | writeToStdString (unsigned char val) |
Converts an unsigned char to a std::string. | |
static std::string | writeToStdString (char val) |
Converts char to a std::string. | |
static std::string | writeToStdString (unsigned short val) |
Converts an unsigned short to a std::string. | |
static std::string | writeToStdString (short val) |
Converts short to a std::string. | |
static std::string | writeToStdString (MLuint32 val) |
Converts uint32 to a std::string. | |
static std::string | writeToStdString (MLint32 val) |
Converts an int32 to a std::string. | |
static std::string | writeToStdString (unsigned long val) |
Converts unsigned long to std::string. | |
static std::string | writeToStdString (long val) |
Converts long to a std::string. | |
static std::string | writeToStdString (MLuint64 val) |
Converts uint64 to a std::string. | |
static std::string | writeToStdString (MLint64 val) |
Converts an int64 to a std::string. | |
static std::string | writeToStdString (MLfloat val) |
Converts float to a std::string. | |
static std::string | writeToStdString (MLdouble val) |
Converts double to a std::string. | |
static std::string | writeToStdString (MLldouble val) |
Converts long double to a std::string. | |
static std::string | writeToStdString (const Vector2 &val) |
Converts a Vector2 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (const Vector3 &val) |
Converts a Vector3 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (const Vector4 &val) |
Converts a Vector4 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (const Vector5 &val) |
Converts a Vector5 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (const Vector6 &val) |
Converts a Vector6 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (const Vector7 &val) |
Converts a Vector7 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (const Vector8 &val) |
Converts a Vector8 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (const Vector9 &val) |
Converts a Vector9 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (const Vector10 &val) |
Converts a Vector10 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (const Vector16 &val) |
Converts a Vector16 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (const Vector32 &val) |
Converts a Vector32 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (const Vector64 &val) |
Converts a Vector64 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (const ImageVector &val) |
Converts a ImageVector to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (SubImageBox const &box) |
Converts a SubImageBox to a std::string which can be parsed by readFromString(SubImageBox&). | |
static std::string | writeToStdString (SubImageBoxd const &box) |
Converts a SubImageBoxd to a std::string which can be parsed by readFromString(SubImageBoxd&). | |
static std::string | writeToStdString (Matrix2 const &mat) |
Converts a Matrix2 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (Matrix3 const &mat) |
Converts a Matrix3 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (Matrix4 const &mat) |
Converts a Matrix4 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (Matrix5 const &mat) |
Converts a Matrix5 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (Matrix6 const &mat) |
Converts a Matrix6 to a std::string which can be parsed by readFromString(). | |
static std::string | writeToStdString (const Base *const obj) |
Writes Base object to std::string. | |
static std::string | writeToStdString (const Base &obj) |
Writes Base object to std::string. | |
template<typename T > | |
static std::string | writeToStdString (const std::vector< T > &vec, const std::string &separatorString) |
Converts a std::vector value vec to a string where vector components will be separated by the string separatorString. | |
static std::string | writeToStdString (const std::string &str) |
Writes std::string object to std::string. | |
readFromString-Versions: | |
static bool | readFromString (const std::string &arg, unsigned char &val) |
Reads a value from string arg into val ; it returns true if one value has been converted successfully, otherwise false . | |
static bool | readFromString (const std::string &arg, char &val) |
Reads a value from string arg into val ; it returns true if one value has been converted successfully, otherwise false . | |
static bool | readFromString (const std::string &arg, unsigned short &val) |
Reads a value from string arg into val ; it returns true if one value has been converted successfully, otherwise false . | |
static bool | readFromString (const std::string &arg, short &val) |
Reads a value from string arg into val ; it returns true if one value has been converted successfully, otherwise false . | |
static bool | readFromString (const std::string &arg, MLuint32 &val) |
Reads a value from string arg into val ; it returns true if one value has been converted successfully, otherwise false . | |
static bool | readFromString (const std::string &arg, MLint32 &val) |
Reads a value from string arg into val ; it returns true if one value has been converted successfully, otherwise false . | |
static bool | readFromString (const std::string &arg, MLuint64 &val) |
Reads a value from string arg into val ; it returns true if one value has been converted successfully, otherwise false . | |
static bool | readFromString (const std::string &arg, MLint64 &val) |
Reads a value from string arg into val ; it returns true if one value has been converted successfully, otherwise false . | |
static bool | readFromString (std::string const &arg, unsigned long &val) |
Reads a value from string arg into val ; it returns true if one value has been converted successfully, otherwise false . | |
static bool | readFromString (std::string const &arg, long &val) |
Reads a value from string arg into val ; it returns true if one value has been converted successfully, otherwise false . | |
static bool | readFromString (std::string const &arg, float &val) |
Reads a value from string arg into val ; it returns true if one value has been converted successfully, otherwise false . | |
static bool | readFromString (std::string const &arg, double &val) |
Reads a value from string arg into val ; it returns true if one value has been converted successfully, otherwise false . | |
static bool | readFromString (std::string const &arg, long double &val) |
Reads a value from string arg into val ; it returns true if one value has been converted successfully, otherwise false . | |
static bool | readFromString (const std::string &vecstr, Vector2 &v) |
Reads a 2D double vector value v from string vecstr whose values are space separated; it returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &vecstr, Vector3 &v) |
Reads a 3D double vector value v from string vecstr whose values are space separated; it returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &vecstr, Vector4 &v) |
Reads a 4D double vector value v from string vecstr whose values are space separated; it returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &vecstr, Vector5 &v) |
Reads a 5D double vector value v from string vecstr whose values are space separated; it returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &vecstr, Vector6 &v) |
Reads a 6D double vector value v from string vecstr whose values are space separated; it returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &vecstr, Vector7 &v) |
Reads a 7D double vector value v from string vecstr whose values are space separated; it returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &vecstr, Vector8 &v) |
Reads a 8D double vector value v from string vecstr whose values are space separated; it returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &vecstr, Vector9 &v) |
Reads a 9D double vector value v from string vecstr whose values are space separated; it returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &vecstr, Vector10 &v) |
Reads a 10D double vector value v from string vecstr whose values are space separated; it returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &vecstr, Vector16 &v) |
Reads a 16D double vector value v from string vecstr whose values are space separated; it returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &vecstr, Vector32 &v) |
Reads a 32D double vector value v from string vecstr whose values are space separated; it returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &vecstr, Vector64 &v) |
Reads a 64D double vector value v from string vecstr whose values are space separated; it returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &vecstr, ImageVector &v) |
Reads a ImageVector value v from string vecstr whose values are space separated; it returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &str, Matrix2 &val) |
Reads a Matrix2 value val from string str whose values are space separated; and returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &str, Matrix3 &val) |
Reads a Matrix3 value val from string str whose values are space separated; and returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &str, Matrix4 &val) |
Reads a Matrix4 value val from string str whose values are space separated; and returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &str, Matrix5 &val) |
Reads a Matrix5 value val from string str whose values are space separated; and returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &str, Matrix6 &val) |
Reads a Matrix6 value val from string str whose values are space separated; and returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &arg, SubImageBox &val) |
Reads a SubImageBox value val from string arg whose values are space separated; and returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &arg, SubImageBoxd &val) |
Reads a SubImageBox value val from string arg whose values are space separated; and returns true if all components have been converted, otherwise false . | |
static bool | readFromString (const std::string &source, Base &obj) |
Reads a Base object from string source to obj by calling obj.setPersistentState(source.c_str()). | |
template<typename T > | |
static bool | readFromString (const std::string &vecstr, std::vector< T > &vec, const std::string &separatorString) |
Reads a std::vector<T> from a string of the form that is generated by stdVectorToString(vec, separatorString) and returns true on success and false otherwise. | |
static bool | readFromString (const std::string &source, std::string &target) |
Reads a std::string object to std::string. | |
Miscellaneous: | |
static MLint | getFirstNonSpacePos (const std::string &str, MLint pos=0) |
Helper method returning the first non-space position starting from pos . | |
The class StringConversion provides static methods to convert ML objects to and from strings.
Definition at line 29 of file mlStringConversion.h.
Dispose a string created by newString(); NULL values as str
are legal and will be ignored.
|
static |
Helper method returning the first non-space position starting from pos
.
Reads a value from string arg
into val
; it returns true
if one value has been converted successfully, otherwise false
.
Reads a value from string arg
into val
; it returns true
if one value has been converted successfully, otherwise false
.
Reads a value from string arg
into val
; it returns true
if one value has been converted successfully, otherwise false
.
Reads a value from string arg
into val
; it returns true
if one value has been converted successfully, otherwise false
.
Reads a value from string arg
into val
; it returns true
if one value has been converted successfully, otherwise false
.
Reads a value from string arg
into val
; it returns true
if one value has been converted successfully, otherwise false
.
|
static |
Reads a SubImageBox value val
from string arg
whose values are space separated; and returns true
if all components have been converted, otherwise false
.
Syntax: v1 v2 where v1, v2 are of type ImageVector
|
static |
Reads a SubImageBox value val
from string arg
whose values are space separated; and returns true
if all components have been converted, otherwise false
.
Syntax: v1 v2 where v1, v2 are of type Vector6.
|
static |
Reads a value from string arg
into val
; it returns true
if one value has been converted successfully, otherwise false
.
|
static |
Reads a value from string arg
into val
; it returns true
if one value has been converted successfully, otherwise false
.
Reads a Base object from string source
to obj
by calling obj.setPersistentState(source.c_str()).
Method provided for convenience, better use setPersistentState() directly.
|
static |
Reads a std::string object to std::string.
Will of course just copy the provided string, but is required to support using readFromString in templates that may have strings as argument type (e.g. to use readFromString for a std::vector< std::string >)
Reads a Matrix2 value val
from string str
whose values are space separated; and returns true
if all components have been converted, otherwise false
.
Reads a Matrix3 value val
from string str
whose values are space separated; and returns true
if all components have been converted, otherwise false
.
Reads a Matrix4 value val
from string str
whose values are space separated; and returns true
if all components have been converted, otherwise false
.
Reads a Matrix5 value val
from string str
whose values are space separated; and returns true
if all components have been converted, otherwise false
.
Reads a Matrix6 value val
from string str
whose values are space separated; and returns true
if all components have been converted, otherwise false
.
|
static |
Reads a ImageVector value v
from string vecstr
whose values are space separated; it returns true
if all components have been converted, otherwise false
.
|
inlinestatic |
Reads a std::vector<T> from a string of the form that is generated by stdVectorToString(vec, separatorString) and returns true
on success and false otherwise.
The type T must be supported by one of the readFromString methods implemented in this class. separatorString must be non NULL and correctly null terminated.
Definition at line 323 of file mlStringConversion.h.
References mlrange_cast(), and T.
|
static |
Reads a 10D double vector value v
from string vecstr
whose values are space separated; it returns true
if all components have been converted, otherwise false
.
|
static |
Reads a 16D double vector value v
from string vecstr
whose values are space separated; it returns true
if all components have been converted, otherwise false
.
Reads a 2D double vector value v
from string vecstr
whose values are space separated; it returns true
if all components have been converted, otherwise false
.
Reads a 3D double vector value v
from string vecstr
whose values are space separated; it returns true
if all components have been converted, otherwise false
.
|
static |
Reads a 32D double vector value v
from string vecstr
whose values are space separated; it returns true
if all components have been converted, otherwise false
.
Reads a 4D double vector value v
from string vecstr
whose values are space separated; it returns true
if all components have been converted, otherwise false
.
Reads a 5D double vector value v
from string vecstr
whose values are space separated; it returns true
if all components have been converted, otherwise false
.
Reads a 6D double vector value v
from string vecstr
whose values are space separated; it returns true
if all components have been converted, otherwise false
.
|
static |
Reads a 64D double vector value v
from string vecstr
whose values are space separated; it returns true
if all components have been converted, otherwise false
.
Reads a 7D double vector value v
from string vecstr
whose values are space separated; it returns true
if all components have been converted, otherwise false
.
Reads a 8D double vector value v
from string vecstr
whose values are space separated; it returns true
if all components have been converted, otherwise false
.
Reads a 9D double vector value v
from string vecstr
whose values are space separated; it returns true
if all components have been converted, otherwise false
.
Reads a value from string arg
into val
; it returns true
if one value has been converted successfully, otherwise false
.
Reads a value from string arg
into val
; it returns true
if one value has been converted successfully, otherwise false
.
Reads a value from string arg
into val
; it returns true
if one value has been converted successfully, otherwise false
.
|
static |
Reads a value from string arg
into val
; it returns true
if one value has been converted successfully, otherwise false
.
|
static |
Reads a value from string arg
into val
; it returns true
if one value has been converted successfully, otherwise false
.
Converts char to a std::string.
Writes Base object to std::string.
Writes Base object to std::string.
|
static |
Converts a ImageVector to a std::string which can be parsed by readFromString().
Writes std::string object to std::string.
Will of course just return the provided string, but is required to support using writeToStdString in templates that may have strings as argument type (e.g. to use writeToStdString for a std::vector< std::string >)
|
inlinestatic |
Converts a std::vector value vec to a string where vector components will be separated by the string separatorString.
The type T must be supported by one of the writeToString methods implemented in class StringConversion; the return value needs to be removed with StringConversion::deleteString().
Definition at line 157 of file mlStringConversion.h.
References mlrange_cast().
Converts a Vector10 to a std::string which can be parsed by readFromString().
Converts a Vector16 to a std::string which can be parsed by readFromString().
Converts a Vector2 to a std::string which can be parsed by readFromString().
Converts a Vector3 to a std::string which can be parsed by readFromString().
Converts a Vector32 to a std::string which can be parsed by readFromString().
Converts a Vector4 to a std::string which can be parsed by readFromString().
Converts a Vector5 to a std::string which can be parsed by readFromString().
Converts a Vector6 to a std::string which can be parsed by readFromString().
Converts a Vector64 to a std::string which can be parsed by readFromString().
Converts a Vector7 to a std::string which can be parsed by readFromString().
Converts a Vector8 to a std::string which can be parsed by readFromString().
Converts a Vector9 to a std::string which can be parsed by readFromString().
Converts long to a std::string.
Converts a Matrix2 to a std::string which can be parsed by readFromString().
Converts a Matrix3 to a std::string which can be parsed by readFromString().
Converts a Matrix4 to a std::string which can be parsed by readFromString().
Converts a Matrix5 to a std::string which can be parsed by readFromString().
Converts a Matrix6 to a std::string which can be parsed by readFromString().
Converts double to a std::string.
Converts float to a std::string.
Converts an int32 to a std::string.
Converts an int64 to a std::string.
Converts long double to a std::string.
Converts uint32 to a std::string.
Converts uint64 to a std::string.
Converts short to a std::string.
|
static |
Converts a SubImageBox to a std::string which can be parsed by readFromString(SubImageBox&).
|
static |
Converts a SubImageBoxd to a std::string which can be parsed by readFromString(SubImageBoxd&).
Converts an unsigned char to a std::string.
Converts unsigned long to std::string.
Converts an unsigned short to a std::string.