diff --git a/doomsday/libdeng2/include/de/data/bitfield.h b/doomsday/libdeng2/include/de/data/bitfield.h index b02f364de7..d8a2f82010 100644 --- a/doomsday/libdeng2/include/de/data/bitfield.h +++ b/doomsday/libdeng2/include/de/data/bitfield.h @@ -48,6 +48,8 @@ class DENG2_PUBLIC BitField BitField(BitField const &other); BitField(Block const &data); + BitField &operator = (BitField const &other); + /** * Removes all the elements and the data contained in the bit field. */ @@ -79,6 +81,11 @@ class DENG2_PUBLIC BitField */ int bitCount() const; + /** + * Returns the identifiers of all elements. + */ + Ids elementIds() const; + /** * Returns the packed data as an array of bytes. Only bitCount() bits are * valid; the highest bits of the last byte may be unused (and zero). diff --git a/doomsday/libdeng2/src/data/bitfield.cpp b/doomsday/libdeng2/src/data/bitfield.cpp index 1558f0801a..9aef844a68 100644 --- a/doomsday/libdeng2/src/data/bitfield.cpp +++ b/doomsday/libdeng2/src/data/bitfield.cpp @@ -128,6 +128,15 @@ BitField::BitField(Block const &data) : d(new Instance(this)) d->packed = data; } +BitField &BitField::operator = (BitField const &other) +{ + d->elements = other.d->elements; + d->totalBits = other.d->totalBits; + d->lookup = other.d->lookup; + d->packed = other.d->packed; + return *this; +} + void BitField::clear() { d->packed.clear(); @@ -200,6 +209,16 @@ int BitField::bitCount() const return d->totalBits; } +BitField::Ids BitField::elementIds() const +{ + Ids ids; + foreach(Id id, d->elements.keys()) + { + ids.insert(id); + } + return ids; +} + Block BitField::data() const { return d->packed;