Change structure of EWF, to follow better categorization

This commit is contained in:
Jocelyn Fiat
2012-06-13 22:32:17 +02:00
parent 3df1a26220
commit db448001a1
134 changed files with 105 additions and 94 deletions

View File

@@ -0,0 +1,49 @@
note
description : "Error list iterator"
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
ERROR_ITERATOR
inherit
ERROR_VISITOR
feature -- Access
process_error (e: ERROR)
do
end
process_custom (e: ERROR_CUSTOM)
do
process_error (e)
end
process_group (g: ERROR_GROUP)
do
if attached g.sub_errors as err then
from
err.start
until
err.after
loop
process_error (err.item)
err.forth
end
end
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,38 @@
note
description : "Null error visitor"
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
ERROR_NULL_VISITOR
inherit
ERROR_VISITOR
feature -- Access
process_error (e: ERROR)
do
end
process_custom (e: ERROR_CUSTOM)
do
end
process_group (g: ERROR_GROUP)
do
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,35 @@
note
description : "Objects to visit an ERROR"
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
deferred class
ERROR_VISITOR
feature -- Access
process_error (e: ERROR)
deferred
end
process_custom (e: ERROR_CUSTOM)
deferred
end
process_group (g: ERROR_GROUP)
deferred
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,63 @@
note
description: "File error output visitor"
date: "$Date$"
revision: "$Revision$"
class
FILE_OUTPUT_ERROR_VISITOR
inherit
OUTPUT_ERROR_VISITOR
redefine
output_integer,
output_new_line
end
create
make
feature -- Initialization
make (f: like file)
require
f_open_write: f /= Void and then f.is_open_write
do
file := f
end
feature -- Access
file: FILE
feature -- Output
output_string (a_str: detachable READABLE_STRING_GENERAL)
-- Output Unicode string
do
if a_str /= Void then
to_implement ("Convert into UTF-8 or console encoding before output")
file.put_string (a_str.as_string_8)
end
end
output_integer (i: INTEGER)
do
file.put_integer (i)
end
output_new_line
do
file.put_new_line
end
note
copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,93 @@
note
description: "General error output visitor"
date: "$Date$"
revision: "$Revision$"
deferred class
OUTPUT_ERROR_VISITOR
inherit
ERROR_VISITOR
REFACTORING_HELPER
feature -- Output
output_string (a_str: detachable READABLE_STRING_GENERAL)
-- Output Unicode string
deferred
end
output_any (obj: detachable ANY)
-- Output Unicode string
do
if attached {READABLE_STRING_GENERAL} obj as l_str then
to_implement ("Convert into UTF-8 or console encoding before output")
output_string (l_str)
elseif obj /= Void then
output_string (obj.out)
end
end
output_integer (i: INTEGER)
do
output_string (i.out)
end
output_new_line
do
output_string ("%N")
end
feature -- Process
process_error (e: ERROR)
do
output_string ({STRING_32}"Error Name: ")
output_string (e.name)
output_string ({STRING_32}"Code: ")
output_integer (e.code)
output_new_line
output_string ({STRING_32}"%TMessage: ")
output_string (e.message)
output_new_line
end
process_custom (e: ERROR_CUSTOM)
do
output_string ({STRING_32}"Error Name: ")
output_string (e.name)
output_string ({STRING_32}"Code: ")
output_integer (e.code)
output_new_line
output_string ({STRING_32}"%TMessage: ")
output_string (e.message)
output_new_line
end
process_group (g: ERROR_GROUP)
local
l_errors: LIST [ERROR]
do
from
l_errors := g.sub_errors
l_errors.start
until
l_errors.after
loop
l_errors.item.process (Current)
l_errors.forth
end
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,63 @@
note
description: "Text error output visitor"
date: "$Date$"
revision: "$Revision$"
class
TEXT_OUTPUT_ERROR_VISITOR
inherit
OUTPUT_ERROR_VISITOR
redefine
output_integer,
output_new_line
end
create
make
feature -- Initialization
make (buf: like buffer)
require
buf_attached: buf /= Void
do
buffer := buf
end
feature -- Access
buffer: STRING
feature -- Output
output_string (a_str: detachable READABLE_STRING_GENERAL)
-- Output Unicode string
do
if a_str /= Void then
to_implement ("Convert into UTF-8 or console encoding before output")
buffer.append_string_general (a_str)
end
end
output_integer (i: INTEGER)
do
buffer.append_integer (i)
end
output_new_line
do
buffer.append_character ('%N')
end
note
copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end