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
10
cwObject.cpp
10
cwObject.cpp
@ -869,11 +869,17 @@ cw::rc_t cw::objectFromString( const char* s, object_t*& objRef )
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
case lex::kIntLexTId:
|
||||
_objCreateValueNode( cnp, lex::tokenInt(lexH), "int" );
|
||||
if( tokenIsUnsigned(lexH) )
|
||||
_objCreateValueNode( cnp, lex::tokenUInt(lexH), "uint" );
|
||||
else
|
||||
_objCreateValueNode( cnp, lex::tokenInt(lexH), "int" );
|
||||
break;
|
||||
|
||||
case lex::kHexLexTId:
|
||||
|
@ -74,6 +74,12 @@ namespace cw
|
||||
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 )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user