Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

kernel.io

Class KI_PATHNAME


Direct ancestors

KL_CLONABLE, KL_IMPORTED_STRING_ROUTINES, KL_IMPORTED_ANY_ROUTINES

Known direct descendants

KL_PATHNAME

Features

Invariants

indexing

description

Interface for pathnames

library

Gobo Eiffel Kernel Library

copyright

Copyright (c) 2001-2005, Eric Bezault and others

license

Eiffel Forum License v2 (see forum.txt)

date

$Date: 2005/08/03 21:35:47 $

revision

$Revision: 1.9 $

deferred class

KI_PATHNAME

inherit

KL_CLONABLE
KL_IMPORTED_STRING_ROUTINES
KL_IMPORTED_ANY_ROUTINES

feature -- Access

any_: KL_ANY_ROUTINES

-- Routines that ought to be in class ANY

-- (From KL_IMPORTED_ANY_ROUTINES)

ensure
any_routines_not_void: Result /= Void
string_: KL_STRING_ROUTINES

-- Routines that ought to be in class STRING

-- (From KL_IMPORTED_STRING_ROUTINES)

ensure
string_routines_not_void: Result /= Void
drive: STRING

-- Drive of pathname if present,
-- Void otherwise

hostname: STRING

-- Hostname of pathname if present,
-- Void otherwise
-- (for example, with UNC we can have: \\hostname\sharename)

item (i: INTEGER): STRING

-- Pathname component at i-th position

require
i_large_enough: i >= 1
i_small_enough: i <= count
ensure
item_not_void: Result /= Void
sharename: STRING

-- Sharename of pathname if present,
-- Void otherwise
-- (for example, with UNC we can have: \\hostname\sharename)

feature -- Measurement

count: INTEGER

-- Number of components in pathname

ensure
count_positive: Result >= 0

feature -- Comparison

is_equal (other: like Current): BOOLEAN

-- Is current pathname considered equal to other?

-- (From ANY)

require
other_not_void: other /= Void
ensure
symmetric: Result implies other.is_equal (Current)
consistent: standard_is_equal (other) implies Result
same_pathname (a_pathname: KI_PATHNAME): BOOLEAN

-- Is current pathname considered equal to other?

require
a_pathname_not_void: a_pathname /= Void

feature -- Status report

is_canonical: BOOLEAN

-- Is pathname canonical?
-- (A pathname is canonical if it has no parent directory
-- component except at leading positions, and no current
-- directory component except when it is the only component
-- and the pathname is relative.)

is_current (i: INTEGER): BOOLEAN

-- Is component at i-th position the
-- relative current directory name?

require
i_large_enough: i >= 1
i_small_enough: i <= count
is_parent (i: INTEGER): BOOLEAN

-- Is component at i-th position the
-- relative parent directory name?

require
i_large_enough: i >= 1
i_small_enough: i <= count
is_relative: BOOLEAN

-- Is pathname a relative pathname?

feature -- Element change

set_canonical

-- Make pathname canonical.

ensure
is_canonical: is_canonical

feature -- Duplication

cloned_object: like Current

-- Clone of current object

-- (From KL_CLONABLE)

ensure
cloned_not_void: Result /= Void
same_type: ANY_.same_types (Result, Current)
is_equal: Result.is_equal (Current)

invariant

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end