NAME

GDPR::IAB::TCFv2::BitField - Transparency & Consent String version 2 bitfield parser

SYNOPSIS

my $data = unpack "B*", decode_base64url('tcf v2 consent string base64 encoded');

my $max_id_consent = << get 16 bits from $data offset 213 >>

my $bit_field = GDPR::IAB::TCFv2::BitField->Parse(
    data          => $data,
    offset     => 230,                   # offset for vendor consents
    max_id => $max_id_consent,
);

if $bit_field->contains(284) { ... }

CONSTRUCTOR

Constructor Parse receive 3 parameters: data (as sequence of bits), start bit offset and vendor bits required (max vendor id).

Will die if any parameter is missing.

Will die if data does not contain all bits required.

Will return an array of two elements: the object itself and the next offset.

METHODS

contains

Return the vendor id bit status (if enable or not) from the bit field. Will return false if id is bigger than max vendor id.

my $ok = $bit_field->contains(284);

max_id

Returns the max vendor id.

all

Returns an array of all vendors mapped with the bit enabled.