note
	description: "References to objects containing a unicode character value"
	library: "Free implementation of ELKS library"
	status: "See notice at end of class."
	legal: "See notice at end of class."
	date: "$Date: 2020-04-15 18:06:04 +0000 (Wed, 15 Apr 2020) $"
	revision: "$Revision: 104046 $"

class interface
	CHARACTER_32_REF

create 
	default_create

feature -- Access

	item: CHARACTER_32
			-- Unicode character value

	hash_code: INTEGER_32
			-- Hash code value

	natural_32_code: NATURAL_32
			-- Associated natural value
		ensure
			natural_32_code_in_range: Result >= Min_value and Result <= Max_value

	Min_value: NATURAL_32 = 0

	Max_value: NATURAL_32 = 4294967295
			-- Bounds for integer representation of CHARACTER_32

	Max_unicode_value: NATURAL_32 = 1114109
			-- Maximum Unicode characters.
	
feature -- Comparison

	is_less alias "<" (other: like Current): BOOLEAN
			-- Is other greater than current character?
		ensure then
			definition: Result = (natural_32_code < other.natural_32_code)

	is_equal (other: like Current): BOOLEAN
			-- Is other attached to an object of the same type
			-- as current object and identical to it?
	
feature -- Basic routines

	plus alias "+" (incr: NATURAL_32): CHARACTER_32
			-- Add incr to the code of item.
		require
			valid_increment: (item.natural_32_code.to_natural_64 + incr.to_natural_64).is_valid_character_32_code
		ensure
			valid_result: Result |-| item = incr.to_integer_64

	minus alias "-" alias "" (decr: NATURAL_32): CHARACTER_32
			-- Subtract decr from the code of item.
		require
			valid_decrement: (item.natural_32_code.to_integer_64 - decr.to_integer_64).is_valid_character_32_code
		ensure
			valid_result: item |-| Result = decr.to_integer_64

	difference alias "|-|" (other: CHARACTER_32): INTEGER_64
			-- Difference between the codes of item and other.
		ensure
			valid_non_negative_result: Result >= 0 implies ((other + Result.to_natural_32) = item)
			valid_negative_result: Result < 0 implies (other = (item + Result.to_natural_32))

	next: CHARACTER_32
			-- Next character.
		require
			valid_character: (item.natural_32_code.to_natural_64 + 1).is_valid_character_32_code
		ensure
			valid_result: Result |-| item = 1

	previous: CHARACTER_32
			-- Previous character.
		require
			valid_character: (item.natural_32_code.to_natural_64 - 1).is_valid_character_32_code
		ensure
			valid_result: Result |-| item = -1
	
feature -- Element change

	set_item (c: CHARACTER_32)
			-- Make c the item value.
	
feature -- Output

	out: STRING_8
			-- Printable representation of wide character.
	
feature -- Conversion

	to_reference: CHARACTER_32_REF
			-- Associated reference of Current.
		ensure
			to_reference_not_void: Result /= Void

	to_character_8: CHARACTER_8
			-- Convert current to CHARACTER_8.
		require
			is_character_8_compatible: is_character_8

	to_character_32: CHARACTER_32
			-- Convert current to CHARACTER_32.

	as_upper: CHARACTER_32
			-- Uppercase value of item.
			-- Returns item if not is_lower.
			-- Was declared in CHARACTER_32_REF as synonym of upper.

	upper: CHARACTER_32
			-- Uppercase value of item.
			-- Returns item if not is_lower.
			-- Was declared in CHARACTER_32_REF as synonym of as_upper.

	as_lower: CHARACTER_32
			-- Lowercase value of item.
			-- Returns item if not is_upper.
			-- Was declared in CHARACTER_32_REF as synonym of lower.

	lower: CHARACTER_32
			-- Lowercase value of item.
			-- Returns item if not is_upper.
			-- Was declared in CHARACTER_32_REF as synonym of as_lower.
	
feature -- Status report

	is_character_8: BOOLEAN
			-- Can current be represented on a CHARACTER_8?

	is_alpha: BOOLEAN
			-- Is item alphabetic?
			-- Alphabetic is is_upper or is_lower.

	is_upper: BOOLEAN
			-- Is item uppercase?

	is_lower: BOOLEAN
			-- Is item lowercase?

	is_digit: BOOLEAN
			-- Is item a decimal digit as expected for ASCII characters?
			-- A digit is one of 0123456789.

	is_unicode_digit: BOOLEAN
			-- Is item a decimal digit as expected for Unicode characters?

	is_hexa_digit: BOOLEAN
			-- Is item a hexadecimal digit as expected for ASCII characters?
			-- A digit is one of 0123456789ABCDEFabcedf.

	is_space: BOOLEAN
			-- Is item a white space?

	is_punctuation: BOOLEAN
			-- Is item a punctuation?

	is_alpha_numeric: BOOLEAN
			-- Is item alphabetic or a digit?

	is_control: BOOLEAN
			-- Is item a control character?
	
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 CHARACTER_32_REF

Generated by ISE EiffelStudio