13#ifndef ML_STRING_CONVERSION_H
14#define ML_STRING_CONVERSION_H
156 template <
typename T>
157 static std::string
writeToStdString(
const std::vector<T>& vec,
const std::string &separatorString)
160 for (
size_t k = 0; k < vec.size(); k++){
161 if (k){ retVal += separatorString; }
322 template <
typename T>
325 const std::string& separatorString)
329 size_t startPos = 0, endPos = 0;
330 size_t sepLen = separatorString.size();
336 endPos = vecstr.find(separatorString, startPos);
337 if (endPos == std::string::npos) {
338 endPos = vecstr.size();
343 retVal =
readFromString(vecstr.substr(startPos, endPos - startPos), item);
349 startPos = endPos + sepLen;
372 static void instantiateTemplateFctDummy(
void);
The class StringConversion provides static methods to convert ML objects to and from strings.
static bool readFromString(const std::string &vecstr, Vector9 &v)
static std::string writeToStdString(const ImageVector &val)
Converts a ImageVector to a std::string that can be parsed by readFromString().
static std::string writeToStdString(MLint32 val)
Converts an int32 to a std::string.
static std::string writeToStdString(const std::vector< T > &vec, const std::string &separatorString)
static std::string writeToStdString(const Vector9 &val)
Converts a Vector9 to a std::string that can be parsed by readFromString().
static bool readFromString(const std::string &vecstr, Vector16 &v)
static std::string writeToStdString(char val)
Converts a char to a std::string.
static std::string writeToStdString(const Vector2 &val)
Converts a Vector2 to a std::string that can be parsed by readFromString().
static bool readFromString(const std::string &vecstr, Vector5 &v)
static bool readFromString(const std::string &str, Matrix5 &val)
static std::string writeToStdString(MLuint64 val)
Converts an uint64 to a std::string.
static bool readFromString(const std::string &vecstr, std::vector< T > &vec, const std::string &separatorString)
static std::string writeToStdString(MLdouble val)
Converts a double to a std::string.
static MLint getFirstNonSpacePos(const std::string &str, MLint pos=0)
Helper method returning the first non-space position starting from pos.
static std::string writeToStdString(const Vector10 &val)
Converts a Vector10 to a std::string that can be parsed by readFromString().
static bool readFromString(const std::string &str, Matrix4 &val)
static std::string writeToStdString(Matrix3 const &mat)
Converts a Matrix3 to a std::string that can be parsed by readFromString().
static std::string writeToStdString(MLldouble val)
Converts a long double to a std::string.
static bool readFromString(const std::string &arg, MLuint64 &val)
static std::string writeToStdString(const Vector7 &val)
Converts a Vector7 to a std::string that can be parsed by readFromString().
static bool readFromString(std::string const &arg, double &val)
static std::string writeToStdString(const Vector32 &val)
Converts a Vector32 to a std::string that can be parsed by readFromString().
static std::string writeToStdString(const std::string &str)
static char * newString(const std::string &str)
static bool readFromString(const std::string &arg, MLuint32 &val)
static bool readFromString(const std::string &arg, short &val)
static bool readFromString(const std::string &source, std::string &target)
static std::string writeToStdString(unsigned short val)
Converts an unsigned short to a std::string.
static bool readFromString(const std::string &vecstr, Vector3 &v)
static bool readFromString(std::string const &arg, float &val)
static bool readFromString(const std::string &arg, MLint32 &val)
static std::string writeToStdString(MLuint32 val)
Converts an uint32 to a std::string.
static bool readFromString(const std::string &vecstr, Vector6 &v)
static bool readFromString(const std::string &str, Matrix6 &val)
static std::string writeToStdString(MLint64 val)
Converts an int64 to a std::string.
static std::string writeToStdString(const Vector16 &val)
Converts a Vector16 to a std::string that can be parsed by readFromString().
static bool readFromString(const std::string &arg, SubImageBox &val)
static bool readFromString(const std::string &vecstr, ImageVector &v)
static bool readFromString(const std::string &vecstr, Vector10 &v)
static std::string writeToStdString(const Vector6 &val)
Converts a Vector6 to a std::string that can be parsed by readFromString().
static bool readFromString(const std::string &source, Base &obj)
static bool readFromString(const std::string &str, Matrix2 &val)
static std::string writeToStdString(const Base &obj)
Writes a Base object to std::string.
static bool readFromString(const std::string &arg, MLint64 &val)
static std::string writeToStdString(Matrix4 const &mat)
Converts a Matrix4 to a std::string that can be parsed by readFromString().
static std::string writeToStdString(unsigned char val)
Converts an unsigned char to a std::string.
static bool readFromString(const std::string &vecstr, Vector8 &v)
static std::string writeToStdString(const Base *const obj)
Writes a Base object to std::string.
static std::string writeToStdString(MLfloat val)
Converts a float to a std::string.
static std::string writeToStdString(Matrix5 const &mat)
Converts a Matrix5 to a std::string that can be parsed by readFromString().
static std::string writeToStdString(Matrix6 const &mat)
Converts a Matrix6 to a std::string that can be parsed by readFromString().
static bool readFromString(std::string const &arg, long &val)
static bool readFromString(const std::string &str, Matrix3 &val)
static std::string writeToStdString(SubImageBoxd const &box)
Converts a SubImageBoxd to a std::string that can be parsed by readFromString(SubImageBoxd&).
static std::string writeToStdString(const Vector64 &val)
Converts a Vector64 to a std::string that can be parsed by readFromString().
static bool readFromString(const std::string &vecstr, Vector32 &v)
static bool readFromString(const std::string &arg, unsigned char &val)
static bool readFromString(const std::string &arg, char &val)
static std::string writeToStdString(const Vector5 &val)
Converts a Vector5 to a std::string that can be parsed by readFromString().
static std::string writeToStdString(const Vector8 &val)
Converts a Vector8 to a std::string that can be parsed by readFromString().
static bool readFromString(const std::string &arg, unsigned short &val)
static bool readFromString(const std::string &vecstr, Vector2 &v)
static bool readFromString(const std::string &arg, SubImageBoxd &val)
static bool readFromString(const std::string &vecstr, Vector4 &v)
static void deleteString(char *str)
Disposes a string created by newString(); NULL values as str are legal and will be ignored.
static bool readFromString(const std::string &vecstr, Vector64 &v)
static bool readFromString(const std::string &vecstr, Vector7 &v)
static std::string writeToStdString(Matrix2 const &mat)
Converts a Matrix2 to a std::string that can be parsed by readFromString().
static std::string writeToStdString(unsigned long val)
Converts an unsigned long to std::string.
static std::string writeToStdString(long val)
Converts a long to a std::string.
static std::string writeToStdString(const Vector4 &val)
Converts a Vector4 to a std::string that can be parsed by readFromString().
static std::string writeToStdString(SubImageBox const &box)
Converts a SubImageBox to a std::string that can be parsed by readFromString(SubImageBox&).
static std::string writeToStdString(const Vector3 &val)
Converts a Vector3 to a std::string that can be parsed by readFromString().
static bool readFromString(std::string const &arg, unsigned long &val)
static bool readFromString(std::string const &arg, long double &val)
static std::string writeToStdString(short val)
Converts a short to a std::string.
#define MLEXPORT
Code it as import symbol if compiled elsewhere.
UINT64 MLuint64
Introduce platform-independent 64-bit unsigned integer type.
INT64 MLint64
Include 64-bit integer support for Windows or Unix.
Tvec5< MLdouble > Vector5
A vector with five components of type double.
Tvec10< MLdouble > Vector10
A vector with ten components of type double.
Tvec32< MLdouble > Vector32
A vector with 32 components of type double.
Tvec7< MLdouble > Vector7
A vector with seven components of type double.
Tvec16< MLdouble > Vector16
A vector with 16 components of type double.
Tvec4< MLdouble > Vector4
A vector with four components of type double.
Tvec9< MLdouble > Vector9
A vector with nine components of type double.
Tmat4< MLdouble > Matrix4
The standard 4x4 matrix of type double.
Tvec3< MLdouble > Vector3
A vector with three components of type double.
Tvec64< MLdouble > Vector64
A vector with 64 components of type double.
Tmat2< MLdouble > Matrix2
The standard 2x2 matrix of type double.
Tvec6< MLdouble > Vector6
A vector with six components of type double.
Tvec2< MLdouble > Vector2
A vector with two components of type double.
Tmat3< MLdouble > Matrix3
The standard 3x3 matrix of type double.
TSubImageBox< MLint > SubImageBox
Defines the standard SubImageBox type used in the ML. Its size varies with the size of the MLint type...
TImageVector< MLint > ImageVector
Defines the standard ImageVector type that is used by the ML for indexing and coordinates.
Tmat5< MLdouble > Matrix5
The standard 5x5 matrix of type double.
Tmat6< MLdouble > Matrix6
The standard 6x6 matrix of type double.
Tvec8< MLdouble > Vector8
A vector with eight components of type double.