Automatic generation produced by ISE Eiffel

Classes Clusters Cluster hierarchy Chart Relations Text Flat Contracts Flat contracts Go to:
indexing description: "[ Sequences of characters, accessible through integer indices in a contiguous range. ]" status: "See notice at end of class" date: "$Date: 2001-11-16 20:32:23 +0000 (Fri, 16 Nov 2001) $" revision: "$Revision: 51435 $" class interface STRING create make, make_from_string, make_from_c feature -- Initialization make_from_string (s: STRING) -- Initialize from the characters of s. -- (Useful in proper descendants of class STRING, -- to initialize a string-like object from a manifest string.) require string_exists: s /= void ensure shared_implementation: shared_with (s) make_from_c (c_string: POINTER) -- Initialize from contents of c_string, -- a string created by some external C function require c_string_exists: c_string /= default_pointer from_c (c_string: POINTER) -- Reset contents of string from contents of c_string, -- a string created by some external C function. require c_string_exists: c_string /= default_pointer ensure no_zero_byte: not has ('%U') from_c_substring (c_string: POINTER; start_pos, end_pos: INTEGER) -- Reset contents of string from substring of c_string, -- a string created by some external C function. require c_string_exists: c_string /= default_pointer start_position_big_enough: start_pos >= 1 end_position_big_enough: start_pos <= end_pos + 1 ensure valid_count: count = end_pos - start_pos + 1 adapt (s: STRING): like Current -- Object of a type conforming to the type of s, -- initialized with attributes from s feature -- Access item (i: INTEGER): CHARACTER -- Character at position i -- Was declared in STRING as synonym of @. infix "@" (i: INTEGER): CHARACTER -- Character at position i -- Was declared in STRING as synonym of item. item_code (i: INTEGER): INTEGER -- Numeric code of character at position i require index_small_enough: i <= count index_large_enough: i > 0 hash_code: INTEGER -- Hash code value False_constant: STRING is "false" -- Constant string "false" True_constant: STRING is "true" -- Constant string "true" shared_with (other: like Current): BOOLEAN -- Does string share the text of other? has (c: CHARACTER): BOOLEAN -- Does string include c? index_of (c: CHARACTER; start: INTEGER): INTEGER -- Position of first occurrence of c at or after start; -- 0 if none. require start_large_enough: start >= 1 start_small_enough: start <= count + 1 ensure correct_place: Result > 0 implies item (Result) = c last_index_of (c: CHARACTER; start_index_from_end: INTEGER): INTEGER -- Position of last occurence of c. -- 0 if none require start_index_small_enough: start_index_from_end <= count start_index_large_enough: start_index_from_end >= 1 ensure correct_place: Result > 0 implies item (Result) = c substring_index (other: STRING; start: INTEGER): INTEGER -- Position of first occurrence of other at or after start; -- 0 if none. require other_nonvoid: other /= void other_notempty: not other.is_empty start_large_enough: start >= 1 start_small_enough: start <= count ensure correct_place: Result > 0 implies substring (Result, Result + other.count - 1).is_equal (other) fuzzy_index (other: STRING; start: INTEGER; fuzz: INTEGER): INTEGER -- Position of first occurrence of other at or after start -- with 0..fuzz mismatches between the string and other. -- 0 if there are no fuzzy matches require other_exists: other /= void other_not_empty: not other.is_empty start_large_enough: start >= 1 start_small_enough: start <= count acceptable_fuzzy: fuzz <= other.count feature -- Measurement capacity: INTEGER -- Allocated space count: INTEGER -- Actual number of characters making up the string occurrences (c: CHARACTER): INTEGER -- Number of times c appears in the string index_set: INTEGER_INTERVAL -- Range of acceptable indexes ensure then Result.count = count feature -- Comparison is_equal (other: like Current): BOOLEAN -- Is string made of same character sequence as other -- (possibly with a different capacity)? infix "<" (other: like Current): BOOLEAN -- Is string lexicographically lower than other? feature -- Status report Extendible: BOOLEAN is True -- May new items be added? (Answer: yes.) prunable: BOOLEAN -- May items be removed? (Answer: yes.) valid_index (i: INTEGER): BOOLEAN -- Is i within the bounds of the string? Changeable_comparison_criterion: BOOLEAN is False is_integer: BOOLEAN -- Does Current represent an INTEGER? is_real: BOOLEAN -- Does Current represent a REAL? is_double: BOOLEAN -- Does Current represent a DOUBLE? is_boolean: BOOLEAN -- Does Current represent a BOOLEAN? feature -- Element change set (t: like Current; n1, n2: INTEGER) -- Set current string to substring of t from indices n1 -- to n2, or to empty string if no such substring. require argument_not_void: t /= void ensure is_substring: is_equal (t.substring (n1, n2)) copy (other: like Current) -- Reinitialize by copying the characters of other. -- (This is also used by clone.) ensure then new_result_count: count = other.count subcopy (other: like Current; start_pos, end_pos, index_pos: INTEGER) -- Copy characters of other within bounds start_pos and -- end_pos to current string starting at index index_pos. require other_not_void: other /= void valid_start_pos: other.valid_index (start_pos) valid_end_pos: other.valid_index (end_pos) valid_bounds: (start_pos <= end_pos) or (start_pos = end_pos + 1) valid_index_pos: valid_index (index_pos) enough_space: (count - index_pos) >= (end_pos - start_pos) replace_substring (s: like Current; start_pos, end_pos: INTEGER) -- Copy the characters of s to positions -- start_pos .. end_pos. require string_exists: s /= void index_small_enough: end_pos <= count order_respected: start_pos <= end_pos index_large_enough: start_pos > 0 ensure new_count: count = old count + s.count - end_pos + start_pos - 1 replace_substring_all (original, new: like Current) -- Replace every occurence of original with new. require original_exists: original /= void new_exists: new /= void original_not_empty: not original.is_empty replace_blank -- Replace all current characters with blanks. ensure same_size: (count = old count) and (capacity = old capacity) fill_blank -- Fill with capacity blank characters. ensure filled: full same_size: (count = capacity) and (capacity = old capacity) replace_character (c: CHARACTER) -- Replace all current characters with characters all equal to c. ensure same_size: (count = old count) and (capacity = old capacity) fill_character (c: CHARACTER) -- Fill with capacity characters all equal to c. ensure filled: full same_size: (count = capacity) and (capacity = old capacity) head (n: INTEGER) -- Remove all characters except for the first n; -- do nothing if n >= count. require non_negative_argument: n >= 0 ensure new_count: count = n.min (old count) tail (n: INTEGER) -- Remove all characters except for the last n; -- do nothing if n >= count. require non_negative_argument: n >= 0 ensure new_count: count = n.min (old count) left_adjust -- Remove leading whitespace. ensure new_count: (count /= 0) implies ((item (1) /= ' ') and (item (1) /= '%T') and (item (1) /= '%R') and (item (1) /= '%N')) right_adjust -- Remove trailing whitespace. ensure new_count: (count /= 0) implies ((item (count) /= ' ') and (item (count) /= '%T') and (item (count) /= '%R') and (item (count) /= '%N')) share (other: like Current) -- Make current string share the text of other. -- Subsequent changes to the characters of current string -- will also affect other, and conversely. require argument_not_void: other /= void ensure shared_count: other.count = count put (c: CHARACTER; i: INTEGER) -- Replace character at position i by c. precede (c: CHARACTER) -- Add c at front. ensure new_count: count = old count + 1 prepend (s: STRING) -- Prepend a copy of s at front. require argument_not_void: s /= void ensure new_count: count = old count + s.count prepend_boolean (b: BOOLEAN) -- Prepend the string representation of b at front. prepend_character (c: CHARACTER) -- Prepend the string representation of c at front. prepend_double (d: DOUBLE) -- Prepend the string representation of d at front. prepend_integer (i: INTEGER) -- Prepend the string representation of i at front. prepend_real (r: REAL) -- Prepend the string representation of r at front. prepend_string (s: STRING) -- Prepend a copy of s, if not void, at front. append (s: STRING) -- Append a copy of s at end. require argument_not_void: s /= void ensure new_count: count = old count + old s.count infix "+" (s: STRING): STRING -- Append a copy of 's' at the end of a copy of Current, -- Then return the Result. require argument_not_void: s /= void ensure result_exists: Result /= void new_count: Result.count = count + s.count append_string (s: STRING) -- Append a copy of s, if not void, at end. append_integer (i: INTEGER) -- Append the string representation of i at end. append_real (r: REAL) -- Append the string representation of r at end. append_double (d: DOUBLE) -- Append the string representation of d at end. append_character (c: CHARACTER) -- Append c at end. -- Was declared in STRING as synonym of extend. ensure then item_inserted: item (count) = c new_count: count = old count + 1 extend (c: CHARACTER) -- Append c at end. -- Was declared in STRING as synonym of append_character. ensure then item_inserted: item (count) = c new_count: count = old count + 1 append_boolean (b: BOOLEAN) -- Append the string representation of b at end. insert (s: STRING; i: INTEGER) -- Add s to the left of position i in current string. require string_exists: s /= void index_small_enough: i <= count index_large_enough: i > 0 ensure new_count: count = old count + s.count feature -- Removal remove (i: INTEGER) -- Remove i-th character. require index_small_enough: i <= count index_large_enough: i > 0 ensure new_count: count = old count - 1 prune (c: CHARACTER) -- Remove first occurrence of c, if any. require else True prune_all (c: CHARACTER) -- Remove all occurrences of c. require else True ensure then changed_count: count = (old count) - (old occurrences (c)) prune_all_leading (c: CHARACTER) -- Remove all leading occurrences of c. prune_all_trailing (c: CHARACTER) -- Remove all trailing occurrences of c. wipe_out -- Remove all characters. ensure then is_empty: count = 0 empty_capacity: capacity = 0 clear_all -- Reset all characters. ensure is_empty: count = 0 same_capacity: capacity = old capacity feature -- Resizing adapt_size -- Adapt the size to accommodate count characters. resize (newsize: INTEGER) -- Rearrange string so that it can accommodate -- at least newsize characters. -- Do not lose any previously entered character. require new_size_non_negative: newsize >= 0 grow (newsize: INTEGER) -- Ensure that the capacity is at least newsize. require else new_size_non_negative: newsize >= 0 feature -- Conversion left_justify -- Left justify the string using -- the capacity as the width center_justify -- Center justify the string using -- the capacity as the width right_justify -- Right justify the string using -- the capacity as the width character_justify (pivot: CHARACTER; position: INTEGER) -- Justify a string based on a pivot -- and the position it needs to be in -- the final string. -- This will grow the string if necessary -- to get the pivot in the correct place. require valid_position: position <= capacity positive_position: position >= 1 pivot_not_space: pivot /= ' ' not_empty: not is_empty to_lower -- Convert to lower case. to_upper -- Convert to upper case. to_integer: INTEGER -- Integer value; -- for example, when applied to "123", will yield 123 require is_integer: is_integer to_real: REAL -- Real value; -- for example, when applied to "123.0", will yield 123.0 require represents_a_real: is_real to_double: DOUBLE -- "Double" value; -- for example, when applied to "123.0", will yield 123.0 (double) require represents_a_double: is_double to_boolean: BOOLEAN -- Boolean value; -- "True" yields True, "False" yields False -- (case-insensitive) require is_boolean: is_boolean linear_representation: LINEAR [CHARACTER] -- Representation as a linear structure split (a_separator: CHARACTER): LINEAR [STRING] -- Split on a_separator. -- Ignore separators in quotes. ensure Result /= void frozen to_c: ANY -- A reference to a C form of current string. -- Useful only for interfacing with C software. mirrored: like Current -- Mirror image of string; -- result for "Hello world" is "dlrow olleH". ensure same_count: Result.count = count mirror -- Reverse the order of characters. -- "Hello world" -> "dlrow olleH". ensure same_count: count = old count feature -- Duplication substring (n1, n2: INTEGER): like Current -- Copy of substring containing all characters at indices -- between n1 and n2 ensure new_result_count: Result.count = n2 - n1 + 1 or Result.count = 0 multiply (n: INTEGER) -- Duplicate a string within itself -- ("hello").multiply(3) => "hellohellohello" require meaningful_multiplier: n >= 1 feature -- Output out: like Current -- Printable representation invariant extendible: extendible compare_character: not object_comparison index_set_has_same_count: index_set.count = count indexing library: "[ EiffelBase: Library of reusable components for Eiffel. ]" status: "[ Copyright 1986-2001 Interactive Software Engineering (ISE). For ISE customers the original versions are an ISE product covered by the ISE Eiffel license and support agreements. ]" license: "[ EiffelBase may now be used by anyone as FREE SOFTWARE to develop any product, public-domain or commercial, without payment to ISE, under the terms of the ISE Free Eiffel Library License (IFELL) at http://eiffel.com/products/base/license.html. ]" source: "[ Interactive Software Engineering Inc. ISE Building 360 Storke Road, Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Electronic mail <info@eiffel.com> Customer support http://support.eiffel.com ]" info: "[ For latest info see award-winning pages: http://eiffel.com ]" end -- class STRING
Classes Clusters Cluster hierarchy Chart Relations Text Flat Contracts Flat contracts Go to:

-- Generated by ISE Eiffel --
For more details: www.eiffel.com