cwObject.h/cpp : cwObject now detects and properly encodes floats and unsigned integers that are specified with the 'f' and 'u' suffix.
This commit is contained in:
parent
e42dd71b09
commit
a7a38fa9f4
@ -869,10 +869,16 @@ cw::rc_t cw::objectFromString( const char* s, object_t*& objRef )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case lex::kRealLexTId:
|
case lex::kRealLexTId:
|
||||||
_objCreateValueNode( cnp, lex::tokenDouble(lexH), "real" );
|
if( tokenIsSinglePrecision(lexH) )
|
||||||
|
_objCreateValueNode( cnp, lex::tokenFloat(lexH),"float" );
|
||||||
|
else
|
||||||
|
_objCreateValueNode( cnp, lex::tokenDouble(lexH), "double" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lex::kIntLexTId:
|
case lex::kIntLexTId:
|
||||||
|
if( tokenIsUnsigned(lexH) )
|
||||||
|
_objCreateValueNode( cnp, lex::tokenUInt(lexH), "uint" );
|
||||||
|
else
|
||||||
_objCreateValueNode( cnp, lex::tokenInt(lexH), "int" );
|
_objCreateValueNode( cnp, lex::tokenInt(lexH), "int" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -74,6 +74,12 @@ namespace cw
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<> object_t* _objSetLeafValue<float>( object_t* obj, float value )
|
||||||
|
{
|
||||||
|
obj->u.f = value;
|
||||||
|
obj->type = _objIdToType(kFloatTId);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
template<> object_t* _objSetLeafValue<double>( object_t* obj, double value )
|
template<> object_t* _objSetLeafValue<double>( object_t* obj, double value )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user