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

@@ -52,14 +52,14 @@ feature -- Status report
feature -- Query
string_representation: STRING_32
string_representation: READABLE_STRING_32
-- String representation of Current
-- if possible
do
if attached value as v then
Result := v.generating_type.name_32
Result := generating_type.name_32
else
Result := "Void"
Result := {STRING_32} "Void"
end
end

View File

@@ -126,17 +126,10 @@ feature -- Helper
Result := value.same_string_general (a_other)
end
is_case_insensitive_equal (a_other: READABLE_STRING_8): BOOLEAN
is_case_insensitive_equal (a_other: READABLE_STRING_GENERAL): BOOLEAN
-- Does `a_other' represent the same case insensitive string as `Current'?
local
v: like value
do
v := value
if v = a_other.to_string_32 then
Result := True
elseif v.is_valid_as_string_8 then
Result := v.is_case_insensitive_equal (a_other.to_string_32)
end
Result := value.is_case_insensitive_equal_general (a_other)
end
feature -- Conversion

View File

@@ -130,7 +130,7 @@ feature -- Conversion
end
as_array_of_string: detachable ARRAY [READABLE_STRING_32]
-- Return an array of STRING if possible., otherwise Void
-- Return an array of STRING if possible, otherwise Void.
local
i,n: INTEGER
nb: INTEGER
@@ -145,6 +145,10 @@ feature -- Conversion
if attached {WSF_STRING} value (i.out) as s then
Result.put (s.value, i)
nb := nb + 1
elseif attached {WSF_STRING} value (name + "[" + i.out + "]") as s then
-- FIXME !!
Result.put (s.value, i)
nb := nb + 1
else
Result := Void
end

View File

@@ -94,7 +94,7 @@ feature -- Status report
feature -- Conversion
string_representation: STRING_32
string_representation: READABLE_STRING_32
do
Result := filename
end
@@ -250,7 +250,7 @@ feature -- Element change
end
note
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -70,7 +70,7 @@ feature -- Query
end
end
string_representation: STRING_32
string_representation: READABLE_STRING_32
-- String representation of Current
-- if possible
-- note: unicode value.
@@ -89,7 +89,7 @@ feature -- Helper
result_true_only_for_string: Result implies is_string
end
is_case_insensitive_equal (a_other: READABLE_STRING_8): BOOLEAN
is_case_insensitive_equal (a_other: READABLE_STRING_GENERAL): BOOLEAN
-- Does `a_other' represent the same case insensitive string as `Current'?
do
if is_string then
@@ -130,7 +130,7 @@ feature -- Visitor
end
note
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -125,13 +125,13 @@ feature {NONE} -- Implementation
l_is_hidden := l_doc_mapping.documentation (i.request_methods).is_hidden
end
if not l_is_hidden then
create s.make_from_string (i.mapping.associated_resource.to_string_32)
create s.make_from_string_general (i.mapping.associated_resource)
if attached i.request_methods as mtds then
s.append (" [ ")
across
mtds as mtds_c
loop
s.append (mtds_c.item.to_string_32)
s.append_string_general (mtds_c.item)
s.append_character (' ')
end
s.append ("]")
@@ -169,7 +169,7 @@ feature {NONE} -- Implementation
end
if not l_is_hidden then
ok := True
create s.make_from_string (i.mapping.associated_resource.to_string_32)
create s.make_from_string_general (i.mapping.associated_resource)
if attached i.request_methods as mtds then
ok := False
s.append (" [ ")
@@ -179,7 +179,7 @@ feature {NONE} -- Implementation
if m = Void or else m.is_case_insensitive_equal (c.item) then
ok := True
end
s.append (c.item.to_string_32)
s.append_string_general (c.item)
s.append_character (' ')
end
s.append ("]")

View File

