note description: "Unicode characters" library: "Gobo Eiffel Kernel Library" copyright: "Copyright (c) 2001, Eric Bezault and others" license: "MIT License" date: "$Date: 2016-05-06 19:15:38 +0000 (Fri, 06 May 2016) $" revision: "$Revision: 98678 $" class interface UC_CHARACTER create make_from_character (c: CHARACTER_8) -- Create a new unicode character from Latin-1 character c. ensure code_set: code = c.code make_from_code (a_code: INTEGER_32) -- Create a new unicode character with code a_code. require valid_code: Unicode.valid_code (a_code) ensure code_set: code = a_code feature -- Access code: INTEGER_32 -- Code of unicode character generating_type: TYPE [detachable UC_CHARACTER] -- Type of current object -- (type of which it is a direct instance) -- (from ANY) ensure -- from ANY generating_type_not_void: Result /= Void generator: STRING_8 -- Name of current object's generating class -- (base class of the type of which it is a direct instance) -- (from ANY) ensure -- from ANY generator_not_void: Result /= Void generator_not_empty: not Result.is_empty hash_code: INTEGER_32 -- Hash code value ensure -- from HASHABLE good_hash_value: Result >= 0 Integer_: KL_INTEGER_ROUTINES -- Routines that ought to be in class INTEGER -- (from KL_IMPORTED_INTEGER_ROUTINES) ensure -- from KL_IMPORTED_INTEGER_ROUTINES instance_free: class integer_routines_not_void: Result /= Void Platform: KL_PLATFORM -- Platform-dependent properties -- (from KL_SHARED_PLATFORM) ensure -- from KL_SHARED_PLATFORM instance_free: class platform_not_void: Result /= Void String_: KL_STRING_ROUTINES -- Routines that ought to be in class STRING -- (from KL_IMPORTED_STRING_ROUTINES) ensure -- from KL_IMPORTED_STRING_ROUTINES instance_free: class string_routines_not_void: Result /= Void Unicode: UC_UNICODE_ROUTINES -- Unicode routines -- (from UC_IMPORTED_UNICODE_ROUTINES) ensure -- from UC_IMPORTED_UNICODE_ROUTINES instance_free: class unicode_not_void: Result /= Void feature -- Comparison frozen deep_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void -- or attached to isomorphic object structures? -- (from ANY) ensure -- from ANY instance_free: class shallow_implies_deep: standard_equal (a, b) implies Result both_or_none_void: (a = Void) implies (Result = (b = Void)) same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b)) symmetric: Result implies deep_equal (b, a) frozen equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached -- to objects considered equal? -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.is_equal (b)) frozen is_deep_equal (other: UC_CHARACTER): BOOLEAN -- Are Current and other attached to isomorphic object structures? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY shallow_implies_deep: standard_is_equal (other) implies Result same_type: Result implies same_type (other) symmetric: Result implies other.is_deep_equal (Current) is_equal (other: UC_CHARACTER): BOOLEAN -- Is other attached to an object of the same type -- as current object and identical to it? -- (from COMPARABLE) require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result ensure then -- from COMPARABLE trichotomy: Result = (not (Current < other) and not (other < Current)) is_greater alias ">" (other: UC_CHARACTER): BOOLEAN -- Is current object greater than other? -- (from COMPARABLE) require -- from PART_COMPARABLE other_exists: other /= Void ensure then -- from COMPARABLE definition: Result = (other < Current) is_greater_equal alias ">=" (other: UC_CHARACTER): BOOLEAN -- Is current object greater than or equal to other? -- (from COMPARABLE) require -- from PART_COMPARABLE other_exists: other /= Void ensure then -- from COMPARABLE definition: Result = (other <= Current) is_less alias "<" (other: like Current): BOOLEAN -- Is current object less than other? require -- from PART_COMPARABLE other_exists: other /= Void ensure then -- from COMPARABLE asymmetric: Result implies not (other < Current) is_less_equal alias "<=" (other: UC_CHARACTER): BOOLEAN -- Is current object less than or equal to other? -- (from COMPARABLE) require -- from PART_COMPARABLE other_exists: other /= Void ensure then -- from COMPARABLE definition: Result = ((Current < other) or (Current ~ other)) max (other: UC_CHARACTER): UC_CHARACTER -- The greater of current object and other -- (from COMPARABLE) require -- from COMPARABLE other_exists: other /= Void ensure -- from COMPARABLE current_if_not_smaller: Current >= other implies Result = Current other_if_smaller: Current < other implies Result = other min (other: UC_CHARACTER): UC_CHARACTER -- The smaller of current object and other -- (from COMPARABLE) require -- from COMPARABLE other_exists: other /= Void ensure -- from COMPARABLE current_if_not_greater: Current <= other implies Result = Current other_if_greater: Current > other implies Result = other frozen standard_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached to -- field-by-field identical objects of the same type? -- Always uses default object comparison criterion. -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.standard_is_equal (b)) frozen standard_is_equal (other: UC_CHARACTER): BOOLEAN -- Is other attached to an object of the same type -- as current object, and field-by-field identical to it? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY same_type: Result implies same_type (other) symmetric: Result implies other.standard_is_equal (Current) three_way_comparison (other: UC_CHARACTER): INTEGER_32 -- If current object equal to other, 0; -- if smaller, -1; if greater, 1 -- (from COMPARABLE) require -- from COMPARABLE other_exists: other /= Void ensure -- from COMPARABLE equal_zero: (Result = 0) = (Current ~ other) smaller_negative: (Result = -1) = (Current < other) greater_positive: (Result = 1) = (Current > other) feature -- Status report conforms_to (other: ANY): BOOLEAN -- Does type of current object conform to type -- of other (as per Eiffel: The Language, chapter 13)? -- (from ANY) require -- from ANY other_not_void: other /= Void is_ascii: BOOLEAN -- Is current character an ASCII character? ensure definition: Result = Unicode.valid_ascii_code (code) is_hashable: BOOLEAN -- May current object be hashed? -- (True by default.) -- (from HASHABLE) same_type (other: ANY): BOOLEAN -- Is type of current object identical to type of other? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY definition: Result = (conforms_to (other) and other.conforms_to (Current)) feature -- Conversion as_lower: like Current -- Lowercase value of current character -- (Create a new object at each call.) -- Was declared in UC_CHARACTER as synonym of to_lower. ensure to_lower_not_void: Result /= Void as_upper: like Current -- Uppercase value of current character -- (Create a new object at each call.) -- Was declared in UC_CHARACTER as synonym of to_upper. ensure to_upper_not_void: Result /= Void to_character: CHARACTER_8 -- Character with code code require valid_code: code <= Platform.Maximum_character_code ensure code_set: Result.code = code to_lower: like Current -- Lowercase value of current character -- (Create a new object at each call.) -- Was declared in UC_CHARACTER as synonym of as_lower. ensure to_lower_not_void: Result /= Void to_upper: like Current -- Uppercase value of current character -- (Create a new object at each call.) -- Was declared in UC_CHARACTER as synonym of as_upper. ensure to_upper_not_void: Result /= Void feature -- Duplication copy (other: UC_CHARACTER) -- Update current object using fields of object attached -- to other, so as to yield equal objects. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_equal: Current ~ other frozen deep_copy (other: UC_CHARACTER) -- Effect equivalent to that of: -- copy (other . deep_twin) -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY deep_equal: deep_equal (Current, other) frozen deep_twin: UC_CHARACTER -- New object structure recursively duplicated from Current. -- (from ANY) ensure -- from ANY deep_twin_not_void: Result /= Void deep_equal: deep_equal (Current, Result) frozen standard_copy (other: UC_CHARACTER) -- Copy every field of other onto corresponding field -- of current object. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_standard_equal: standard_is_equal (other) frozen standard_twin: UC_CHARACTER -- New object field-by-field identical to other. -- Always uses default copying semantics. -- (from ANY) ensure -- from ANY standard_twin_not_void: Result /= Void equal: standard_equal (Result, Current) frozen twin: UC_CHARACTER -- New object equal to Current -- twin calls copy; to change copying/twinning semantics, redefine copy. -- (from ANY) ensure -- from ANY twin_not_void: Result /= Void is_equal: Result ~ Current feature -- Basic operations frozen default: detachable UC_CHARACTER -- Default value of object's type -- (from ANY) frozen default_pointer: POINTER -- Default value of type POINTER -- (Avoid the need to write p.default for -- some p of type POINTER.) -- (from ANY) ensure -- from ANY instance_free: class default_rescue -- Process exception for routines with no Rescue clause. -- (Default: do nothing.) -- (from ANY) frozen do_nothing -- Execute a null action. -- (from ANY) ensure -- from ANY instance_free: class feature -- Output Io: STD_FILES -- Handle to standard file setup -- (from ANY) ensure -- from ANY instance_free: class io_not_void: Result /= Void out: STRING_8 -- New STRING containing terse printable representation -- of current character; Non-ascii characters are represented -- with the %/code/ convention. ensure -- from ANY out_not_void: Result /= Void print (o: detachable ANY) -- Write terse external representation of o -- on standard output. -- (from ANY) ensure -- from ANY instance_free: class frozen tagged_out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY tagged_out_not_void: Result /= Void feature -- Platform Operating_environment: OPERATING_ENVIRONMENT -- Objects available from the operating system -- (from ANY) ensure -- from ANY instance_free: class operating_environment_not_void: Result /= Void invariant valid_code: Unicode.valid_code (code) -- from COMPARABLE irreflexive_comparison: not (Current < Current) -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) end -- class UC_CHARACTER
Generated by ISE EiffelStudio