indexing
description: "A low-level string class to solve some garbage collector problems (mainly objects moving around) when interfacing with C APIs."
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date: 2006-08-08 18:54:41 -0700 (Tue, 08 Aug 2006) $"
revision: "$Revision: 62353 $"
class interface
C_STRING
create
make (a_string: STRING_GENERAL)
`a_string'
require
a_string_not_void: a_string /= Void
make_empty (a_length: INTEGER_32)
`a_length'
require
a_length_positive: a_length >= 0
make_by_pointer (a_ptr: POINTER)
`a_ptr'
require
a_ptr_not_null: a_ptr /= default_pointer
make_by_pointer_and_count (a_ptr: POINTER; a_length: INTEGER_32)
`a_length'`a_ptr'
require
a_ptr_not_null: a_ptr /= default_pointer
a_length_non_negative: a_length >= 0
share_from_pointer (a_ptr: POINTER)
`a_ptr'
require
a_ptr_not_null: a_ptr /= default_pointer
share_from_pointer_and_count (a_ptr: POINTER; a_length: INTEGER_32)
`a_ptr'`a_length'
require
a_ptr_not_null: a_ptr /= default_pointer
a_length_non_negative: a_length >= 0
feature
share_from_pointer (a_ptr: POINTER)
`a_ptr'
require
a_ptr_not_null: a_ptr /= default_pointer
share_from_pointer_and_count (a_ptr: POINTER; a_length: INTEGER_32)
`a_ptr'`a_length'
require
a_ptr_not_null: a_ptr /= default_pointer
a_length_non_negative: a_length >= 0
feature
generating_type: STRING_8
ANY
generator: STRING_8
ANY
item: POINTER
ensure
item_not_null: Result /= default_pointer
managed_data: MANAGED_POINTER
read_string_into (a_string: STRING_GENERAL)
`start_pos'`end_pos'`a_string'
require
a_string_not_void: a_string /= Void
a_string_large_enough: a_string.count >= count
read_substring_into (a_string: STRING_GENERAL; start_pos, end_pos: INTEGER_32)
`start_pos'`end_pos'`a_string'
require
a_string_not_void: a_string /= Void
start_position_big_enough: start_pos >= 1
end_position_big_enough: start_pos <= end_pos + 1
end_position_not_too_big: end_pos <= capacity
a_string_large_enough: a_string.count >= end_pos - start_pos + 1
string: STRING_8
count
ensure
string_not_void: Result /= Void
substring (start_pos, end_pos: INTEGER_32): STRING_8
`start_pos'`end_pos'
require
start_position_big_enough: start_pos >= 1
end_position_big_enough: start_pos <= end_pos + 1
end_position_not_too_big: end_pos <= capacity
ensure
susbstring_not_void: Result /= Void
feature
bytes_count: INTEGER_32
capacity: INTEGER_32
character_size: INTEGER_32 is 1
count: INTEGER_32
feature
frozen deep_equal (some: ANY; other: like arg #1): BOOLEAN
`some'`other'
ANY
ensure ANY
shallow_implies_deep: standard_equal (some, other) implies Result
both_or_none_void: (some = Void) implies (Result = (other = Void))
same_type: (Result and (some /= Void)) implies some.same_type (other)
symmetric: Result implies deep_equal (other, some)
frozen equal (some: ANY; other: like arg #1): BOOLEAN
`some'`other'
ANY
ensure ANY
definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.is_equal (other))
is_equal (other: like Current): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
ensure ANY
symmetric: Result implies other.is_equal (Current)
consistent: standard_is_equal (other) implies Result
frozen standard_equal (some: ANY; other: like arg #1): BOOLEAN
`some'`other'
ANY
ensure ANY
definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.standard_is_equal (other))
frozen standard_is_equal (other: like Current): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
ensure ANY
same_type: Result implies same_type (other)
symmetric: Result implies other.standard_is_equal (Current)
feature
conforms_to (other: ANY): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
same_type (other: ANY): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
ensure ANY
definition: Result = (conforms_to (other) and other.conforms_to (Current))
feature
fill_blank
fill_value (a_value: INTEGER_8)
`a_value'
set_count (a_count: INTEGER_32)
count`a_count'
`1'
`count.min (a_count)'
require
a_count_non_negative: a_count >= 0
ensure
count_set: count = a_count
set_string (a_string: STRING_GENERAL)
string`a_string'
require
a_string_not_void: a_string /= Void
a_string_is_string_8: a_string.is_valid_as_string_8
set_substring (a_string: STRING_GENERAL; start_pos, end_pos: INTEGER_32)
string`a_string'
require
a_string_not_void: a_string /= Void
start_position_big_enough: start_pos >= 1
end_position_big_enough: start_pos <= end_pos + 1
end_pos_small_enough: end_pos <= a_string.count
feature
copy (other: like Current)
`other'
ANY
require ANY
other_not_void: other /= Void
type_identity: same_type (other)
ensure ANY
is_equal: is_equal (other)
frozen deep_copy (other: like Current)
copy`other'deep_twin
ANY
require ANY
other_not_void: other /= Void
ensure ANY
deep_equal: deep_equal (Current, other)
frozen deep_twin: like Current
ANY
ensure ANY
deep_equal: deep_equal (Current, Result)
frozen standard_copy (other: like Current)
`other'
ANY
require ANY
other_not_void: other /= Void
type_identity: same_type (other)
ensure ANY
is_standard_equal: standard_is_equal (other)
frozen standard_twin: like Current
`other'
ANY
ensure ANY
standard_twin_not_void: Result /= Void
equal: standard_equal (Result, Current)
frozen twin: like Current
`Current'
twincopycopy
ANY
ensure ANY
twin_not_void: Result /= Void
is_equal: Result.is_equal (Current)
feature
frozen default: like Current
ANY
frozen default_pointer: POINTER
`POINTER'
`p'default
`p'`POINTER'
ANY
default_rescue
ANY
frozen do_nothing
ANY
feature
io: STD_FILES
ANY
out: STRING_8
ANYtagged_out
ANY
print (some: ANY)
`some'
ANY
frozen tagged_out: STRING_8
ANYout
ANY
feature
operating_environment: OPERATING_ENVIRONMENT
ANY
feature
make (a_string: STRING_GENERAL)
`a_string'
require
a_string_not_void: a_string /= Void
make_by_pointer (a_ptr: POINTER)
`a_ptr'
require
a_ptr_not_null: a_ptr /= default_pointer
make_by_pointer_and_count (a_ptr: POINTER; a_length: INTEGER_32)
`a_length'`a_ptr'
require
a_ptr_not_null: a_ptr /= default_pointer
a_length_non_negative: a_length >= 0
make_empty (a_length: INTEGER_32)
`a_length'
require
a_length_positive: a_length >= 0
invariant
managed_data_not_void: managed_data /= Void
count_not_negative: count >= 0
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
indexing
library: "EiffelBase: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end C_STRING