+
Point of view
All features
class URL
Summary
Provides meaning to URL (Universal Resource Locator) strings.
See also RFC 1738
Some ideas and first draft of this class kindly provided by Serge Romanchenko mailto:se@sir.nensi.net
Direct parents
Insert list: HASHABLE, RECYCLABLE, URL_VALIDITY
Class invariant
Overview
Creation features
{ANY}
{STREAM}
Features
{ANY}
URL connection:
{ANY}
URL data:
{ANY}
{STREAM}
{}
{URL, PROTOCOL}
{}
{RECYCLING_POOL}
  • recycle
    Do whatever needs to be done to free resources or recycle other objects when recycling this one
{ANY}
copy (other: URL)
effective procedure
{ANY}
Update current object using fields of object attached to other, so as to yield equal objects.
Note: you can't copy object from a different dynamic type.
require
    • not immutable
    • same_dynamic_type(other)
    • not immutable
    • same_dynamic_type(other)
ensure
is_equal (other: URL): BOOLEAN
effective function
{ANY}
Is other attached to an object considered equal to current object?
require
    • other /= Void
    • other /= Void
ensure
  • Result implies hash_code = other.hash_code
  • commutative: generating_type = other.generating_type implies Result = other.is_equal(Current)
hash_code: INTEGER_32
effective function
{ANY}
The hash-code value of Current.
ensure
  • good_hash_value: Result >= 0
out_in_tagged_out_memory
effective procedure
{ANY}
Append terse printable representation of current object in tagged_out_memory.
require
    • locked: tagged_out_locked
    • locked: tagged_out_locked
ensure
  • still_locked: tagged_out_locked
  • not_cleared: tagged_out_memory.count >= old tagged_out_memory.count
  • append_only: old tagged_out_memory.twin.is_equal(tagged_out_memory.substring(1, old tagged_out_memory.count))
append_in (s: STRING)
effective procedure
{ANY}
require
  • s /= Void
is_connected: BOOLEAN
effective function
{ANY}
True if the URL is connected to the resource it points to.
can_connect: BOOLEAN
effective function
{ANY}
connect
effective procedure
{ANY}
Connect to the resource pointed by this URL.
disconnect
effective procedure
{ANY}
Disconnect from the resource pointed by this URL.
require ensure
input: INPUT_STREAM
effective function
{ANY}
Data coming from the resource this URL points to.
require
output: OUTPUT_STREAM
effective function
{ANY}
Data going to the resource this URL points to.
read_only
effective procedure
{ANY}
require ensure
write_only
effective procedure
{ANY}
require ensure
read_write
effective procedure
{ANY}
require ensure
read: BOOLEAN
writable attribute
{ANY}
write: BOOLEAN
writable attribute
{ANY}
is_stream: BOOLEAN
writable attribute
{ANY}
absolute (a_url: ABSTRACT_STRING)
effective procedure
{ANY}
require ensure
relative (url: URL, relative_uri: STRING)
effective procedure
{ANY}
require ensure
set_error_handler (a_error_handler: PROCEDURE[TUPLE 1[STRING]])
effective procedure
{ANY}
from_stream (a_stream: STREAM, a_read: BOOLEAN, a_write: BOOLEAN)
effective procedure
require
  • a_stream /= Void
ensure
set_protocol (protocol_name: FIXED_STRING)
effective procedure
{}
Sets the protocol.
require
  • protocol_name = protocol_name.intern
ensure
set_uri (a_uri: STRING)
effective procedure
{}
Sets the resource name.
require ensure
  • uri.uri.is_equal(a_uri)
unset_protocol
effective procedure
{}
ensure
unset_uri
effective procedure
{}
ensure
protocol: PROTOCOL
writable attribute
The resource protocol.
writable attribute
The resource name.
error_handler: PROCEDURE[TUPLE 1[STRING]]
writable attribute
{}
An optional error handler
string_pool: STRING_RECYCLING_POOL
once function
{}
recycle
effective procedure
Do whatever needs to be done to free resources or recycle other objects when recycling this one
valid_url (a_url: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
True if the STRING represents a real URL (i.e. with a known protocol and a valid URI for that protocol)
require
  • a_url /= Void