artdaq_node_server  v1_00_09
 All Classes Namespaces Files Variables Pages
XMLText.js
1 // Generated by CoffeeScript 1.9.1
2 (function() {
3  var XMLNode, XMLText, create,
4  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
5  hasProp = {}.hasOwnProperty;
6 
7  create = require('lodash/create');
8 
9  XMLNode = require('./XMLNode');
10 
11  module.exports = XMLText = (function(superClass) {
12  extend(XMLText, superClass);
13 
14  function XMLText(parent, text) {
15  XMLText.__super__.constructor.call(this, parent);
16  if (text == null) {
17  throw new Error("Missing element text");
18  }
19  this.value = this.stringify.eleText(text);
20  }
21 
22  XMLText.prototype.clone = function() {
23  return create(XMLText.prototype, this);
24  };
25 
26  XMLText.prototype.toString = function(options, level) {
27  var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
28  pretty = (options != null ? options.pretty : void 0) || false;
29  indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
30  offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
31  newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
32  level || (level = 0);
33  space = new Array(level + offset + 1).join(indent);
34  r = '';
35  if (pretty) {
36  r += space;
37  }
38  r += this.value;
39  if (pretty) {
40  r += newline;
41  }
42  return r;
43  };
44 
45  return XMLText;
46 
47  })(XMLNode);
48 
49 }).call(this);