Files
EWF/examples/widgetapp/googlenews/google_news.e
Jocelyn Fiat 48f5cb78d5 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 ...
2013-09-20 10:27:00 +02:00

56 lines
1.0 KiB
Plaintext

note
description: "Summary description for {GOOGLE_NEWS}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
GOOGLE_NEWS
inherit
WSF_ENTITY
create
make_from_json
feature {NONE}
make_from_json (json: JSON_OBJECT)
do
if attached {JSON_STRING} json.item ("title") as l_title then
title := l_title.unescaped_string_32
end
if attached {JSON_STRING} json.item ("content") as l_content then
content := l_content.unescaped_string_32
end
if
attached {JSON_OBJECT} json.item ("image") as img and then
attached {JSON_STRING} img.item ("url") as l_image
then
image := l_image.item
end
end
feature -- Access
title: detachable STRING
content: detachable STRING
image: detachable STRING
item (a_field: READABLE_STRING_GENERAL): detachable ANY
-- <Precursor>
do
if a_field.same_string ("title") then
Result := title
elseif a_field.same_string ("content") then
Result := content
elseif a_field.same_string ("image") then
Result := image
end
end
end