29#ifndef SN_XML_STRING_TO_TYPE_H
30#define SN_XML_STRING_TO_TYPE_H
32#include "common/PxCoreUtilityTypes.h"
33#include "PxFiltering.h"
35#include "foundation/PxString.h"
42#define _strtoui64 strtoull
46namespace physx {
namespace Sn {
48 template<
typename TDataType>
58 PX_INLINE void strto( PxU64& ioDatatype,
const char*& ioData )
60 ioDatatype = _strtoui64( ioData,
const_cast<char **
>(&ioData), 10 );
64 PX_INLINE PxF32 strToFloat(
const char *str,
const char **nextScan)
67 while ( *str && isspace(
static_cast<unsigned char>(*str))) str++;
70 char *end = &temp[255];
71 const char *begin = str;
72 while ( *str && !isspace(
static_cast<unsigned char>(*str)) && dest < end )
77 ret = PxF32(strtod(temp,&end));
80 *nextScan = begin+(end-temp);
87 PX_INLINE void strto( PxU32& ioDatatype,
const char*& ioData )
89 ioDatatype =
static_cast<PxU32
>( strtoul( ioData,
const_cast<char **
>(&ioData), 10 ) );
94 PX_INLINE void strto( PxI32& ioDatatype,
const char*& ioData )
96 ioDatatype =
static_cast<PxI32
>( strtoul( ioData,
const_cast<char **
>(&ioData), 10 ) );
102 PX_INLINE void strto( PxU16& ioDatatype,
const char*& ioData )
104 ioDatatype =
static_cast<PxU16
>( strtoul( ioData,
const_cast<char **
>(&ioData), 10 ) );
108 PX_INLINE void eatwhite(
const char*& ioData )
112 while( isspace(
static_cast<unsigned char>(*ioData) ) )
120 PX_INLINE void nullTerminateWhite(
const char*& ioData,
char *buffer,PxU32 bufferLen)
124 char *eof = buffer+(bufferLen-1);
126 while( *ioData && !isspace(
static_cast<unsigned char>(*ioData)) && dest < eof )
134 inline void nonNullTerminateWhite(
const char*& ioData )
138 while( *ioData && !isspace(
static_cast<unsigned char>(*ioData) ) )
144 inline void strto( PxF32& ioDatatype,
const char*& ioData )
146 ioDatatype = strToFloat(ioData,&ioData);
153 inline void strto(
void*& ioDatatype,
const char*& ioData )
157 ioDatatype =
reinterpret_cast<void*
>( size_t( theData ) );
163 inline void strto(
physx::PxVec3& ioDatatype,
const char*& ioData )
172 inline void strto( PxU8*& ,
const char*& )
178 inline void strto(
bool& ioType,
const char*& inValue )
180 ioType = physx::Pxstricmp( inValue,
"true" ) == 0 ? true :
false;
185 PX_INLINE void strto( PxU8& ioType,
const char* & inValue)
187 ioType =
static_cast<PxU8
>( strtoul( inValue,
const_cast<char **
>(&inValue), 10 ) );
194 ioType.word0 =
static_cast<PxU32
>( strtoul( inValue,
const_cast<char **
>(&inValue), 10 ) );
195 ioType.word1 =
static_cast<PxU32
>( strtoul( inValue,
const_cast<char **
>(&inValue), 10 ) );
196 ioType.word2 =
static_cast<PxU32
>( strtoul( inValue,
const_cast<char **
>(&inValue), 10 ) );
197 ioType.word3 =
static_cast<PxU32
>( strtoul( inValue, NULL, 10 ) );
205 ioType.
x =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
206 ioType.y =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
207 ioType.z =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
208 ioType.w =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
215 ioType.q.
x =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
216 ioType.q.y =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
217 ioType.q.z =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
218 ioType.q.w =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
220 ioType.p[0] =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
221 ioType.p[1] =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
222 ioType.p[2] =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
229 ioType.minimum[0] =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
230 ioType.minimum[1] =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
231 ioType.minimum[2] =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
233 ioType.maximum[0] =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
234 ioType.maximum[1] =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
235 ioType.maximum[2] =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
242 ioType.normal.x =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
243 ioType.normal.y =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
244 ioType.normal.z =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
245 ioType.distance =
static_cast<PxReal
>( strToFloat( inValue, &inValue ) );
256 template<
typename TDataType>
257 inline void strto( TDataType& ioType,
const char*& ioData )
262 template<
typename TDataType>
263 inline void strtoLong( TDataType& ioType,
const char*& ioData )
268 template<
typename TDataType>
269 inline void stringToType(
const char* inValue, TDataType& ioType )
271 const char* theValue( inValue );
272 return strto( ioType, theValue );
Class representing 3D range or axis aligned bounding box.
Definition PxBounds3.h:58
This is a quaternion class. For more information on quaternion mathematics consult a mathematics sour...
Definition PxQuat.h:50
float x
Definition PxQuat.h:395
PxRigidDynamic represents a dynamic rigid simulation object in the physics SDK.
Definition PxRigidDynamic.h:82
3 Element vector class.
Definition PxVec3.h:50
#define PX_INLINE
Definition PxPreprocessor.h:320
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PxFilterData is user-definable data which gets passed into the collision filtering shader and/or call...
Definition PxFiltering.h:365
Definition SnXmlStringToType.h:50