Added FEED + FEED operator to merge two feeds.
Added FEED sorting routine. Added FEED_ITEM.link: detachable FEED_LINK that represents the main feed link. Comments.
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
<target name="feed">
|
<target name="feed">
|
||||||
<root all_classes="true"/>
|
<root all_classes="true"/>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
|
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension-safe.ecf"/>
|
||||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
||||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||||
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid-safe.ecf"/>
|
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid-safe.ecf"/>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<option void_safety="none">
|
<option void_safety="none">
|
||||||
</option>
|
</option>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||||
|
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension.ecf"/>
|
||||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/>
|
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/>
|
||||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||||
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid.ecf"/>
|
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid.ecf"/>
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ feature -- Access
|
|||||||
e.set_author (l_author)
|
e.set_author (l_author)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Result.add_item (e)
|
Result.extend (e)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -88,12 +88,47 @@ feature -- Element change
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
add_item (a_item: FEED_ITEM)
|
extend (a_item: FEED_ITEM)
|
||||||
-- Add item `a_item' to feed `items'.
|
-- Add item `a_item' to feed `items'.
|
||||||
do
|
do
|
||||||
items.force (a_item)
|
items.force (a_item)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
extended alias "+" (a_feed: FEED): FEED
|
||||||
|
-- New feed object made from Current merged with a_feed.
|
||||||
|
local
|
||||||
|
l_title: STRING_32
|
||||||
|
do
|
||||||
|
create l_title.make (title.count + a_feed.title.count)
|
||||||
|
l_title.append_character ('(')
|
||||||
|
l_title.append (title)
|
||||||
|
l_title.append_character (')')
|
||||||
|
l_title.append_character ('+')
|
||||||
|
l_title.append_character ('(')
|
||||||
|
l_title.append (a_feed.title)
|
||||||
|
l_title.append_character (')')
|
||||||
|
create Result.make (l_title)
|
||||||
|
Result.items.append (items)
|
||||||
|
across
|
||||||
|
a_feed.items as ic
|
||||||
|
loop
|
||||||
|
-- FIXME jfiat [2015/10/07] : check there is no duplication! (same id, or link, ...)
|
||||||
|
Result.extend (ic.item)
|
||||||
|
end
|
||||||
|
Result.sort
|
||||||
|
end
|
||||||
|
|
||||||
|
sort
|
||||||
|
-- Sort `items', (recent first).
|
||||||
|
local
|
||||||
|
s: QUICK_SORTER [FEED_ITEM]
|
||||||
|
comp: COMPARABLE_COMPARATOR [FEED_ITEM]
|
||||||
|
do
|
||||||
|
create comp
|
||||||
|
create s.make (comp)
|
||||||
|
s.reverse_sort (items)
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Visitor
|
feature -- Visitor
|
||||||
|
|
||||||
accept (vis: FEED_VISITOR)
|
accept (vis: FEED_VISITOR)
|
||||||
|
|||||||
@@ -61,6 +61,21 @@ feature -- Access
|
|||||||
date: detachable DATE_TIME
|
date: detachable DATE_TIME
|
||||||
-- Publishing date.
|
-- Publishing date.
|
||||||
|
|
||||||
|
link: detachable FEED_LINK
|
||||||
|
-- Main link for the entry, if any.
|
||||||
|
do
|
||||||
|
if attached links as l_links then
|
||||||
|
Result := l_links.item ("")
|
||||||
|
across
|
||||||
|
l_links as ic
|
||||||
|
until
|
||||||
|
Result /= Void
|
||||||
|
loop
|
||||||
|
Result := ic.item
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
links: STRING_TABLE [FEED_LINK]
|
links: STRING_TABLE [FEED_LINK]
|
||||||
-- Url indexed by relation
|
-- Url indexed by relation
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ feature -- Access
|
|||||||
else
|
else
|
||||||
e.set_content (xml_element_code (x_content), Void)
|
e.set_content (xml_element_code (x_content), Void)
|
||||||
end
|
end
|
||||||
Result.add_item (e)
|
Result.extend (e)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {FEED_HELPERS}."
|
description: "Helpers routine for feed library."
|
||||||
author: ""
|
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {FEED_PARSER_UTILITIES}."
|
description: "Helpers routine for feed xml parsers."
|
||||||
author: ""
|
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
@@ -80,5 +79,5 @@ feature -- Access
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user