Updated code regarding to string 32 vs string 8.

This commit is contained in:
Jocelyn Fiat
2017-04-14 11:45:38 +02:00
parent a530bbebb4
commit 3b8261ff08
31 changed files with 163 additions and 147 deletions

View File

@@ -38,11 +38,11 @@ feature -- Element change
v: READABLE_STRING_8
do
if a_text /= Void then
v := html_encoded_string (a_text.to_string_32)
v := html_encoded_string (a_text)
across
options as o
loop
if o.item.is_same_value (v.to_string_32) then
if o.item.is_same_value (v) then
l_found := True
o.item.set_is_selected (True)
else
@@ -50,7 +50,7 @@ feature -- Element change
end
end
if not l_found then
create opt.make (v.to_string_32, Void)
create opt.make (v, Void)
opt.set_is_selected (True)
add_option (opt)
end
@@ -69,7 +69,7 @@ feature -- Element change
v: READABLE_STRING_8
do
if a_text /= Void then
v := html_encoded_string (a_text.to_string_32)
v := html_encoded_string (a_text)
across
options as o
loop

View File

@@ -10,17 +10,19 @@ class
inherit
WSF_FORM_SELECTABLE_ITEM
SHARED_HTML_ENCODER
create
make
feature {NONE} -- Initialization
make (a_value: like value; a_text: detachable like text)
make (a_value: READABLE_STRING_GENERAL; a_text: detachable like text)
-- Initialize `Current'.
do
value := a_value
value := a_value.as_string_32
if a_text = Void then
text := a_value.to_string_8
text := html_encoder.general_encoded_string (a_value)
else
text := a_text
end
@@ -30,9 +32,9 @@ feature -- Status
is_selected: BOOLEAN
is_same_value (v: READABLE_STRING_32): BOOLEAN
is_same_value (v: READABLE_STRING_GENERAL): BOOLEAN
do
Result := value.same_string (v)
Result := value.same_string_general (v)
end
is_same_text (v: like text): BOOLEAN

View File

@@ -12,7 +12,7 @@ feature -- Status report
deferred
end
is_same_value (v: READABLE_STRING_32): BOOLEAN
is_same_value (v: READABLE_STRING_GENERAL): BOOLEAN
deferred
end

View File

@@ -9,9 +9,9 @@ class
feature -- Converter
html_encoded_string (s: READABLE_STRING_32): READABLE_STRING_8
html_encoded_string (s: READABLE_STRING_GENERAL): READABLE_STRING_8
do
Result := html_encoder.encoded_string (s)
Result := html_encoder.general_encoded_string (s)
end
html_encoder: HTML_ENCODER

View File

@@ -16,27 +16,27 @@ feature -- Access
-- indicate that the form shouldnt be validated when submitted.
-- it's only applicable to input type=submit or image.
formaction: detachable READABLE_STRING_32
formaction: detachable READABLE_STRING_8
-- formaction specifies the file or application that will submit the form.
-- It has the same effect as the action attribute on the form element and
-- can only be used with a submit or image button (type="submit" or type="image").
-- When the form is submitted, the browser first checks for a formaction attribute;
-- if that isnt present, it proceeds to look for an action attribute on the form.
formenctype: detachable READABLE_STRING_32
formenctype: detachable READABLE_STRING_8
-- formenctype details how the form data is encoded with the POST method type.
-- It has the same effect as the enctype attribute on the form element and
-- can only be used with a submit or image button (type="submit" or type="image").
-- The default value if not included is application/x-www-formurlencoded.
--! At the moment the value is not validated.
formmethod: detachable READABLE_STRING_32
formmethod: detachable READABLE_STRING_8
-- formmethod specifies which HTTP method (GET, POST, PUT, DELETE) will be used to submit the form data.
-- It has the same effect as the method attribute on the form element and can only be used with a
-- submit or image button (type="submit" or type="image").
--!At the moment the value is not validated.
formtarget: detachable READABLE_STRING_32
formtarget: detachable READABLE_STRING_8
-- formtarget specifies the target window for the form results.
-- It has the same effect as the target attribute on the form element and can only be used with a submit or image button (type="submit" or type="image").
@@ -60,39 +60,47 @@ feature -- Element Change
formnovalidate_false: not formnovalidate
end
set_formaction (a_action: READABLE_STRING_32)
set_formaction (a_action: READABLE_STRING_GENERAL)
-- Set `formaction' with `a_action'.
-- Example:<input type="submit" value="Submit" formaction="/users">
require
is_valid_as_string_8: a_action.is_valid_as_string_8
do
formaction := a_action
formaction := a_action.to_string_8
ensure
formaction_set: attached formaction as l_action implies l_action = a_action
end
set_formenctype (a_enctype: READABLE_STRING_32)
set_formenctype (a_enctype: READABLE_STRING_GENERAL)
-- Set `formenctype' with `a_enctype'.
-- Example: <input type="submit" value="Submit" formenctype="application/x-www-form-urlencoded">
require
is_valid_as_string_8: a_enctype.is_valid_as_string_8
do
formenctype := a_enctype
formenctype := a_enctype.to_string_8
ensure
formenctype_set: attached formenctype as l_enctype implies l_enctype = a_enctype
end
set_formmethod (a_method: READABLE_STRING_32)
set_formmethod (a_method: READABLE_STRING_GENERAL)
-- Set `formmethod' with `a_method'.
-- Example: <input type="submit" value="Submit" formmethod="POST">
--! require is_valid_method: [PUT, POST, DELETE, GET, ...]
require
is_valid_as_string_8: a_method.is_valid_as_string_8
do
formmethod := a_method
formmethod := a_method.to_string_8
ensure
formmethod_set: attached formmethod as l_method implies l_method = a_method
end
set_formtarget (a_target: READABLE_STRING_32)
set_formtarget (a_target: READABLE_STRING_GENERAL)
-- Set `formtarget' with `a_target'.
-- Example: <input type="submit" value="Submit" formtarget="_self">
require
is_valid_as_string_8: a_target.is_valid_as_string_8
do
formtarget := a_target
formtarget := a_target.to_string_8
ensure
formtarget_set: attached formtarget as l_target implies l_target = a_target
end
@@ -110,26 +118,26 @@ feature {NONE} -- Conversion
--formaction
if attached formaction as l_formaction then
a_target.append (" formaction=%"")
a_target.append (l_formaction.to_string_8)
a_target.append (l_formaction)
a_target.append_character ('%"')
end
--formenctype
if attached formenctype as l_enctype then
a_target.append (" formenctype=%"")
a_target.append (l_enctype.to_string_8)
a_target.append (l_enctype)
a_target.append_character ('%"')
end
-- formmethod
if attached formmethod as l_method then
a_target.append (" formmethod=%"")
a_target.append (l_method.to_string_8)
a_target.append (l_method)
a_target.append_character ('%"')
end
-- formmethod
if attached formtarget as l_target then
a_target.append (" formtarget=%"")
a_target.append (l_target.to_string_8)
a_target.append (l_target)
a_target.append_character ('%"')
end
end