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">
|
||||
<root all_classes="true"/>
|
||||
<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="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid-safe.ecf"/>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<option void_safety="none">
|
||||
</option>
|
||||
<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="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid.ecf"/>
|
||||
|
||||
@@ -92,7 +92,7 @@ feature -- Access
|
||||
e.set_author (l_author)
|
||||
end
|
||||
end
|
||||
Result.add_item (e)
|
||||
Result.extend (e)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -88,12 +88,47 @@ feature -- Element change
|
||||
end
|
||||
end
|
||||
|
||||
add_item (a_item: FEED_ITEM)
|
||||
extend (a_item: FEED_ITEM)
|
||||
-- Add item `a_item' to feed `items'.
|
||||
do
|
||||
items.force (a_item)
|
||||
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
|
||||
|
||||
accept (vis: FEED_VISITOR)
|
||||
|
||||
@@ -61,6 +61,21 @@ feature -- Access
|
||||
date: detachable DATE_TIME
|
||||
-- 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]
|
||||
-- Url indexed by relation
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ feature -- Access
|
||||
else
|
||||
e.set_content (xml_element_code (x_content), Void)
|
||||
end
|
||||
Result.add_item (e)
|
||||
Result.extend (e)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {FEED_HELPERS}."
|
||||
author: ""
|
||||
description: "Helpers routine for feed library."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {FEED_PARSER_UTILITIES}."
|
||||
author: ""
|
||||
description: "Helpers routine for feed xml parsers."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user