home *** CD-ROM | disk | FTP | other *** search
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- class CHARACTER_REF
-
- inherit COMPARABLE redefine infix "<", compare end;
-
- creation {ANY}
- make
-
- feature {ANY}
-
- item: CHARACTER;
-
- make(value: CHARACTER) is
- do
- item := value;
- end;
-
- infix "<" (other: like Current): BOOLEAN is
- -- Is Current less than `other'?
- do
- Result := item < other.item
- end;
-
- compare (other: like Current) : INTEGER is
- -- Compare Current with `other'.
- -- '<' <==> Result < 0
- -- '>' <==> Result > 0
- -- Otherwise Result = 0
- do
- Result := code - other.code
- end;
-
- code: INTEGER is
- -- ASCII code of Current
- do
- Result := item.code
- end;
-
- to_upper: like Current is
- -- Conversion of Current to upper case
- do
- !!Result.make (item.to_upper)
- end;
-
- to_lower: like Current is
- -- Conversion of Current to lower case
- do
- !!Result.make (item.to_lower)
- end;
-
- end -- CHARACTER_REF
-