Update JSON_OBJECT, put routine, now follows Eiffel Style based on HAST_TABLE
This commit is contained in:
@@ -1,23 +1,20 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-3-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-3-0 http://www.eiffel.com/developers/xml/configuration-1-3-0.xsd" name="json" uuid="4E21C3BD-7951-4C6E-A673-431E762D7414" library_target="json">
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-3-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-3-0 http://www.eiffel.com/developers/xml/configuration-1-3-0.xsd" name="json" uuid="4E21C3BD-7951-4C6E-A673-431E762D7414" library_target="json">
|
||||||
<target name="json">
|
<target name="json">
|
||||||
<root all_classes="true"/>
|
<root all_classes="true"/>
|
||||||
<option namespace="EJSON.Library">
|
<option namespace="EJSON.Library">
|
||||||
</option>
|
</option>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||||
<cluster name="json" location=".\" recursive="true">
|
<cluster name="json" location=".\" recursive="true">
|
||||||
<file_rule>
|
<file_rule>
|
||||||
<exclude>/EIFGENs$</exclude>
|
<exclude>/EIFGENs$</exclude>
|
||||||
<exclude>/.svn$</exclude>
|
<exclude>/.svn$</exclude>
|
||||||
<exclude>/CVS$</exclude>
|
<exclude>/CVS$</exclude>
|
||||||
</file_rule>
|
</file_rule>
|
||||||
<file_rule>
|
<file_rule>
|
||||||
<exclude>^/scanner$</exclude>
|
<exclude>^/scanner$</exclude>
|
||||||
</file_rule>
|
</file_rule>
|
||||||
<cluster name="scanner" location=".\scanner\"/>
|
<cluster name="scanner" location=".\scanner\"/>
|
||||||
</cluster>
|
</cluster>
|
||||||
</target>
|
</target>
|
||||||
<target name="json_dotnet" extends="json">
|
</system>
|
||||||
<setting name="msil_generation" value="true"/>
|
|
||||||
</target>
|
|
||||||
</system>
|
|
||||||
|
|||||||
@@ -36,10 +36,11 @@ feature -- Initialization
|
|||||||
feature -- Change Element
|
feature -- Change Element
|
||||||
|
|
||||||
|
|
||||||
put(key:JSON_STRING; value:JSON_VALUE) is
|
put(value:JSON_VALUE ; key:JSON_STRING) is
|
||||||
--
|
-- Assuming there is no item of key `key',
|
||||||
|
-- insert `value' with `key'.
|
||||||
require
|
require
|
||||||
not_null: key /= Void
|
not_present: not has_key (key)
|
||||||
local
|
local
|
||||||
l_json_null:JSON_NULL
|
l_json_null:JSON_NULL
|
||||||
l_value:JSON_VALUE
|
l_value:JSON_VALUE
|
||||||
@@ -52,6 +53,7 @@ feature -- Change Element
|
|||||||
object.extend(l_value,key)
|
object.extend(l_value,key)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
has_key(key:JSON_STRING):BOOLEAN is
|
has_key(key:JSON_STRING):BOOLEAN is
|
||||||
-- has the JSON_OBJECT contains a specific key 'key'.
|
-- has the JSON_OBJECT contains a specific key 'key'.
|
||||||
@@ -59,13 +61,19 @@ feature -- Access
|
|||||||
Result := object.has (key)
|
Result := object.has (key)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
has_item(value:JSON_VALUE):BOOLEAN is
|
||||||
|
-- has the JSON_OBJECT contain a specfic item 'value'
|
||||||
|
do
|
||||||
|
Result := object.has_item (value)
|
||||||
|
end
|
||||||
|
|
||||||
item(key:JSON_STRING):JSON_VALUE is
|
item(key:JSON_STRING):JSON_VALUE is
|
||||||
-- the json_value associated with a key.
|
-- the json_value associated with a key.
|
||||||
do
|
do
|
||||||
Result:= object.item (key)
|
Result:= object.item (key)
|
||||||
end
|
end
|
||||||
|
|
||||||
get_keys:ARRAY[JSON_STRING] is
|
current_keys:ARRAY[JSON_STRING] is
|
||||||
-- array containing actually used keys
|
-- array containing actually used keys
|
||||||
do
|
do
|
||||||
Result:=object.current_keys
|
Result:=object.current_keys
|
||||||
|
|||||||
Reference in New Issue
Block a user