Code improvement

Cosmetic (comments, names, formatting)
This commit is contained in:
2014-03-26 10:18:02 +01:00
parent acc8cda04f
commit cc7d268610
36 changed files with 684 additions and 291 deletions

View File

@@ -2,10 +2,12 @@ note
description: "[
Validator implementation which make sure that the input has
the format of an valid email address. This is just a very
basic implementation that tests if the given input contains
a '@'.
basic implementation that tests if the given input contains a '@'.
This is a simple checker, it does not handle all the cases.
]"
author: ""
EIS: "name=Application Techniques for Checking and Transformation of Names RFC3696", "protocol=URI", "src=http://tools.ietf.org/html/rfc3696#section-3"
EIS: "name=Email address (wikipedia)", "protocol=URI", "src=http://en.wikipedia.org/wiki/Email_address"
date: "$Date$"
revision: "$Revision$"
@@ -30,4 +32,14 @@ feature {NONE} -- Initialization
make_regexp_validator ("^.*@.*$", e)
end
note
copyright: "2011-2014, Yassin Hassan, Severin Munger, Jocelyn Fiat, 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

@@ -32,12 +32,9 @@ feature {NONE} -- Initialization
feature -- Implementation
is_valid (input: detachable WSF_FILE_DEFINITION): BOOLEAN
is_valid (a_input: detachable WSF_FILE_DEFINITION): BOOLEAN
do
Result := True
if attached input as a_input then
Result := a_input.size < max
end
Result := a_input /= Void implies a_input.size < max
end
feature -- State
@@ -48,9 +45,19 @@ feature -- State
Result.put_integer (max, "max")
end
feature -- Properties
feature -- Access
max: INTEGER
-- The maximal allowed value
;note
copyright: "2011-2014, Yassin Hassan, Severin Munger, Jocelyn Fiat, 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

@@ -24,7 +24,7 @@ create
feature {NONE} -- Initialization
make (m: INTEGER; e: STRING_32)
-- Initialize with specified maximum and error message which will be displayed on validation failure
-- Initialize with specified minimum `m' and error message `e' which will be displayed on validation failure.
do
make_validator (e)
max := m
@@ -32,9 +32,9 @@ feature {NONE} -- Initialization
feature -- Implementation
is_valid (input: G): BOOLEAN
is_valid (a_input: G): BOOLEAN
do
Result := input.count < max or input.count = max
Result := a_input.count < max or a_input.count = max
end
feature -- State
@@ -50,4 +50,14 @@ feature -- Properties
max: INTEGER
-- The maximal allowed value
;note
copyright: "2011-2014, Yassin Hassan, Severin Munger, Jocelyn Fiat, 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

@@ -12,7 +12,7 @@ deferred class
feature {NONE} -- Initialization
make (e: STRING_32)
-- Initialize with specified error message to be displayed on validation failure
-- Initialize with specified error message `e' to be displayed on validation failure.
do
error := e
ensure
@@ -27,9 +27,10 @@ feature -- Access
create Result.make
Result.put_string (generator, "name")
Result.put_string (error, "error")
-- FIXME: is that correct to always send error message??
end
is_valid (input: G): BOOLEAN
is_valid (a_input: G): BOOLEAN
-- Perform validation on given input and tell whether validation was successful or not
deferred
end
@@ -37,6 +38,16 @@ feature -- Access
feature -- Properties
error: STRING_32
-- The error message if validation fails
-- The error message if validation fails.
;note
copyright: "2011-2014, Yassin Hassan, Severin Munger, Jocelyn Fiat, 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