Merge branch 'master' of https://github.com/eiffelhub/json
This commit is contained in:
@@ -22,6 +22,8 @@ class
|
|||||||
inherit
|
inherit
|
||||||
JSON_VALUE
|
JSON_VALUE
|
||||||
|
|
||||||
|
TABLE_ITERABLE [JSON_VALUE, JSON_STRING]
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
@@ -41,7 +43,7 @@ feature -- Change Element
|
|||||||
require
|
require
|
||||||
key_not_present: not has_key (key)
|
key_not_present: not has_key (key)
|
||||||
local
|
local
|
||||||
l_value: detachable JSON_VALUE
|
l_value: like value
|
||||||
do
|
do
|
||||||
l_value := value
|
l_value := value
|
||||||
if l_value = Void then
|
if l_value = Void then
|
||||||
@@ -50,6 +52,19 @@ feature -- Change Element
|
|||||||
object.extend (l_value, key)
|
object.extend (l_value, key)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
replace (value: detachable JSON_VALUE; key: JSON_STRING)
|
||||||
|
-- Assuming there is no item of key `key',
|
||||||
|
-- insert `value' with `key'.
|
||||||
|
local
|
||||||
|
l_value: like value
|
||||||
|
do
|
||||||
|
l_value := value
|
||||||
|
if l_value = Void then
|
||||||
|
create {JSON_NULL} l_value
|
||||||
|
end
|
||||||
|
object.force (l_value, key)
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
has_key (key: JSON_STRING): BOOLEAN
|
has_key (key: JSON_STRING): BOOLEAN
|
||||||
@@ -98,6 +113,22 @@ feature -- Access
|
|||||||
Result.append_character ('}')
|
Result.append_character ('}')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature -- Mesurement
|
||||||
|
|
||||||
|
count: INTEGER
|
||||||
|
-- Number of field
|
||||||
|
do
|
||||||
|
Result := object.count
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
new_cursor: TABLE_ITERATION_CURSOR [JSON_VALUE, JSON_STRING]
|
||||||
|
-- Fresh cursor associated with current structure
|
||||||
|
do
|
||||||
|
Result := object.new_cursor
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Status report
|
feature -- Status report
|
||||||
|
|
||||||
is_empty: BOOLEAN
|
is_empty: BOOLEAN
|
||||||
|
|||||||
Reference in New Issue
Block a user