Changeset 32 for ObjectBaseTypes/Level 1


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.
Location:
ObjectBaseTypes/Level 1
Files:
2 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;
Note: See TracChangeset for help on using the changeset viewer.