H3D::X3D::Convert Namespace Reference

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


Functions

 H3D_VALUE_EXCEPTION (const string, X3DFieldConversionError)
 H3D_VALUE_EXCEPTION (const string, UnimplementedConversionType)
const char * skipWhitespaces (const char *s)
 Skip whitespaces at the beginning of a string.
const char * skipWhitespacesAndCommas (const char *s)
 Skip whitespaces and commas at the beginning of a string.
string 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.
template<class Type>
Type getValue (const char *s, const char *&rest)
 Function that reads characters from a char * and converts them to a given type.
template<>
string getValue< string > (const char *s, const char *&rest)
 Template specialization to handle the type 'string'.
template<>
bool getValue< bool > (const char *s, const char *&rest)
 Template specialization to handle the type 'bool'.
template<>
double getValue< double > (const char *s, const char *&rest)
 Template specialization to handle the type 'double'.
template<>
float getValue< float > (const char *s, const char *&rest)
 Template specialization to handle the type 'float'.
template<>
int getValue< int > (const char *s, const char *&rest)
 Template specialization to handle the type 'int'.
template<>
RGB getValue< RGB > (const char *s, const char *&rest)
 Template specialization to handle the type 'RGB'.
template<>
RGBA getValue< RGBA > (const char *s, const char *&rest)
 Template specialization to handle the type 'RGBA'.
template<>
Rotation getValue< Rotation > (const char *s, const char *&rest)
 Template specialization to handle the type 'Rotation'.
template<>
Quaternion getValue< Quaternion > (const char *s, const char *&rest)
 Template specialization to handle the type 'Quaternion'.
template<>
Matrix4f getValue< Matrix4f > (const char *s, const char *&rest)
 Template specialization to handle the type 'Matrix4f'.
template<>
Matrix3f getValue< Matrix3f > (const char *s, const char *&rest)
 Template specialization to handle the type 'Matrix3f'.
template<>
Matrix4d getValue< Matrix4d > (const char *s, const char *&rest)
 Template specialization to handle the type 'Matrix4d'.
template<>
Matrix3d getValue< Matrix3d > (const char *s, const char *&rest)
 Template specialization to handle the type 'Matrix3f'.
template<>
Vec4f getValue< Vec4f > (const char *s, const char *&rest)
 Template specialization to handle the type 'Vec4f'.
template<>
Vec4d getValue< Vec4d > (const char *s, const char *&rest)
 Template specialization to handle the type 'Vec4d'.
template<>
Vec3f getValue< Vec3f > (const char *s, const char *&rest)
 Template specialization to handle the type 'Vec3f'.
template<>
Vec3d getValue< Vec3d > (const char *s, const char *&rest)
 Template specialization to handle the type 'Vec3d'.
template<>
Vec2f getValue< Vec2f > (const char *s, const char *&rest)
 Template specialization to handle the type 'Vec2f'.
template<>
Vec2d getValue< Vec2d > (const char *s, const char *&rest)
 Template specialization to handle the type 'Vec2d'.
unsigned char * readImageData (const char *s, int width, int height, int depth, int nr_components)


Detailed Description

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

Function Documentation

string H3D::X3D::Convert::getQuoteEnclosedStringValue const char *  s,
const char *&  rest
[inline]
 

Works the same way as getValue<string>() but with the exception that the string given is within double quotes.

The resulting value will be the string inside the quotes.

template<class Type>
Type H3D::X3D::Convert::getValue const char *  s,
const char *&  rest
[inline]
 

Function that reads characters from a char * and converts them to a given type.

It will use as many characters from the char * as possible to build the value. Used by H3D::X3D::X3DStringToVector and H3D::X3D::X3DStringToValue to read values. The default implementation just returns an exception. Each type that is supported must have a template specialization handling it.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
bool H3D::X3D::Convert::getValue< bool > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'bool'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
double H3D::X3D::Convert::getValue< double > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'double'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
float H3D::X3D::Convert::getValue< float > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'float'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
int H3D::X3D::Convert::getValue< int > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'int'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
Matrix3d H3D::X3D::Convert::getValue< Matrix3d > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'Matrix3f'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
Matrix3f H3D::X3D::Convert::getValue< Matrix3f > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'Matrix3f'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
Matrix4d H3D::X3D::Convert::getValue< Matrix4d > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'Matrix4d'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
Matrix4f H3D::X3D::Convert::getValue< Matrix4f > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'Matrix4f'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
Quaternion H3D::X3D::Convert::getValue< Quaternion > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'Quaternion'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
RGB H3D::X3D::Convert::getValue< RGB > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'RGB'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
RGBA H3D::X3D::Convert::getValue< RGBA > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'RGBA'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
Rotation H3D::X3D::Convert::getValue< Rotation > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'Rotation'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
string H3D::X3D::Convert::getValue< string > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'string'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
Vec2d H3D::X3D::Convert::getValue< Vec2d > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'Vec2d'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
Vec2f H3D::X3D::Convert::getValue< Vec2f > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'Vec2f'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
Vec3d H3D::X3D::Convert::getValue< Vec3d > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'Vec3d'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
Vec3f H3D::X3D::Convert::getValue< Vec3f > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'Vec3f'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
Vec4d H3D::X3D::Convert::getValue< Vec4d > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'Vec4d'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

template<>
Vec4f H3D::X3D::Convert::getValue< Vec4f > const char *  s,
const char *&  rest
[inline]
 

Template specialization to handle the type 'Vec4f'.

Parameters:
s The string to convert.
rest Return value pointing at the first character in the string not used in the conversion.

const char* H3D::X3D::Convert::skipWhitespaces const char *  s  )  [inline]
 

Skip whitespaces at the beginning of a string.

Parameters:
s The string to skip whitespace in
Returns:
A pointer to the first character in the string that is not a whitespace

const char* H3D::X3D::Convert::skipWhitespacesAndCommas const char *  s  )  [inline]
 

Skip whitespaces and commas at the beginning of a string.

Parameters:
s The string to skip whitespace in
Returns:
A pointer to the first character in the string that is not a whitespace


Generated on Thu Aug 24 12:40:35 2006 for H3D API by  doxygen 1.4.5