Skip to content
Ron Hashimoto edited this page Aug 31, 2016 · 5 revisions

Flags represents a bit field.

Usage

import Flags from 'dripcap/flags';

class FieldFlags extends Flags {
  constructor(value) {
    let table = {
      'Reserved': 0x1,
      'Don\'t Fragment': 0x2,
      'More Fragments': 0x4,
    };
    super(table, value);
  }

  toMsgpack() {
    return [ this.value ];
  }
}

let field = new FieldFlags(0x1);

Reference

Methods

#constructor (Object table, Any value) -> Flags

Constructs an Flags from the table and the value.

#equals (Flags flags) -> Boolean

Returns true if this and the given Flags has the same value.

#toString () -> String

Returns a string representing the flags.

#toJSON () -> String

JSON serializer interface.

#toMsgpack () -> Array

MessagePack serializer interface.