瀏覽代碼

Added index operator overloading to TJSONArray.

woollybah 6 年之前
父節點
當前提交
011881cb25
共有 1 個文件被更改,包括 19 次插入1 次删除
  1. 19 1
      json.mod/json.bmx

+ 19 - 1
json.mod/json.bmx

@@ -25,11 +25,13 @@ bbdoc: A JSON encoder/decoder.
 End Rem
 Module BRL.Json
 
-ModuleInfo "Version: 1.03"
+ModuleInfo "Version: 1.04"
 ModuleInfo "Author: Bruce A Henderson"
 ModuleInfo "License: MIT"
 ModuleInfo "Copyright: 2014-2019 Bruce A Henderson"
 
+ModuleInfo "History: 1.04"
+ModuleInfo "History: Added index operator overloading to TJSONArray."
 ModuleInfo "History: 1.03"
 ModuleInfo "History: Updated to Jansson 2.12"
 ModuleInfo "History: 1.02"
@@ -230,6 +232,22 @@ Type TJSONArray Extends TJSON
 		Return enumeration
 	End Method
 
+	Rem
+	bbdoc: Returns the element in array at position index.
+	about: The valid range for index is from 0 to the return value of Size() minus 1. If index is out of range, NULL is returned.
+	End Rem
+	Method Operator [] :TJSON(index:Int)
+		Return Get(index)
+	End Method
+
+	Rem
+	bbdoc: Replaces the element in array at position index with value.
+	returns: 0 on success and -1 on error.
+	End Rem
+	Method Operator []= (index:Int, value:TJSON)
+		Set(index, value)
+	End Method
+
 End Type
 
 Type TJSONArrayEnum