note description: "[ Platform specific encoding of Unicode strings. By default, UTF-8 on unix or UTF-16 on Windows. Mixed-encoding consideration ============================ Most operating systems have conventions for strings that are incompatible with Unicode. On UNIX, a string is just a null-terminated byte sequence, it does not follow any specific encoding. Usually the locale setting enables you to see the string the way you expect. On Windows, the sequence of names is made of null-terminated UTF-16 code unit sequence. Windows does not guarantee that the sequence is actually a valid UTF-16 sequence. In other words, when there is an invalid UTF-8 encoding on UNIX, or an invalid UTF-16 encoding on Windows, the string is not directly representable as a Unicode string. To make it possible to create and store strings in a textually representable form, the query string will create an encoded representation that can be then later used in make to create a NATIVE_STRING equivalent to the original string. The encoding is described in UTF_CONVERTER's note clause and is a fourth variant of the recommended practice for replacement characters in Unicode (see http://www.unicode.org/review/pr-121.html). ]" date: "$Date: 2020-05-19 14:32:38 +0000 (Tue, 19 May 2020) $" revision: "$Revision: 104260 $" class interface NATIVE_STRING create make, make_empty, make_from_pointer, make_from_raw_string feature -- Access raw_string: STRING_8 -- Sequence of bytes representing Current. string: STRING_32 -- Representation of Current up to the first null character. substring (start_pos, end_pos: INTEGER_32): STRING_32 -- Copy of substring containing all code units at indices -- between start_pos and 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 // unit_size) ensure susbstring_not_void: Result /= Void item: POINTER -- Get pointer to allocated area. ensure item_not_null: Result /= default_pointer managed_data: MANAGED_POINTER -- Hold data of Current. feature -- Status Report is_empty: BOOLEAN -- Is current empty? feature -- Measurement capacity: INTEGER_32 -- Number of bytes in Current. bytes_count: INTEGER_32 -- Number of bytes used by Current not including the null terminating character. ensure bytes_count_non_negative: Result >= 0 unit_count: INTEGER_32 -- Number of units used by Current not including the null terminating unit. unit_size: INTEGER_32 -- Size in bytes of a unit for storage. feature -- Comparison is_equal (other: like Current): BOOLEAN -- Is content of string identical to content of string other? feature -- Element change set_string (a_string: READABLE_STRING_GENERAL) -- Set string with a_string treated as a sequence of Unicode characters. require a_string_not_void: a_string /= Void set_substring (a_string: READABLE_STRING_GENERAL; start_pos, end_pos: INTEGER_32) -- Set string with a subset of a_string from a_start_pos index to end_pos index. 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 set_shared_from_pointer (a_ptr: POINTER) -- New instance sharing a_ptr. require a_ptr_not_null: a_ptr /= default_pointer set_shared_from_pointer_and_count (a_ptr: POINTER; a_length: INTEGER_32) -- New instance sharing a_ptr of a_length byte. Space for an additional -- null terminating code unit is added to managed_data. require a_ptr_not_null: a_ptr /= default_pointer a_length_non_negative: a_length >= 0 a_length_valid: (a_length \\ unit_size) = 0 invariant little_endian_windows: {PLATFORM}.is_windows implies Platform.Is_little_endian even_count_on_windows: {PLATFORM}.is_windows implies managed_data.count \\ unit_size = 0 note copyright: "Copyright (c) 1984-2020, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class NATIVE_STRING
Generated by ISE EiffelStudio