cwObject.cpp,cwObjectTemplate.h,main.cpp : Fixed cwObject bool parsing.
This commit is contained in:
parent
d065dcf344
commit
77c5026f14
@ -240,6 +240,7 @@ namespace cw
|
||||
object_t* o = mem::allocZ<object_t>();
|
||||
o->type = type;
|
||||
o->parent = parent;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,16 @@ namespace cw
|
||||
return obj;
|
||||
}
|
||||
|
||||
template<> object_t* _objSetLeafValue<bool>( object_t* obj, bool value )
|
||||
{
|
||||
if( obj != NULL )
|
||||
{
|
||||
obj->u.b = value;
|
||||
obj->type = _objIdToType(kBoolTId);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
template<> object_t* _objSetLeafValue< char*>( object_t* obj, char* value )
|
||||
{
|
||||
if( obj != NULL )
|
||||
@ -73,6 +83,8 @@ namespace cw
|
||||
template<> object_t* _objCreateValueNode< char*>( object_t* parent, char* value, const char* msg, unsigned flags )
|
||||
{ return _objAppendLeftMostNode( parent, _objSetLeafValue( _objAllocate(), value ) ); }
|
||||
|
||||
template<> object_t* _objCreateValueNode<bool>( object_t* parent, bool value, const char* msg, unsigned flags )
|
||||
{ return _objAppendLeftMostNode( parent, _objSetLeafValue( _objAllocate(), value ) ); }
|
||||
|
||||
template< typename T >
|
||||
rc_t getObjectValue( const T& src, unsigned tid, void* dst, const char* typeLabel )
|
||||
|
2
main.cpp
2
main.cpp
@ -113,7 +113,7 @@ void numbCvtTest( cw::object_t* cfg, int argc, const char* argv[] )
|
||||
void objectTest( cw::object_t* cfg, int argc, const char* argv[] )
|
||||
{
|
||||
cw::object_t* o;
|
||||
const char s [] = "{ a:1, b:2, c:[ 1.23, 4.56 ] }";
|
||||
const char s [] = "{ a:1, b:2, c:[ 1.23, 4.56 ], d:true, e:false, f:true }";
|
||||
cw::objectFromString(s,o);
|
||||
|
||||
int v;
|
||||
|
Loading…
Reference in New Issue
Block a user