Code coverage report for src/out_description.js

Statements: 100% (12 / 12)      Branches: 100% (0 / 0)      Functions: 100% (6 / 6)      Lines: 100% (12 / 12)      Ignored: none     

All files » src/ » out_description.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 351           1 44 44     1   37       27       25       27       6 6       1
var Types = require('./types.js');
/**
 * A class which unpacks an object when passed to its .serialize function
 * @class OutDescription
 * @constructor
 */
var OutDescription = function () {
    this._target = null;
    this._bitStream = null;
};
 
OutDescription.prototype = {
    uint: function (name, bits) {
        this._target[name] = this._bitStream.readUInt(bits);
    },
 
    sint: function (name, bits) {
        this._target[name] = this._bitStream.readSInt(bits);
    },
 
    float: function (name, bits) {
        this._target[name] = this._bitStream.readFloat(bits);
    },
 
    string: function (name) {
        this._target[name] = this._bitStream.readString();
    },
 
    any: function (name, bits) {
        var type = this._bitStream.readUInt(Types.bitsNeeded);
        this[Types.fromValue[type]](name, bits);
    }
};
 
module.exports = OutDescription;