1 /* ************************************************************************
3 qooxdoo - the new era of web development
8 2004-2007 1&1 Internet AG, Germany, http://www.1and1.org
11 LGPL: http://www.gnu.org/licenses/lgpl.html
12 EPL: http://www.eclipse.org/org/documents/epl-v10.php
13 See the LICENSE file in the project's top-level directory for details.
16 * Sebastian Werner (wpbasti)
17 * Andreas Ecker (ecker)
19 ************************************************************************ */
21 /* ************************************************************************
23 #require(qx.core.Client)
25 ************************************************************************ */
28 * A string builder class
30 * += operator is faster in Firefox and Opera.
31 * Array push/join is faster in Internet Explorer
33 * Even with this wrapper, which costs some time, this is
34 * faster in Firefox than the alternative Array concat in
35 * all browsers (which is in relation to IE's performance issues
36 * only marginal). The IE performance loss caused by this
37 * wrapper is not relevant.
39 * So this class seems to be the best compromise to handle
40 * string concatenation.</p>
42 qx.OO.defineClass("qx.util.StringBuilder", qx.core.Object,
45 qx.core.Object.call(this);
48 this.add.apply(this, arguments);
53 * Resets the contents of the Stringbuilder
54 * equivalent to <pre>str = ""; </pre>
56 qx.Proto.clear = function() {}
59 * Returns the contents of the concatenated string
61 * @return {String} string content
63 qx.Proto.get = function() {}
66 * Append a variable number of string arguments
68 * @param varargs {String} variable number os strings to be added
70 qx.Proto.add = function(varargs) {}
73 * Initializes the contents of the Stringbuilder
74 * equivalent to <pre>str = ""; </pre>
76 qx.Proto.init = function() {}
79 qx.Proto.dispose = function() {}
82 * Returns the contents of the concatenated string
84 * @return {String} string content
86 qx.Proto.toString = function() {}
89 if (qx.core.Client.getInstance().isMshtml())
91 qx.Proto.clear = function() {
95 qx.Proto.get = function() {
96 return this._array.join("");
99 qx.Proto.add = function() {
100 this._array.push.apply(this._array, arguments);
103 qx.Proto.init = function() {
107 qx.Proto.dispose = function()
109 if (this.getDisposed()) {
115 qx.core.Object.prototype.dispose.call(this);
120 qx.Proto.clear = function() {
124 qx.Proto.get = function() {
128 qx.Proto.add = function() {
129 this._string += Array.prototype.join.call(arguments, "");
132 qx.Proto.init = function() {
136 qx.Proto.dispose = function()
138 if (this.getDisposed()) {
144 qx.core.Object.prototype.dispose.call(this);
148 qx.Proto.toString = qx.Proto.get;