diff --git a/core/HopObject.js b/core/HopObject.js
index f97853eb..b08414b5 100644
--- a/core/HopObject.js
+++ b/core/HopObject.js
@@ -8,10 +8,10 @@
*
* Copyright 1998-2005 Helma Software. All Rights Reserved.
*
- * $RCSfile: Date.js,v $
- * $Author: czv $
- * $Revision: 1.2 $
- * $Date: 2006/04/24 07:02:17 $
+ * $RCSfile: HopObject.js,v $
+ * $Author: tobi $
+ * $Revision: 1.1 $
+ * $Date: 2006/08/06 11:27:56 $
*/
@@ -19,6 +19,24 @@ app.addRepository("modules/core/Number.js");
app.addRepository("modules/core/String.js");
+/**
+ * Iterates over each child node of the HopObject.
+ * @param {Function} callback The callback function to be
+ * called for each child node. On every call the first
+ * argument of this function is set to the current value
+ * of the counter variable i
.
+ */
+HopObject.prototype.forEach = function(callback) {
+ if (!callback || callback instanceof Function == false) {
+ return;
+ }
+ for (var i=0; iparam
+ * argument:
+ *
+ * - param.none - not a single child node
+ * - param.one - exactly one child node
+ * - param.many - more than one child node
+ *
+ * @param {Object} param The default macro parameter
+ * @param {String} name The default name for a child node
+ */
+HopObject.prototype.size_macro = function(param, name) {
+ var EMPTYSTR = "";
+ var n = this.size();
+ if (name) {
+ var text;
+ var plural = (name.lastIndexOf("s") < name.length-1) ? "s" : "es";
+ if (n > 0) {
+ if (n > 1) {
+ text = n + " " + name + plural;
+ } else {
+ text = (param.one !== null) ? param.one : "one " + name;
+ }
+ } else {
+ text = (param.none !== null) ? param.none : "no " + name + plural;
+ }
+ res.write(text);
+ } else {
+ res.write(n);
+ }
+ return;
+};