Преглед на файлове

cmJson.h/c : Added cmJsonMemberAtIndex().

master
kevin преди 7 години
родител
ревизия
6331cb1753
променени са 2 файла, в които са добавени 12 реда и са изтрити 1 реда
  1. 8
    0
      cmJson.c
  2. 4
    1
      cmJson.h

+ 8
- 0
cmJson.c Целия файл

1456
   return rc;
1456
   return rc;
1457
 }
1457
 }
1458
 
1458
 
1459
+cmJsonNode_t* cmJsonMemberAtIndex( cmJsonNode_t* objNodePtr, unsigned idx )
1460
+{
1461
+  cmJsonNode_t* cnp = cmJsonArrayElement( objNodePtr, idx );
1462
+  assert( cmJsonIsPair(cnp) );
1463
+  return cnp;
1464
+}  
1465
+
1466
+
1459
 cmJsRC_t      cmJsonUIntMember(    const cmJsonNode_t* np, const char* label, unsigned* retPtr )
1467
 cmJsRC_t      cmJsonUIntMember(    const cmJsonNode_t* np, const char* label, unsigned* retPtr )
1460
 { 
1468
 { 
1461
   cmJsonNode_t* vp;
1469
   cmJsonNode_t* vp;

+ 4
- 1
cmJson.h Целия файл

197
   
197
   
198
   // Return the type of a member value.
198
   // Return the type of a member value.
199
   cmJsRC_t     cmJsonMemberType( const cmJsonNode_t* objectNodePtr, const char* label, unsigned* typeIdRef );
199
   cmJsRC_t     cmJsonMemberType( const cmJsonNode_t* objectNodePtr, const char* label, unsigned* typeIdRef );
200
-  
200
+
201
+  // Return the pair at the specified index.  Use cmJsonChildCount() to get the count of pairs in the object.
202
+  cmJsonNode_t* cmJsonMemberAtIndex( cmJsonNode_t* objNodePtr, unsigned idx );
203
+
201
   // Return values associated with the member values in the object
204
   // Return values associated with the member values in the object
202
   // pointed to by object objectNodePtr.
205
   // pointed to by object objectNodePtr.
203
   cmJsRC_t      cmJsonUIntMember(   const cmJsonNode_t* objectNodePtr, const char* label, unsigned* retPtr );
206
   cmJsRC_t      cmJsonUIntMember(   const cmJsonNode_t* objectNodePtr, const char* label, unsigned* retPtr );

Loading…
Отказ
Запис