Update JSON_VALUE and JSON_OBJECT interface

This commit is contained in:
jvelilla
2008-05-25 18:23:25 +00:00
parent 8f3c7beba8
commit 8357bf5d72
7 changed files with 132 additions and 7 deletions

View File

@@ -28,6 +28,25 @@ feature -- Initialization
end
feature -- Access
i_th alias "[]", infix "@" (i: INTEGER):JSON_VALUE is
-- Item at `i'-th position
do
Result := values.i_th (i)
end
feature -- Mesurement
count:INTEGER is
--
do
Result:=values.count
end
feature -- Status report
valid_index (i: INTEGER): BOOLEAN is
-- Is `i' a valid index?
do
Result := (1 <= i) and (i <= count)
end
feature -- Change Element
add(value:JSON_VALUE) is
@@ -41,7 +60,7 @@ feature -- Change Element
has_new_value:old values.count + 1 = values.count
end
feature -- Report
to_json:STRING is
--Printable json representation
-- [] or [elements]
@@ -65,7 +84,7 @@ feature -- Change Element
Result.append("]")
end
hash_code:INTEGER is
hash_code:INTEGER is
--
do
from
@@ -78,7 +97,7 @@ feature -- Change Element
values.forth
end
Result := Result \\ values.count
end
feature {NONE} --Implementation
values:ARRAYED_LIST[JSON_VALUE]