cmJson.h/c : Added cmJsonMemberAtIndex().

This commit is contained in:
kevin 2016-07-13 16:42:03 -04:00
parent a607108e48
commit 6331cb1753
2 changed files with 12 additions and 1 deletions

View File

@ -1456,6 +1456,14 @@ cmJsRC_t cmJsonMemberType( const cmJsonNode_t* np, const char* label, unsig
return rc; return rc;
} }
cmJsonNode_t* cmJsonMemberAtIndex( cmJsonNode_t* objNodePtr, unsigned idx )
{
cmJsonNode_t* cnp = cmJsonArrayElement( objNodePtr, idx );
assert( cmJsonIsPair(cnp) );
return cnp;
}
cmJsRC_t cmJsonUIntMember( const cmJsonNode_t* np, const char* label, unsigned* retPtr ) cmJsRC_t cmJsonUIntMember( const cmJsonNode_t* np, const char* label, unsigned* retPtr )
{ {
cmJsonNode_t* vp; cmJsonNode_t* vp;

View File

@ -197,7 +197,10 @@ extern "C" {
// Return the type of a member value. // Return the type of a member value.
cmJsRC_t cmJsonMemberType( const cmJsonNode_t* objectNodePtr, const char* label, unsigned* typeIdRef ); cmJsRC_t cmJsonMemberType( const cmJsonNode_t* objectNodePtr, const char* label, unsigned* typeIdRef );
// Return the pair at the specified index. Use cmJsonChildCount() to get the count of pairs in the object.
cmJsonNode_t* cmJsonMemberAtIndex( cmJsonNode_t* objNodePtr, unsigned idx );
// Return values associated with the member values in the object // Return values associated with the member values in the object
// pointed to by object objectNodePtr. // pointed to by object objectNodePtr.
cmJsRC_t cmJsonUIntMember( const cmJsonNode_t* objectNodePtr, const char* label, unsigned* retPtr ); cmJsRC_t cmJsonUIntMember( const cmJsonNode_t* objectNodePtr, const char* label, unsigned* retPtr );