Merged formats, from CMS_NODE_API and CMS_API, into CMS_API.formats: CMS_FORMATS.
This commit is contained in:
@@ -6,34 +6,56 @@ note
|
||||
class
|
||||
CMS_FORMATS
|
||||
|
||||
inherit
|
||||
ITERABLE [CMS_FORMAT]
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (nb: INTEGER)
|
||||
do
|
||||
create items.make (nb)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
item (a_name: detachable READABLE_STRING_GENERAL): detachable CONTENT_FORMAT
|
||||
item (a_name: detachable READABLE_STRING_GENERAL): detachable CMS_FORMAT
|
||||
do
|
||||
if a_name /= Void then
|
||||
across
|
||||
all_formats as c
|
||||
items as c
|
||||
until
|
||||
Result /= Void
|
||||
loop
|
||||
if a_name.same_string (c.item.name) then
|
||||
if a_name.is_case_insensitive_equal (c.item.name) then
|
||||
Result := c.item
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
all_formats: LIST [CONTENT_FORMAT]
|
||||
once
|
||||
-- Can we provide an external file to read the
|
||||
-- supported formats?
|
||||
create {ARRAYED_LIST [CONTENT_FORMAT]} Result.make (4)
|
||||
Result.force (plain_text)
|
||||
Result.force (full_html)
|
||||
Result.force (filtered_html)
|
||||
Result.force (cms_html)
|
||||
feature -- Element change
|
||||
|
||||
extend (f: CMS_FORMAT)
|
||||
-- Add format `f' to available formats.
|
||||
do
|
||||
items.force (f)
|
||||
ensure
|
||||
has_format: item (f.name) = f
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
new_cursor: ITERATION_CURSOR [CMS_FORMAT]
|
||||
-- Fresh cursor associated with current structure
|
||||
do
|
||||
Result := items.new_cursor
|
||||
end
|
||||
|
||||
feature -- Built-in formats
|
||||
|
||||
default_format: CONTENT_FORMAT
|
||||
do
|
||||
Result := plain_text --FIXME
|
||||
@@ -44,23 +66,15 @@ feature -- Access
|
||||
create Result
|
||||
end
|
||||
|
||||
cms_html: CMS_EDITOR_CONTENT_FORMAT
|
||||
once
|
||||
create Result
|
||||
end
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
full_html: FULL_HTML_CONTENT_FORMAT
|
||||
once
|
||||
create Result
|
||||
end
|
||||
items: ARRAYED_LIST [CMS_FORMAT]
|
||||
|
||||
filtered_html: FILTERED_HTML_CONTENT_FORMAT
|
||||
once
|
||||
create Result
|
||||
end
|
||||
invariant
|
||||
items /= Void
|
||||
|
||||
note
|
||||
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
Reference in New Issue
Block a user