Rabbitmq client for delphi XE——part1

Rabbitmq client for delphi XE——part1

https://stackoverflow.com/questions/18220257/amqp-content-header-payload-structure

procedure TAMQPMessageProperties.LoadFromStream(AStream: TStream);
var
Flags: UInt16;
begin
AStream.ReadUInt16( Flags );
if Flags and $8000 = $8000 then FContentType.LoadFromStream( AStream );
if Flags and $4000 = $4000 then FContentEncoding.LoadFromStream( AStream );
if Flags and $2000 = $2000 then FApplicationHeaders.LoadFromStream( AStream );
if Flags and $1000 = $1000 then FDeliveryMode.LoadFromStream( AStream );
if Flags and $0800 = $0800 then FPriority.LoadFromStream( AStream );
if Flags and $0400 = $0400 then FCorrelationID.LoadFromStream( AStream );
if Flags and $0200 = $0200 then FReplyTo.LoadFromStream( AStream );
if Flags and $0100 = $0100 then FExpiration.LoadFromStream( AStream );
if Flags and $0080 = $0080 then FMessageID.LoadFromStream( AStream );
if Flags and $0040 = $0040 then FTimestamp.LoadFromStream( AStream );
if Flags and $0020 = $0020 then FType.LoadFromStream( AStream );
if Flags and $0010 = $0010 then FUserID.LoadFromStream( AStream );
if Flags and $0008 = $0008 then FAppID.LoadFromStream( AStream );
if Flags and $0004 = $0004 then FReserved.LoadFromStream( AStream );

end;

$8000 is represented by a binary of 1000 0000 0000 0000, and the C++ syntax is 15<<1, moving 15 bits from right to left.
The $4000 is expressed in binary form as 0100 0000 0000 0000 , and the C++ syntax is 14<<1, which moves 14 bits from right to left. The rest of the analogy.
https://stackoverflow.com/questions/18220257/amqp-content-header-payload-structure

Comments