H3D API  2.4.1
Classes | Namespaces | Functions
X3DFieldConversion.h File Reference

This file contains functions for convertion from a string to a value of an X3D field type. More...

#include <sstream>
#include <H3D/H3DApi.h>
#include <H3DUtil/Exception.h>
#include <H3D/H3DTypes.h>
#include <H3DUtil/PixelImage.h>
#include <typeinfo>
#include <locale>

Go to the source code of this file.

Classes

class  H3D::X3D::Convert::X3DFieldConversionError
 An exception for errors when string to convert to a field value is invalid for the field type. More...
 
class  H3D::X3D::Convert::UnimplementedConversionType
 An exception for errors when the conversion from a string to the type that we try convert to is not implemented. More...
 

Namespaces

 H3D
 H3D API namespace.
 
 H3D::X3D
 X3D namespace.
 
 H3D::X3D::Convert
 The Convert namespace contains help functions for parsing a string and converting it to a X3D field value.
 

Functions

const char * H3D::X3D::Convert::skipWhitespaces (const char *s)
 Skip whitespaces at the beginning of a string. More...
 
const char * H3D::X3D::Convert::skipWhitespacesAndCommas (const char *s)
 Skip whitespaces and commas at the beginning of a string. More...
 
string H3D::X3D::Convert::getQuoteEnclosedStringValue (const char *s, const char *&rest)
 Works the same way as getValue<string>() but with the exception that the string given is within double quotes. More...
 
template<class Type >
Type H3D::X3D::Convert::getValue (const char *s, const char *&rest)
 Function that reads characters from a char * and converts them to a given type. More...
 
template<>
string H3D::X3D::Convert::getValue< string > (const char *s, const char *&rest)
 Template specialization to handle the type 'string'. More...
 
template<>
bool H3D::X3D::Convert::getValue< bool > (const char *s, const char *&rest)
 Template specialization to handle the type 'bool'. More...
 
template<>
double H3D::X3D::Convert::getValue< double > (const char *s, const char *&rest)
 Template specialization to handle the type 'double'. More...
 
template<>
float H3D::X3D::Convert::getValue< float > (const char *s, const char *&rest)
 Template specialization to handle the type 'float'. More...
 
template<>
int H3D::X3D::Convert::getValue< int > (const char *s, const char *&rest)
 Template specialization to handle the type 'int'. More...
 
template<>
RGB H3D::X3D::Convert::getValue< RGB > (const char *s, const char *&rest)
 Template specialization to handle the type 'RGB'. More...
 
template<>
RGBA H3D::X3D::Convert::getValue< RGBA > (const char *s, const char *&rest)
 Template specialization to handle the type 'RGBA'. More...
 
template<>
Rotation H3D::X3D::Convert::getValue< Rotation > (const char *s, const char *&rest)
 Template specialization to handle the type 'Rotation'. More...
 
template<>
Quaternion H3D::X3D::Convert::getValue< Quaternion > (const char *s, const char *&rest)
 Template specialization to handle the type 'Quaternion'. More...
 
template<>
Matrix4f H3D::X3D::Convert::getValue< Matrix4f > (const char *s, const char *&rest)
 Template specialization to handle the type 'Matrix4f'. More...
 
template<>
Matrix3f H3D::X3D::Convert::getValue< Matrix3f > (const char *s, const char *&rest)
 Template specialization to handle the type 'Matrix3f'. More...
 
template<>
Matrix4d H3D::X3D::Convert::getValue< Matrix4d > (const char *s, const char *&rest)
 Template specialization to handle the type 'Matrix4d'. More...
 
template<>
Matrix3d H3D::X3D::Convert::getValue< Matrix3d > (const char *s, const char *&rest)
 Template specialization to handle the type 'Matrix3f'. More...
 
template<>
Vec4f H3D::X3D::Convert::getValue< Vec4f > (const char *s, const char *&rest)
 Template specialization to handle the type 'Vec4f'. More...
 
template<>
Vec4d H3D::X3D::Convert::getValue< Vec4d > (const char *s, const char *&rest)
 Template specialization to handle the type 'Vec4d'. More...
 
template<>
Vec3f H3D::X3D::Convert::getValue< Vec3f > (const char *s, const char *&rest)
 Template specialization to handle the type 'Vec3f'. More...
 
template<>
Vec3d H3D::X3D::Convert::getValue< Vec3d > (const char *s, const char *&rest)
 Template specialization to handle the type 'Vec3d'. More...
 
template<>
Vec2f H3D::X3D::Convert::getValue< Vec2f > (const char *s, const char *&rest)
 Template specialization to handle the type 'Vec2f'. More...
 
template<>
Vec2d H3D::X3D::Convert::getValue< Vec2d > (const char *s, const char *&rest)
 Template specialization to handle the type 'Vec2d'. More...
 
double H3D::X3D::Convert::atof (const char *s)
 The same as standard atof function with the difference that the decimal point is always . More...
 
template<class Type >
Type H3D::X3D::X3DStringToValue (const string &x3d_string)
 Convert a string to a specified type according to the X3D/XML field encoding. More...
 
template<class VectorType >
void H3D::X3D::X3DStringToVector (const string &x3d_string, VectorType &values)
 Convert a string to a vector of a specified type according to the X3D/XML field encoding. More...
 
template<>
void H3D::X3D::X3DStringToVector< vector< string > > (const string &x3d_string, vector< string > &values)
 Template specializaion for handling the case of MFString where the the values are specified as e.g. More...
 
PixelImageH3D::X3D::X3DStringTo2DImage (const string &x3d_string)
 Convert a string to a PixelImage according to the X3D/XML field encoding for SFImage. More...
 
PixelImageH3D::X3D::X3DStringTo3DImage (const string &x3d_string)
 Convert a string to a 3D PixelImage according to the X3D spec for Pixel3DTexture. More...
 

Detailed Description

This file contains functions for convertion from a string to a value of an X3D field type.