@@ -130,7 +130,7 @@ feature {WSF_RESPONSE} -- Output
if request.is_content_type_accepted ({HTTP_MIME_TYPES}.text_html) then
s := "<html lang=%"en%"><head>"
s.append ("<title>")
s.append (html_encoder.encoded_string (request.request_uri.to_string_32))
s.append (html_encoder.general_encoded_string (request.request_uri))
s.append (l_html_error_code_text + "!!")
s.append ("</title>%N")
s.append (
@@ -160,7 +160,7 @@ feature {WSF_RESPONSE} -- Output
s.append (l_html_error_code_text + "</div>")
s.append ("<div id=%"message%">" + l_html_error_code_text + ": the request method <code>")
s.append (request.request_method)
s.append ("</code> is inappropriate for the URL for <code>" + html_encoder.encoded_string (request.request_uri.to_string_32) + "</code>.</div>")
s.append ("</code> is inappropriate for the URL for <code>" + html_encoder.general_encoded_string (request.request_uri) + "</code>.</div>")
if attached suggested_methods as lst and then not lst.is_empty then
s.append ("<div id=%"suggestions%"><strong>Allowed methods:</strong>")
across
@@ -186,17 +186,17 @@ feature {WSF_RESPONSE} -- Output
l_text := l_loc
end
s.append ("<li>")
s.append ("<a href=%"" + l_loc + "%">" + html_encoder.encoded_string (l_text.to_string_32) + "</a>")
s.append ("<a href=%"" + l_loc + "%">" + html_encoder.general_encoded_string (l_text) + "</a>")
elseif l_text /= Void then
s.append ("<li>")
s.append (html_encoder.encoded_string (l_text.to_string_32))
s.append (html_encoder.general_encoded_string (l_text))
s.append ("</li>%N")
end
if (l_loc /= Void or l_text /= Void) then
if attached lst.item.description as l_desc then
s.append ("<br/> - ")
s.append (html_encoder.encoded_string (l_desc.to_string_32))
s.append (html_encoder.general_encoded_string (l_desc))
s.append ("%N")
end
s.append ("</li>%N")
@@ -221,7 +221,7 @@ feature {WSF_RESPONSE} -- Output
else
s := l_html_error_code_text + ": the request method "
s.append (request.request_method)
s.append (" is inappropriate for the URL for '" + html_encoder.encoded_string (request.request_uri.to_string_32) + "'.%N")
s.append (" is inappropriate for the URL for '" + html_encoder.general_encoded_string (request.request_uri) + "'.%N")
if attached suggested_methods as lst and then not lst.is_empty then
s.append ("Allowed methods:")
across

View File

@@ -61,7 +61,7 @@ feature {WSF_RESPONSE} -- Output
if request.is_content_type_accepted ({HTTP_MIME_TYPES}.text_html) then
s := "<html lang=%"en%"><head>"
s.append ("<title>")
s.append (html_encoder.encoded_string (request.request_uri.to_string_32))
s.append (html_encoder.general_encoded_string (request.request_uri))
s.append ("Error 412 (Precondition Failed)")
s.append ("</title>%N")
s.append ("[
@@ -84,7 +84,7 @@ feature {WSF_RESPONSE} -- Output
s.append ("<div class=%"inner2%"></div>")
s.append ("</div>")
s.append ("Error 412 (Precondition Failed)</div>")
s.append ("<div id=%"message%">Error 412 (Precondition Failed): <code>" + html_encoder.encoded_string (request.request_uri.to_string_32) + "</code></div>")
s.append ("<div id=%"message%">Error 412 (Precondition Failed): <code>" + html_encoder.general_encoded_string (request.request_uri) + "</code></div>")
if attached body as b then
s.append ("<div>")
s.append (b)

View File

@@ -346,7 +346,7 @@ feature -- Helper
is_request_method (m: READABLE_STRING_GENERAL): BOOLEAN
-- Is `m' the Current request_method?
do
Result := request_method.is_case_insensitive_equal (m.as_string_8)
Result := m.is_case_insensitive_equal (request_method)
end
is_put_request_method: BOOLEAN
@@ -691,7 +691,7 @@ feature -- Access: CGI Meta variables
do
meta_variables_table.force (new_string_value (a_name, a_value), a_name)
ensure
param_set: attached {WSF_STRING} meta_variable (a_name) as val and then val.url_encoded_value.same_string (a_value.to_string_8)
param_set: attached {WSF_STRING} meta_variable (a_name) as val and then a_value.same_string_general (val.url_encoded_value)
end
unset_meta_variable (a_name: READABLE_STRING_GENERAL)