Renamed same_media_type as same_simple_type

Added comments
This commit is contained in:
Jocelyn Fiat
2012-03-23 19:00:49 +01:00
parent ed200b93dd
commit 874677ab7a
3 changed files with 18 additions and 11 deletions

View File

@@ -115,12 +115,14 @@ feature {NONE} -- Initialization
not has_error implies (create {HTTP_CONTENT_TYPE}.make_from_string (string)).same_string (string) not has_error implies (create {HTTP_CONTENT_TYPE}.make_from_string (string)).same_string (string)
end end
feature -- Access feature -- Status report
has_error: BOOLEAN has_error: BOOLEAN
-- Current has error? -- Current has error?
--| Mainly in relation with `make_from_string' --| Mainly in relation with `make_from_string'
feature -- Access
type: READABLE_STRING_8 type: READABLE_STRING_8
-- Main type -- Main type
@@ -144,6 +146,7 @@ feature -- Access
end end
parameters: detachable HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8] parameters: detachable HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8]
-- Parameters
feature -- Conversion feature -- Conversion
@@ -194,15 +197,10 @@ feature -- Conversion
Result := res Result := res
end end
feature {NONE} -- Internal
internal_string: detachable STRING_8
internal_simple_type: detachable STRING_8
feature -- Status report feature -- Status report
same_as (other: HTTP_CONTENT_TYPE): BOOLEAN same_as (other: HTTP_CONTENT_TYPE): BOOLEAN
-- Current has same type/subtype and parameters as `other'?
local local
plst,oplst: like parameters plst,oplst: like parameters
do do
@@ -228,12 +226,14 @@ feature -- Status report
end end
end end
same_media_type (s: READABLE_STRING_8): BOOLEAN same_simple_type (s: READABLE_STRING_8): BOOLEAN
-- Current has same type/subtype string representation as `s'?
do do
Result := simple_type.same_string (s) Result := simple_type.same_string (s)
end end
same_string (s: READABLE_STRING_8): BOOLEAN same_string (s: READABLE_STRING_8): BOOLEAN
-- Current has same string representation as `s'?
do do
Result := string.same_string (s) Result := string.same_string (s)
end end
@@ -255,7 +255,7 @@ feature -- Element change
end end
remove_parameter (a_name: READABLE_STRING_8) remove_parameter (a_name: READABLE_STRING_8)
-- Remove parameter -- Remove parameter named `a_name'
do do
if attached parameters as plst then if attached parameters as plst then
plst.prune (a_name) plst.prune (a_name)
@@ -269,6 +269,7 @@ feature -- Element change
feature {NONE} -- Implementation feature {NONE} -- Implementation
add_parameter_from_string (s: READABLE_STRING_8; start_index, end_index: INTEGER) add_parameter_from_string (s: READABLE_STRING_8; start_index, end_index: INTEGER)
-- Add parameter from string " attribute=value "
local local
pn,pv: STRING_8 pn,pv: STRING_8
i: INTEGER i: INTEGER
@@ -308,6 +309,12 @@ feature {NONE} -- Implementation
has_error := has_error or err has_error := has_error or err
end end
feature {NONE} -- Internal
internal_string: detachable STRING_8
internal_simple_type: detachable STRING_8
feature -- Status report feature -- Status report
debug_output: STRING debug_output: STRING

View File

@@ -16,7 +16,7 @@ feature -- Status report
valid_content_type (a_content_type: HTTP_CONTENT_TYPE): BOOLEAN valid_content_type (a_content_type: HTTP_CONTENT_TYPE): BOOLEAN
do do
Result := a_content_type.same_media_type ({HTTP_MIME_TYPES}.application_x_www_form_encoded) Result := a_content_type.same_simple_type ({HTTP_MIME_TYPES}.application_x_www_form_encoded)
end end
feature -- Execution feature -- Execution

View File

@@ -26,7 +26,7 @@ feature -- Status report
valid_content_type (a_content_type: HTTP_CONTENT_TYPE): BOOLEAN valid_content_type (a_content_type: HTTP_CONTENT_TYPE): BOOLEAN
do do
Result := a_content_type.same_media_type ({HTTP_MIME_TYPES}.multipart_form_data) Result := a_content_type.same_simple_type ({HTTP_MIME_TYPES}.multipart_form_data)
end end
feature -- Execution feature -- Execution