Minor changes

- using http_client library instead of libcurl directly
 - using implicit conversion to JSON_STRING to improve code readability
 - use ARRAYED_LIST instead of LINKED_LIST .. for performance.
 - cosmetic .. but still a lot of feature clauses are missing, comments, assertions ...
This commit is contained in:
2013-09-20 10:27:00 +02:00
parent 1da678f726
commit 48f5cb78d5
22 changed files with 201 additions and 161 deletions

View File

@@ -9,7 +9,7 @@ deferred class
feature -- Update event
set_on_update_agent (f: PROCEDURE [ANY, TUPLE []])
set_on_update_agent (f: PROCEDURE [ANY, TUPLE])
do
on_update_agent := f
end
@@ -17,11 +17,11 @@ feature -- Update event
update
do
if attached on_update_agent as a then
a.call ([])
a.call (Void)
end
end
on_update_agent: detachable PROCEDURE [ANY, TUPLE []]
on_update_agent: detachable PROCEDURE [ANY, TUPLE]
feature --State
@@ -30,27 +30,27 @@ feature --State
do
create Result.make
if attached sort_column as a_sort_column then
Result.put (create {JSON_STRING}.make_json (a_sort_column), create {JSON_STRING}.make_json ("sort_column"))
Result.put (create {JSON_STRING}.make_json (a_sort_column), "sort_column")
else
Result.put (create {JSON_NULL}, create {JSON_STRING}.make_json ("sort_column"))
Result.put (create {JSON_NULL}, "sort_column")
end
Result.put (create {JSON_BOOLEAN}.make_boolean (sort_direction), create {JSON_STRING}.make_json ("sort_direction"))
Result.put (create {JSON_BOOLEAN}.make_boolean (sort_direction), "sort_direction")
end
set_state (new_state: JSON_OBJECT)
do
if attached {JSON_NUMBER} new_state.item (create {JSON_STRING}.make_json ("page")) as new_page then
if attached {JSON_NUMBER} new_state.item ("page") as new_page then
page := new_page.integer_type
end
if attached {JSON_NUMBER} new_state.item (create {JSON_STRING}.make_json ("page_size")) as new_page_size then
if attached {JSON_NUMBER} new_state.item ("page_size") as new_page_size then
page_size := new_page_size.integer_type
end
if attached {JSON_STRING} new_state.item (create {JSON_STRING}.make_json ("sort_column")) as new_sort_column then
sort_column := new_sort_column.unescaped_string_32
elseif attached {JSON_NULL} new_state.item (create {JSON_STRING}.make_json ("sort_column")) as new_sort_column then
sort_column := VOID
if attached {JSON_STRING} new_state.item ("sort_column") as new_sort_column then
sort_column := new_sort_column.unescaped_string_32 -- Implicit Conversion !
elseif attached {JSON_NULL} new_state.item ("sort_column") as new_sort_column then
sort_column := Void
end
if attached {JSON_BOOLEAN} new_state.item (create {JSON_STRING}.make_json ("sort_direction")) as new_sort_direction then
if attached {JSON_BOOLEAN} new_state.item ("sort_direction") as new_sort_direction then
sort_direction := new_sort_direction.item
end
end