Merge branch 'widget' of github.com:souvarin/EWF into widget

This commit is contained in:
YNH Webdev
2013-09-05 23:37:19 +02:00
6 changed files with 99 additions and 10 deletions

View File

@@ -0,0 +1,24 @@
note
description: "Summary description for {WSF_DECIMAL_VALIDATOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_DECIMAL_VALIDATOR
inherit
WSF_REGEXP_VALIDATOR
create
make_decimal_validator
feature {NONE}
make_decimal_validator (e: STRING)
do
make_regexp_validator ("[0-9]+(\\.[0-9]*)?|\\.[0-9]+", e)
end
end

View File

@@ -0,0 +1,24 @@
note
description: "Summary description for {WSF_EMAIL_VALIDATOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_EMAIL_VALIDATOR
inherit
WSF_REGEXP_VALIDATOR
create
make_email_validator
feature
make_email_validator (e: STRING)
do
make_regexp_validator ("^[a-zA-Z0-9._%%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,6}$", e)
end
end

View File

@@ -6,16 +6,19 @@ note
class
WSF_PHONE_NUMBER_VALIDATOR
inherit
WSF_VALIDATOR[STRING]
WSF_REGEXP_VALIDATOR
create
make
make_with_message
feature -- Implementation
feature {NONE}
validate(input:STRING):BOOLEAN
do
end
make_with_message (e: STRING)
do
make_regexp_validator ("", e)
end
end

View File

@@ -0,0 +1,40 @@
note
description: "Summary description for {WSF_REGEXP_VALIDATOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_REGEXP_VALIDATOR
inherit
WSF_VALIDATOR [STRING]
create
make_regexp_validator
feature {NONE}
make_regexp_validator (r, e: STRING)
do
make(e)
regexp_string := r
create regexp
regexp.compile (r)
end
feature -- Implementation
validate (input: STRING): BOOLEAN
do
Result := regexp.matches (input)
end
feature
regexp_string: STRING
regexp: REGULAR_EXPRESSION
end