Changeset 32 for ObjectBaseTypes
- Timestamp:
- Jun 24, 2010, 4:18:55 PM (14 years ago)
- Location:
- ObjectBaseTypes
- Files:
-
- 3 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; -
ObjectBaseTypes/UMainForm.dfm
r3 r32 1 1 object MainForm: TMainForm 2 Left = 0 3 Top = 0 2 Left = 451 3 Height = 317 4 Top = 192 5 Width = 484 4 6 Caption = 'MainForm' 5 7 ClientHeight = 317 6 8 ClientWidth = 484 7 Color = clBtnFace8 Font.Charset = DEFAULT_CHARSET9 Font.Color = clWindowText10 9 Font.Height = -11 11 10 Font.Name = 'Tahoma' 12 Font.Style = [] 13 OldCreateOrder = False 14 PixelsPerInch = 96 15 TextHeight = 13 11 LCLVersion = '0.9.29' 16 12 object Button1: TButton 17 13 Left = 8 14 Height = 25 18 15 Top = 8 19 16 Width = 89 20 Height = 2521 17 Caption = 'Test TBoolean' 18 OnClick = Button1Click 22 19 TabOrder = 0 23 OnClick = Button1Click24 20 end 25 21 object Memo1: TMemo 26 22 Left = 120 23 Height = 289 27 24 Top = 8 28 25 Width = 353 29 Height = 28930 26 TabOrder = 1 31 27 end 32 28 object Button2: TButton 33 29 Left = 8 30 Height = 25 34 31 Top = 39 35 32 Width = 89 36 Height = 2537 33 Caption = 'Test TByte' 38 34 TabOrder = 2 … … 40 36 object Button3: TButton 41 37 Left = 8 38 Height = 25 42 39 Top = 70 43 40 Width = 89 44 Height = 2545 41 Caption = 'Test TInteger' 46 42 TabOrder = 3 … … 48 44 object Button4: TButton 49 45 Left = 8 46 Height = 25 50 47 Top = 101 51 48 Width = 89 52 Height = 2553 49 Caption = 'Test TString' 50 OnClick = Button4Click 54 51 TabOrder = 4 55 OnClick = Button4Click56 52 end 57 53 end
Note:
See TracChangeset
for help on using the changeset viewer.