Allow detached values

This commit is contained in:
YNH Webdev
2014-01-01 23:48:56 +01:00
parent d9c837918b
commit 05d4f24f6f

View File

@@ -16,114 +16,133 @@ create
feature
put_string (value: READABLE_STRING_GENERAL; key: JSON_STRING)
put_string (value: detachable READABLE_STRING_GENERAL; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
require
key_not_present: not has_key (key)
local
l_value: JSON_STRING
l_value: detachable JSON_STRING
do
create l_value.make_json_from_string_32 (value.as_string_32)
if attached value as a_value then
create l_value.make_json_from_string_32 (a_value.as_string_32)
end
put (l_value, key)
end
put_integer (value: INTEGER_64; key: JSON_STRING)
put_integer (value: detachable INTEGER_64; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
require
key_not_present: not has_key (key)
local
l_value: JSON_NUMBER
l_value: detachable JSON_NUMBER
do
create l_value.make_integer (value)
if attached value as a_value then
create l_value.make_integer (a_value)
end
put (l_value, key)
end
put_natural (value: NATURAL_64; key: JSON_STRING)
put_natural (value: detachable NATURAL_64; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
require
key_not_present: not has_key (key)
local
l_value: JSON_NUMBER
l_value: detachable JSON_NUMBER
do
create l_value.make_natural (value)
if attached value as a_value then
create l_value.make_natural (a_value)
end
put (l_value, key)
end
put_real (value: DOUBLE; key: JSON_STRING)
put_real (value: detachable DOUBLE; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
require
key_not_present: not has_key (key)
local
l_value: JSON_NUMBER
l_value: detachable JSON_NUMBER
do
create l_value.make_real (value)
if attached value as a_value then
create l_value.make_real (a_value)
end
put (l_value, key)
end
put_boolean (value: BOOLEAN; key: JSON_STRING)
put_boolean (value: detachable BOOLEAN; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
require
key_not_present: not has_key (key)
local
l_value: JSON_BOOLEAN
l_value: detachable JSON_BOOLEAN
do
create l_value.make_boolean (value)
if attached value as a_value then
create l_value.make_boolean (a_value)
end
put (l_value, key)
end
replace_with_string (value: READABLE_STRING_GENERAL; key: JSON_STRING)
replace_with_string (value: detachable READABLE_STRING_GENERAL; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
local
l_value: JSON_STRING
l_value: detachable JSON_STRING
do
create l_value.make_json_from_string_32 (value.as_string_32)
if attached value as a_value then
create l_value.make_json_from_string_32 (value.as_string_32)
end
replace (l_value, key)
end
replace_with_integer (value: INTEGER_64; key: JSON_STRING)
replace_with_integer (value: detachable INTEGER_64; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
local
l_value: JSON_NUMBER
l_value: detachable JSON_NUMBER
do
create l_value.make_integer (value)
if attached value as a_value then
create l_value.make_integer (a_value)
end
replace (l_value, key)
end
replace_with_with_natural (value: NATURAL_64; key: JSON_STRING)
replace_with_with_natural (value: detachable NATURAL_64; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
local
l_value: JSON_NUMBER
l_value: detachable JSON_NUMBER
do
create l_value.make_natural (value)
if attached value as a_value then
create l_value.make_natural (a_value)
end
replace (l_value, key)
end
replace_with_real (value: DOUBLE; key: JSON_STRING)
replace_with_real (value: detachable DOUBLE; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
-- insert `value' with `key'
local
l_value: JSON_NUMBER
l_value: detachable JSON_NUMBER
do
create l_value.make_real (value)
if attached value as a_value then
create l_value.make_real (a_value)
end
replace (l_value, key)
end
replace_with_boolean (value: BOOLEAN; key: JSON_STRING)
replace_with_boolean (value: detachable BOOLEAN; key: JSON_STRING)
-- Assuming there is no item of key `key',
-- insert `value' with `key'.
local
l_value: JSON_BOOLEAN
l_value: detachable JSON_BOOLEAN
do
create l_value.make_boolean (value)
if attached value as a_value then
create l_value.make_boolean (a_value)
end
replace (l_value, key)
end