Added Regexp validation (later used for mail, numbers...)

This commit is contained in:
Severin Münger
2013-09-05 22:09:08 +02:00
parent f506d9e925
commit aba394502c
4 changed files with 51 additions and 10 deletions

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

View File

@@ -11,11 +11,9 @@
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="encoder" location="..\..\text\encoder\encoder-safe.ecf"/>
<library name="gobo_kernel" location="$ISE_LIBRARY\library\gobo\gobo_kernel-safe.ecf"/>
<library name="gobo_lexical" location="$ISE_LIBRARY\library\gobo\gobo_lexical-safe.ecf"/>
<library name="gobo_parse" location="$ISE_LIBRARY\library\gobo\gobo_parse-safe.ecf"/>
<library name="http" location="..\..\network\protocol\http\http-safe.ecf"/>
<library name="json" location="..\..\..\contrib\library\text\parser\json\library\json-safe.ecf"/>
<library name="pcre" location="$ISE_EIFFEL\unstable\library\text\regexp\pcre\pcre-safe.ecf"/>
<library name="uri_template" location="..\..\text\parser\uri_template\uri_template-safe.ecf"/>
<library name="wsf" location="..\wsf\wsf-safe.ecf"/>
<cluster name="api" location=".\api\" recursive="true"/>