Changeset 32


Ignore:
Timestamp:
Jun 24, 2010, 4:18:55 PM (14 years ago)
Author:
george
Message:
  • Přidáno: Třída TSubStream pro transparentní mapování podproudu do jiného proudu.
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • ObjectBaseTypes/Level 1/UObjectByte.pas

    r14 r32  
    44
    55uses
    6   Classes, SysUtils, UObjectTypeBase, UInterfacedBits, UObjectBoolean;
     6  Classes, SysUtils, UObjectTypeBase, UObjectBoolean;
    77
    88type
    99  TByte = class(TInterfacedObject, IAssignable, IOrderable, IComparable)
    10   private
    11     function GetAsBits: TInterfacedBits;
    12     procedure SetAsBits(const Value: TInterfacedBits);
    1310  public
    1411    Value: Byte;
     
    1815    function Max(Operand1, Operand2: IOrderable): IOrderable;
    1916    function Min(Operand1, Operand2: IOrderable): IOrderable;
    20     property AsBits: TInterfacedBits read GetAsBits write SetAsBits;
    2117    function EqualTo(Operand: IComparable): TBoolean;
    2218    function Predecessor: IOrderable;
     
    3935begin
    4036
    41 end;
    42 
    43 function TByte.GetAsBits: TInterfacedBits;
    44 var
    45   I: Integer;
    46 begin
    47   Result := TInterfacedBits.Create;
    48   Result.Size := 8;
    49   for I := 0 to Result.Size - 1 do
    50     Result[I] := ((Value shr I) and 1) = 1;
    5137end;
    5238
     
    8672end;
    8773
    88 procedure TByte.SetAsBits(const Value: TInterfacedBits);
    89 var
    90   Count: Integer;
    91   I: Integer;
    92 begin
    93   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 do
    98     Self.Value := Self.Value or (Ord(Value[I]) shl I);
    99 end;
    100 
    10174function TByte.Successor: IOrderable;
    10275begin
  • ObjectBaseTypes/Level 1/UObjectTypeBase.pas

    r14 r32  
    1818
    1919  IStreamable = interface
    20     function GetStream: TStream;
     20    procedure GetStream(Stream: TStream);
    2121    procedure SetStrem(Stream: TStream);
    2222  end;
  • ObjectBaseTypes/UMainForm.dfm

    r3 r32  
    11object MainForm: TMainForm
    2   Left = 0
    3   Top = 0
     2  Left = 451
     3  Height = 317
     4  Top = 192
     5  Width = 484
    46  Caption = 'MainForm'
    57  ClientHeight = 317
    68  ClientWidth = 484
    7   Color = clBtnFace
    8   Font.Charset = DEFAULT_CHARSET
    9   Font.Color = clWindowText
    109  Font.Height = -11
    1110  Font.Name = 'Tahoma'
    12   Font.Style = []
    13   OldCreateOrder = False
    14   PixelsPerInch = 96
    15   TextHeight = 13
     11  LCLVersion = '0.9.29'
    1612  object Button1: TButton
    1713    Left = 8
     14    Height = 25
    1815    Top = 8
    1916    Width = 89
    20     Height = 25
    2117    Caption = 'Test TBoolean'
     18    OnClick = Button1Click
    2219    TabOrder = 0
    23     OnClick = Button1Click
    2420  end
    2521  object Memo1: TMemo
    2622    Left = 120
     23    Height = 289
    2724    Top = 8
    2825    Width = 353
    29     Height = 289
    3026    TabOrder = 1
    3127  end
    3228  object Button2: TButton
    3329    Left = 8
     30    Height = 25
    3431    Top = 39
    3532    Width = 89
    36     Height = 25
    3733    Caption = 'Test TByte'
    3834    TabOrder = 2
     
    4036  object Button3: TButton
    4137    Left = 8
     38    Height = 25
    4239    Top = 70
    4340    Width = 89
    44     Height = 25
    4541    Caption = 'Test TInteger'
    4642    TabOrder = 3
     
    4844  object Button4: TButton
    4945    Left = 8
     46    Height = 25
    5047    Top = 101
    5148    Width = 89
    52     Height = 25
    5349    Caption = 'Test TString'
     50    OnClick = Button4Click
    5451    TabOrder = 4
    55     OnClick = Button4Click
    5652  end
    5753end
Note: See TracChangeset for help on using the changeset viewer.