Changeset 32 for ObjectBaseTypes/Level 1
- Timestamp:
- Jun 24, 2010, 4:18:55 PM (14 years ago)
- Location:
- ObjectBaseTypes/Level 1
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ObjectBaseTypes/Level 1/UObjectByte.pas
r14 r32 4 4 5 5 uses 6 Classes, SysUtils, UObjectTypeBase, U InterfacedBits, UObjectBoolean;6 Classes, SysUtils, UObjectTypeBase, UObjectBoolean; 7 7 8 8 type 9 9 TByte = class(TInterfacedObject, IAssignable, IOrderable, IComparable) 10 private11 function GetAsBits: TInterfacedBits;12 procedure SetAsBits(const Value: TInterfacedBits);13 10 public 14 11 Value: Byte; … … 18 15 function Max(Operand1, Operand2: IOrderable): IOrderable; 19 16 function Min(Operand1, Operand2: IOrderable): IOrderable; 20 property AsBits: TInterfacedBits read GetAsBits write SetAsBits;21 17 function EqualTo(Operand: IComparable): TBoolean; 22 18 function Predecessor: IOrderable; … … 39 35 begin 40 36 41 end;42 43 function TByte.GetAsBits: TInterfacedBits;44 var45 I: Integer;46 begin47 Result := TInterfacedBits.Create;48 Result.Size := 8;49 for I := 0 to Result.Size - 1 do50 Result[I] := ((Value shr I) and 1) = 1;51 37 end; 52 38 … … 86 72 end; 87 73 88 procedure TByte.SetAsBits(const Value: TInterfacedBits);89 var90 Count: Integer;91 I: Integer;92 begin93 Count := 8;94 if Value.Size > 8 then Count := 8;95 if Value.Size < 8 then Count := Value.Size;96 Self.Value := 0;97 for I := 0 to Count - 1 do98 Self.Value := Self.Value or (Ord(Value[I]) shl I);99 end;100 101 74 function TByte.Successor: IOrderable; 102 75 begin -
ObjectBaseTypes/Level 1/UObjectTypeBase.pas
r14 r32 18 18 19 19 IStreamable = interface 20 function GetStream: TStream;20 procedure GetStream(Stream: TStream); 21 21 procedure SetStrem(Stream: TStream); 22 22 end;
Note:
See TracChangeset
for help on using the changeset viewer.