/[eiffelstudio]/FreeELKS/trunk/library/kernel/character_32_ref.e
ViewVC logotype

Contents of /FreeELKS/trunk/library/kernel/character_32_ref.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 91477 - (show annotations)
Sun Jan 14 09:47:13 2007 UTC (13 years ago) by ericb
File size: 3260 byte(s)
Synchronized with ISE 6.0.65740
1 indexing
2 description: "References to objects containing a unicode character value"
3 library: "Free implementation of ELKS library"
4 copyright: "Copyright (c) 1986-2006, Eiffel Software and others"
5 license: "Eiffel Forum License v2 (see forum.txt)"
6 date: "$Date$"
7 revision: "$Revision$"
8
9 class
10 CHARACTER_32_REF
11
12 inherit
13 COMPARABLE
14 redefine
15 is_equal, out
16 end
17
18 HASHABLE
19 redefine
20 is_hashable, is_equal, out
21 end
22
23 REFACTORING_HELPER
24 redefine
25 is_equal, out
26 end
27
28 feature -- Access
29
30 item: CHARACTER_32 is
31 -- Unicode character value
32 external
33 "built_in"
34 end
35
36 code: INTEGER is
37 -- Associated integer value
38 do
39 Result := item.code
40 end
41
42 hash_code: INTEGER is
43 -- Hash code value
44 do
45 Result := code
46 end
47
48 natural_32_code: NATURAL_32 is
49 -- Associated integer value
50 do
51 Result := item.natural_32_code
52 end
53
54 Min_value: NATURAL_32 is 0
55 Max_value: NATURAL_32 is 4294967295
56 -- Bounds for integer representation of CHARACTER_32
57
58 feature -- Status report
59
60 is_hashable: BOOLEAN is True
61 -- May current object be hashed?
62
63 is_space: BOOLEAN is
64 -- Is `item' a white space?
65 require
66 is_character_8_compatible: is_character_8
67 do
68 Result := to_character_8.is_space
69 end
70
71 is_character_8: BOOLEAN is
72 -- Can current be represented on a CHARACTER_8?
73 do
74 Result := natural_32_code <= {CHARACTER_8}.max_value.to_natural_32
75 end
76
77 feature -- Comparison
78
79 infix "<" (other: like Current): BOOLEAN is
80 -- Is `other' greater than current character?
81 do
82 Result := code < other.code
83 ensure then
84 definition: Result = (code < other.code)
85 end
86
87 is_equal (other: like Current): BOOLEAN is
88 -- Is `other' attached to an object of the same type
89 -- as current object and identical to it?
90 do
91 Result := other.item = item
92 end
93
94 feature -- Element change
95
96 set_item (c: CHARACTER_32) is
97 -- Make `c' the `item' value.
98 external
99 "built_in"
100 end
101
102 feature -- Output
103
104 out: STRING is
105 -- Printable representation of wide character
106 do
107 create Result.make (6)
108 Result.append_character ('U')
109 Result.append_character ('+')
110 Result.append_string (code.to_hex_string)
111 end
112
113 feature {NONE} -- Initialization
114
115 make_from_reference (v: CHARACTER_32_REF) is
116 -- Initialize `Current' with `v.item'.
117 require
118 v_not_void: v /= Void
119 do
120 set_item (v)
121 ensure
122 item_set: item = v.item
123 end
124
125 feature -- Conversion
126
127 to_reference: CHARACTER_32_REF is
128 -- Associated reference of Current
129 do
130 create Result
131 Result.set_item (item)
132 ensure
133 to_reference_not_void: Result /= Void
134 end
135
136 to_character_8: CHARACTER_8 is
137 -- Convert current to CHARACTER_8
138 require
139 is_character_8_compatible: is_character_8
140 do
141 Result := item.to_character_8
142 end
143
144 to_character_32: CHARACTER_32 is
145 -- Convert current to CHARACTER_32
146 do
147 Result := item
148 end
149
150 as_upper, upper: CHARACTER_32 is
151 -- Uppercase value of `item'
152 -- Returns `item' if not `is_lower'
153 require
154 is_character_8_compatible: is_character_8
155 do
156 Result := to_character_8.upper
157 end
158
159 as_lower, lower: CHARACTER_32 is
160 -- Lowercase value of `item'
161 -- Returns `item' if not `is_upper'
162 require
163 is_character_8_compatible: is_character_8
164 do
165 Result := to_character_8.lower
166 end
167
168 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23