[limb-svn] r4165 - in 3.x/packages/wact/trunk: framework/template/compiler/compile_tree_node tests/cases/template/compiler

svn at limb-project.com svn at limb-project.com
Mon Oct 16 11:29:40 MSD 2006


Author: serega
Date: 2006-10-16 11:29:40 +0400 (Mon, 16 Oct 2006)
New Revision: 4165

Added:
   3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompileTreeNode.class.php
   3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompileTreeRootNode.class.php
   3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeRootNodeTest.class.php
Removed:
   3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerComponent.class.php
   3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerTreeRootNode.class.php
   3.x/packages/wact/trunk/tests/cases/template/compiler/CompilerTreeRootNodeTest.class.php
Log:
-- -- WACT package clean up and refactoring



Copied: 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompileTreeNode.class.php (from rev 4164, 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerComponent.class.php)
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompileTreeNode.class.php	                        (rev 0)
+++ 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompileTreeNode.class.php	2006-10-16 07:29:40 UTC (rev 4165)
@@ -0,0 +1,482 @@
+<?php
+//--------------------------------------------------------------------------------
+// Copyright 2003 Procata, Inc.
+// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
+//--------------------------------------------------------------------------------
+/**
+* @package WACT_TEMPLATE
+* @version $Id: CompileTreeNode.class.php,v 1.60 2006/01/04 23:40:33 ian_w_white Exp $
+*/
+
+/**
+* Base class for compile time components. Compile time component methods are
+* called by the template parser SourceFileParser.<br />
+* Note this in the comments for this class, parent and child refer to the XML
+* heirarchy in the template, as opposed to the PHP class tree.
+* @see SourceFileParser
+* @see http://wact.sourceforge.net/index.php/CompileTreeNode
+* @access public
+* @abstract
+* @package WACT_TEMPLATE
+*/
+class CompileTreeNode {
+    /**
+    * XML attributes of the tag
+    * @var array
+    * @access private
+    */
+    var $attributeNodes = array();
+
+    /**
+    * Child compile-time components
+    * @var array of compile time component objects
+    * @access private
+    */
+    var $children = array();
+
+    /**
+    * A list of properties for this component
+    * @var array
+    * @access private
+    */
+    var $properties = array();
+
+    /**
+    * Parent compile-time component
+    * @var object subclass of CompileTreeNode
+    * @access private
+    */
+    var $parent = NULL;
+
+    /**
+    * Stores the identifying component ID
+    * @var string value of id attribute
+    * @access private
+    */
+    var $ServerId;
+
+    /**
+    * Name of the XML tag as it appears in the template. This would include
+    * the namespace prefix, if applicable.
+    * @var string tag name
+    * @access private
+    */
+    var $tag = '';
+
+    /**
+    * Used to identify the source template file, when generating compile time
+    * error messages.
+    * @var string source template filename
+    * @access private
+    */
+    var $SourceLocation;
+
+    /**
+    * Defines whether the tag is allowed to have a closing tag
+    * @var boolean
+    * @access private
+    */
+    var $hasClosingTag = TRUE;
+
+    /**
+    * Whether the was empty and closed such as <br />
+    * @var boolean
+    * @access private
+    */
+    var $emptyClosedTag = FALSE;
+
+    /**
+    * TagInfo metadata for this component
+    * @var TagInfo
+    */
+    var $TagInfo = NULL;
+
+    function raiseCompilerError($error, $vars = array()) {
+        $vars['tag'] = $this->tag;
+        $vars['file'] = (is_object($this->SourceLocation)) ? $this->SourceLocation->file : 'unknown file';
+        $vars['line'] = (is_object($this->SourceLocation)) ? $this->SourceLocation->line : 'unknown line';
+        throw new WactException('compiler', $error, $vars);
+    }
+
+    /**
+    * register a property with this component.  Currently, this
+    * component must be a database to support properties.  This may
+    * change.
+    * @access public
+    */
+    function registerProperty($name, &$property) {
+        $this->properties[$name] =& $property;
+    }
+
+    /**
+    * @return CompilerProperty returns the named property or NULL if it doesn't exist
+    * @access public
+    */
+    function &getProperty($name) {
+        if (array_key_exists($name, $this->properties)) {
+            return $this->properties[$name];
+        } else {
+            if ($this->isDataSource()) {
+                $null = NULL;
+                return $null;
+            } else {
+                $property =& $this->parent->getProperty($name);
+                return $property;
+            }
+        }
+    }
+
+    function getServerId()
+    {
+      if (empty($this->ServerId))
+        $this->ServerId = getNewServerId();
+
+      return $this->ServerId;
+    }
+
+    /**
+    * Adds a child component, by reference, to the array of children
+    * @param object instance of a compile time component
+    * @return void
+    * @access protected
+    */
+    function addChild(&$child) {
+        $child->parent =& $this;
+        $this->children[] =& $child;
+    }
+
+    /**
+    * Removes a child component, given it's ServerID
+    * @param string server id
+    * @return mixed if child is found, returns a reference to it or void
+    * @access protected
+    */
+    function &removeChild($ServerId) {
+        foreach( array_keys($this->children) as $key) {
+            $child =& $this->children[$key];
+            if ($child->getServerid() == $ServerId) {
+                unset($this->children[$key]);
+                return $child;
+            }
+        }
+    }
+
+    /**
+    * Returns a copy of of the children array (containing references to
+    * the children)
+    * @return array
+    * @access public
+    */
+    function getChildren() {
+        return $this->children;
+    }
+
+  /**
+  * Removes all children of this component
+  * @return void
+  * @access public
+  */
+  function removeChildren() {
+    foreach (array_keys($this->children) as $key) {
+      $this->children[$key]->removeChildren();
+      unset($this->children[$key]);
+    }
+  }
+
+    /**
+    * Returns a child component, given it's ServerID
+    * @param string server id
+    * @return mixed if child is found, returns a reference of false
+    * @access protected
+    */
+    function &findChild($ServerId) {
+        foreach( array_keys($this->children) as $key) {
+            if ($this->children[$key]->getServerid() == $ServerId) {
+                return $this->children[$key];
+            } else {
+                $result =& $this->children[$key]->findChild($ServerId);
+                if ($result) {
+                    return $result;
+                }
+            }
+        }
+        $false = FALSE;
+        return $false;
+    }
+
+    /**
+    * Returns a child component, given it's compile time component class
+    * @param string PHP class name
+    * @return mixed if child is found, returns a reference of false
+    * @access protected
+    */
+    function &findChildByClass($class) {
+        foreach( array_keys($this->children) as $key) {
+            if (is_a($this->children[$key], $class)) {
+                return $this->children[$key];
+            } else {
+                $result =& $this->children[$key]->findChildByClass($class);
+                if ($result) {
+                    return $result;
+                }
+            }
+        }
+        $false = FALSE;
+        return $false;
+    }
+
+    /**
+    * Returns an array of child components, given it's compile time component class
+    * @param string PHP class name
+    * @return array
+    * @access protected
+    */
+    function findChildrenByClass($class) {
+        $ret = array();
+        foreach( array_keys($this->children) as $key) {
+            if (is_a($this->children[$key], $class)) {
+                $ret[] =& $this->children[$key];
+            } else {
+                $more_children = $this->children[$key]->findChildrenByClass($class);
+                if (count($more_children)) {
+                    $ret = array_merge($ret, $more_children);
+                }
+            }
+        }
+        return $ret;
+    }
+
+    /**
+    * Returns a child component, given it's compile time component class
+    * @param string PHP class name
+    * @return mixed if child is found, returns a reference of false
+    * @access protected
+    */
+    function &findImmediateChildByClass($class) {
+        foreach( array_keys($this->children) as $key) {
+            if (is_a($this->children[$key], $class)) {
+                return $this->children[$key];
+            }
+        }
+        $false = FALSE;
+        return $false;
+    }
+
+    /**
+    * Returns a parent component, recursively searching parents by their
+    * compile time component class name
+    * @param string PHP class name
+    * @return mixed if parent is found, returns a reference of void
+    * @access protected
+    */
+    function &findParentByClass($class) {
+        $Parent =& $this->parent;
+        while ($Parent && !is_a($Parent, $class)) {
+            $Parent =& $Parent->parent;
+        }
+        return $Parent;
+    }
+
+    /**
+    * Extends findParentByClass to begin search at the <i>current</i> component
+    * <i>then</i> moving on to its parent, if there's no match. This is called
+    * from TagJudge to determine known children.
+    * @param string class name
+    * @return mixed if parent is found, returns a reference of void
+    * @access protected
+    */
+    function & findSelfOrParentByClass($class) {
+        if (is_a($this, $class)) {
+            return $this;
+        } else {
+            return $this->findParentByClass($class);
+        }
+    }
+
+    /**
+    * Calls the prepare method for each child component, which will override
+    * this method it it's concrete implementation. In the subclasses, prepare
+    * will set up compile time variables.
+    * @return void
+    * @access protected
+    */
+    function prepare() {
+        foreach( array_keys($this->attributeNodes) as $key) {
+            $this->attributeNodes[$key]->prepare();
+        }
+        foreach( array_keys($this->children) as $key) {
+            $this->children[$key]->prepare();
+        }
+    }
+
+    /**
+    * Used to perform some error checking on the source template, such as
+    * examining the tag hierarchy and triggering an error if a tag is
+    * incorrectly nested. Concrete implementation is in subclasses
+    * @return void
+    * @access protected
+    */
+    function CheckNestingLevel() {
+    }
+
+    /**
+    * Provides instruction to the template parser, while parsing is in
+    * progress, telling it how it should handle the tag. Subclasses of
+    * CompileTreeNode will return different instructions.<br />
+    * Available instructions are;
+    * <ul>
+    * <li>PARSER_REQUIRE_PARSING - default in this class. Tag must be parsed</li>
+    * <li>PARSER_FORBID_PARSING - Tag may not be parsed</li>
+    * <li>PARSER_ALLOW_PARSING - Tag may can be parsed</li>
+    * </ul>
+    * In practice, the parser currently only pays attention to the
+    * PARSER_FORBID_PARSING instruction.<br />
+    * Also used to perform error checking on template related to the syntax of
+    * the concrete tag implementing this method.
+    * @see SourceFileParser
+    * @return int PARSER_REQUIRE_PARSING
+    * @access protected
+    */
+    function preParse() {
+        return PARSER_REQUIRE_PARSING;
+    }
+
+    /**
+    * @return Boolean Indicating whether or not this component is a DataSource
+    */
+    function isDataSource() {
+        return FALSE;
+    }
+
+    /**
+    * If a parent compile time component exists, returns the value of the
+    * parent's getDataSource() method, which will be a concrete implementation
+    * @return mixed object compile time component if parent exists or void
+    * @access protected
+    */
+    function &getDataSource() {
+      $result = null;
+        if (!$this->isDataSource()) {
+            if (isset($this->parent)) {
+                $result = $this->parent->getDataSource();
+            }
+        }
+
+      return $result;
+    }
+
+    /**
+    * Gets the parent in the DataSource, if one exists
+    * @return mixed object compile time data component if exists or void
+    * @access protected
+    */
+    function &getParentDataSource() {
+      $result = null;
+
+        $DataSource =& $this->getDataSource();
+        if (isset($DataSource->parent)) {
+            $result = $DataSource->parent->getDataSource();
+        }
+
+        return $result;
+    }
+
+    /**
+    * Gets a root DataSource
+    * @return mixed object compile time data component if exists or void
+    * @access protected
+    */
+    function &getRootDataSource() {
+        $root =& $this;
+        while ($root->parent != NULL) {
+            $root =& $root->parent;
+        }
+        return $root;
+    }
+
+    /**
+    * Gets the DataSource reference code of the parent
+    * @return string
+    * @access protected
+    */
+    function getDataSourceRefCode() {
+        return $this->parent->getDataSourceRefCode();
+    }
+
+    /**
+    * Gets the component reference code of the parent. This is a PHP string
+    * which is used in the compiled template to reference the component in
+    * the hierarchy at runtime
+    * @return string
+    * @access protected
+    */
+    function getComponentRefCode() {
+        return $this->parent->getComponentRefCode();
+    }
+
+    /**
+    * Calls the generateConstructor() method of each child component
+    * @param CodeWriter
+    * @return void
+    * @access protected
+    */
+    function generateConstructor(&$code) {
+        foreach( array_keys($this->children) as $key) {
+            $this->children[$key]->generateConstructor($code);
+        }
+    }
+
+    /**
+    * Calls the generate() method of each child component
+    * @param CodeWriter
+    * @return void
+    * @access protected
+    */
+    function generateContents(&$code) {
+        foreach( array_keys($this->children) as $key) {
+            $this->children[$key]->generate($code);
+        }
+    }
+
+    /**
+    * Pre generation method
+    * @param CodeWriter
+    * @return void
+    * @access protected
+    */
+    function preGenerate(&$code) {
+        foreach( array_keys($this->properties) as $key) {
+            if ($this->properties[$key]->isActive()) {
+                $this->properties[$key]->generateScopeEntry($code);
+            }
+        }
+    }
+
+    /**
+    * Post generation method
+    * @param CodeWriter
+    * @return void
+    * @access protected
+    */
+    function postGenerate(&$code) {
+        foreach( array_keys($this->properties) as $key) {
+            if ($this->properties[$key]->isActive()) {
+                $this->properties[$key]->generateScopeExit($code);
+            }
+        }
+    }
+
+    /**
+    * Calls the local preGenerate(), generateContents() and postGenerate()
+    * methods.
+    * @param CodeWriter
+    * @return void
+    * @access protected
+    */
+    function generate(&$code) {
+        $this->preGenerate($code);
+        $this->generateContents($code);
+        $this->postGenerate($code);
+    }
+}
+?>
\ No newline at end of file

Copied: 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompileTreeRootNode.class.php (from rev 4164, 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerTreeRootNode.class.php)
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompileTreeRootNode.class.php	                        (rev 0)
+++ 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompileTreeRootNode.class.php	2006-10-16 07:29:40 UTC (rev 4165)
@@ -0,0 +1,24 @@
+<?php
+class CompileTreeRootNode extends CompileTreeNode
+{
+  function getComponentRefCode()
+  {
+    return '$root';
+  }
+
+  function getDataSourceRefCode()
+  {
+    return '$root->_datasource';
+  }
+
+  function getDataSource() {
+    return $this;
+  }
+
+  function isDataSource()
+  {
+    return TRUE;
+  }
+
+}
+?>
\ No newline at end of file

Deleted: 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerComponent.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerComponent.class.php	2006-10-16 07:28:34 UTC (rev 4164)
+++ 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerComponent.class.php	2006-10-16 07:29:40 UTC (rev 4165)
@@ -1,482 +0,0 @@
-<?php
-//--------------------------------------------------------------------------------
-// Copyright 2003 Procata, Inc.
-// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
-//--------------------------------------------------------------------------------
-/**
-* @package WACT_TEMPLATE
-* @version $Id: CompileTreeNode.class.php,v 1.60 2006/01/04 23:40:33 ian_w_white Exp $
-*/
-
-/**
-* Base class for compile time components. Compile time component methods are
-* called by the template parser SourceFileParser.<br />
-* Note this in the comments for this class, parent and child refer to the XML
-* heirarchy in the template, as opposed to the PHP class tree.
-* @see SourceFileParser
-* @see http://wact.sourceforge.net/index.php/CompileTreeNode
-* @access public
-* @abstract
-* @package WACT_TEMPLATE
-*/
-class CompileTreeNode {
-    /**
-    * XML attributes of the tag
-    * @var array
-    * @access private
-    */
-    var $attributeNodes = array();
-
-    /**
-    * Child compile-time components
-    * @var array of compile time component objects
-    * @access private
-    */
-    var $children = array();
-
-    /**
-    * A list of properties for this component
-    * @var array
-    * @access private
-    */
-    var $properties = array();
-
-    /**
-    * Parent compile-time component
-    * @var object subclass of CompileTreeNode
-    * @access private
-    */
-    var $parent = NULL;
-
-    /**
-    * Stores the identifying component ID
-    * @var string value of id attribute
-    * @access private
-    */
-    var $ServerId;
-
-    /**
-    * Name of the XML tag as it appears in the template. This would include
-    * the namespace prefix, if applicable.
-    * @var string tag name
-    * @access private
-    */
-    var $tag = '';
-
-    /**
-    * Used to identify the source template file, when generating compile time
-    * error messages.
-    * @var string source template filename
-    * @access private
-    */
-    var $SourceLocation;
-
-    /**
-    * Defines whether the tag is allowed to have a closing tag
-    * @var boolean
-    * @access private
-    */
-    var $hasClosingTag = TRUE;
-
-    /**
-    * Whether the was empty and closed such as <br />
-    * @var boolean
-    * @access private
-    */
-    var $emptyClosedTag = FALSE;
-
-    /**
-    * TagInfo metadata for this component
-    * @var TagInfo
-    */
-    var $TagInfo = NULL;
-
-    function raiseCompilerError($error, $vars = array()) {
-        $vars['tag'] = $this->tag;
-        $vars['file'] = (is_object($this->SourceLocation)) ? $this->SourceLocation->file : 'unknown file';
-        $vars['line'] = (is_object($this->SourceLocation)) ? $this->SourceLocation->line : 'unknown line';
-        throw new WactException('compiler', $error, $vars);
-    }
-
-    /**
-    * register a property with this component.  Currently, this
-    * component must be a database to support properties.  This may
-    * change.
-    * @access public
-    */
-    function registerProperty($name, &$property) {
-        $this->properties[$name] =& $property;
-    }
-
-    /**
-    * @return CompilerProperty returns the named property or NULL if it doesn't exist
-    * @access public
-    */
-    function &getProperty($name) {
-        if (array_key_exists($name, $this->properties)) {
-            return $this->properties[$name];
-        } else {
-            if ($this->isDataSource()) {
-                $null = NULL;
-                return $null;
-            } else {
-                $property =& $this->parent->getProperty($name);
-                return $property;
-            }
-        }
-    }
-
-    function getServerId()
-    {
-      if (empty($this->ServerId))
-        $this->ServerId = getNewServerId();
-
-      return $this->ServerId;
-    }
-
-    /**
-    * Adds a child component, by reference, to the array of children
-    * @param object instance of a compile time component
-    * @return void
-    * @access protected
-    */
-    function addChild(&$child) {
-        $child->parent =& $this;
-        $this->children[] =& $child;
-    }
-
-    /**
-    * Removes a child component, given it's ServerID
-    * @param string server id
-    * @return mixed if child is found, returns a reference to it or void
-    * @access protected
-    */
-    function &removeChild($ServerId) {
-        foreach( array_keys($this->children) as $key) {
-            $child =& $this->children[$key];
-            if ($child->getServerid() == $ServerId) {
-                unset($this->children[$key]);
-                return $child;
-            }
-        }
-    }
-
-    /**
-    * Returns a copy of of the children array (containing references to
-    * the children)
-    * @return array
-    * @access public
-    */
-    function getChildren() {
-        return $this->children;
-    }
-
-  /**
-  * Removes all children of this component
-  * @return void
-  * @access public
-  */
-  function removeChildren() {
-    foreach (array_keys($this->children) as $key) {
-      $this->children[$key]->removeChildren();
-      unset($this->children[$key]);
-    }
-  }
-
-    /**
-    * Returns a child component, given it's ServerID
-    * @param string server id
-    * @return mixed if child is found, returns a reference of false
-    * @access protected
-    */
-    function &findChild($ServerId) {
-        foreach( array_keys($this->children) as $key) {
-            if ($this->children[$key]->getServerid() == $ServerId) {
-                return $this->children[$key];
-            } else {
-                $result =& $this->children[$key]->findChild($ServerId);
-                if ($result) {
-                    return $result;
-                }
-            }
-        }
-        $false = FALSE;
-        return $false;
-    }
-
-    /**
-    * Returns a child component, given it's compile time component class
-    * @param string PHP class name
-    * @return mixed if child is found, returns a reference of false
-    * @access protected
-    */
-    function &findChildByClass($class) {
-        foreach( array_keys($this->children) as $key) {
-            if (is_a($this->children[$key], $class)) {
-                return $this->children[$key];
-            } else {
-                $result =& $this->children[$key]->findChildByClass($class);
-                if ($result) {
-                    return $result;
-                }
-            }
-        }
-        $false = FALSE;
-        return $false;
-    }
-
-    /**
-    * Returns an array of child components, given it's compile time component class
-    * @param string PHP class name
-    * @return array
-    * @access protected
-    */
-    function findChildrenByClass($class) {
-        $ret = array();
-        foreach( array_keys($this->children) as $key) {
-            if (is_a($this->children[$key], $class)) {
-                $ret[] =& $this->children[$key];
-            } else {
-                $more_children = $this->children[$key]->findChildrenByClass($class);
-                if (count($more_children)) {
-                    $ret = array_merge($ret, $more_children);
-                }
-            }
-        }
-        return $ret;
-    }
-
-    /**
-    * Returns a child component, given it's compile time component class
-    * @param string PHP class name
-    * @return mixed if child is found, returns a reference of false
-    * @access protected
-    */
-    function &findImmediateChildByClass($class) {
-        foreach( array_keys($this->children) as $key) {
-            if (is_a($this->children[$key], $class)) {
-                return $this->children[$key];
-            }
-        }
-        $false = FALSE;
-        return $false;
-    }
-
-    /**
-    * Returns a parent component, recursively searching parents by their
-    * compile time component class name
-    * @param string PHP class name
-    * @return mixed if parent is found, returns a reference of void
-    * @access protected
-    */
-    function &findParentByClass($class) {
-        $Parent =& $this->parent;
-        while ($Parent && !is_a($Parent, $class)) {
-            $Parent =& $Parent->parent;
-        }
-        return $Parent;
-    }
-
-    /**
-    * Extends findParentByClass to begin search at the <i>current</i> component
-    * <i>then</i> moving on to its parent, if there's no match. This is called
-    * from TagJudge to determine known children.
-    * @param string class name
-    * @return mixed if parent is found, returns a reference of void
-    * @access protected
-    */
-    function & findSelfOrParentByClass($class) {
-        if (is_a($this, $class)) {
-            return $this;
-        } else {
-            return $this->findParentByClass($class);
-        }
-    }
-
-    /**
-    * Calls the prepare method for each child component, which will override
-    * this method it it's concrete implementation. In the subclasses, prepare
-    * will set up compile time variables.
-    * @return void
-    * @access protected
-    */
-    function prepare() {
-        foreach( array_keys($this->attributeNodes) as $key) {
-            $this->attributeNodes[$key]->prepare();
-        }
-        foreach( array_keys($this->children) as $key) {
-            $this->children[$key]->prepare();
-        }
-    }
-
-    /**
-    * Used to perform some error checking on the source template, such as
-    * examining the tag hierarchy and triggering an error if a tag is
-    * incorrectly nested. Concrete implementation is in subclasses
-    * @return void
-    * @access protected
-    */
-    function CheckNestingLevel() {
-    }
-
-    /**
-    * Provides instruction to the template parser, while parsing is in
-    * progress, telling it how it should handle the tag. Subclasses of
-    * CompileTreeNode will return different instructions.<br />
-    * Available instructions are;
-    * <ul>
-    * <li>PARSER_REQUIRE_PARSING - default in this class. Tag must be parsed</li>
-    * <li>PARSER_FORBID_PARSING - Tag may not be parsed</li>
-    * <li>PARSER_ALLOW_PARSING - Tag may can be parsed</li>
-    * </ul>
-    * In practice, the parser currently only pays attention to the
-    * PARSER_FORBID_PARSING instruction.<br />
-    * Also used to perform error checking on template related to the syntax of
-    * the concrete tag implementing this method.
-    * @see SourceFileParser
-    * @return int PARSER_REQUIRE_PARSING
-    * @access protected
-    */
-    function preParse() {
-        return PARSER_REQUIRE_PARSING;
-    }
-
-    /**
-    * @return Boolean Indicating whether or not this component is a DataSource
-    */
-    function isDataSource() {
-        return FALSE;
-    }
-
-    /**
-    * If a parent compile time component exists, returns the value of the
-    * parent's getDataSource() method, which will be a concrete implementation
-    * @return mixed object compile time component if parent exists or void
-    * @access protected
-    */
-    function &getDataSource() {
-      $result = null;
-        if (!$this->isDataSource()) {
-            if (isset($this->parent)) {
-                $result = $this->parent->getDataSource();
-            }
-        }
-
-      return $result;
-    }
-
-    /**
-    * Gets the parent in the DataSource, if one exists
-    * @return mixed object compile time data component if exists or void
-    * @access protected
-    */
-    function &getParentDataSource() {
-      $result = null;
-
-        $DataSource =& $this->getDataSource();
-        if (isset($DataSource->parent)) {
-            $result = $DataSource->parent->getDataSource();
-        }
-
-        return $result;
-    }
-
-    /**
-    * Gets a root DataSource
-    * @return mixed object compile time data component if exists or void
-    * @access protected
-    */
-    function &getRootDataSource() {
-        $root =& $this;
-        while ($root->parent != NULL) {
-            $root =& $root->parent;
-        }
-        return $root;
-    }
-
-    /**
-    * Gets the DataSource reference code of the parent
-    * @return string
-    * @access protected
-    */
-    function getDataSourceRefCode() {
-        return $this->parent->getDataSourceRefCode();
-    }
-
-    /**
-    * Gets the component reference code of the parent. This is a PHP string
-    * which is used in the compiled template to reference the component in
-    * the hierarchy at runtime
-    * @return string
-    * @access protected
-    */
-    function getComponentRefCode() {
-        return $this->parent->getComponentRefCode();
-    }
-
-    /**
-    * Calls the generateConstructor() method of each child component
-    * @param CodeWriter
-    * @return void
-    * @access protected
-    */
-    function generateConstructor(&$code) {
-        foreach( array_keys($this->children) as $key) {
-            $this->children[$key]->generateConstructor($code);
-        }
-    }
-
-    /**
-    * Calls the generate() method of each child component
-    * @param CodeWriter
-    * @return void
-    * @access protected
-    */
-    function generateContents(&$code) {
-        foreach( array_keys($this->children) as $key) {
-            $this->children[$key]->generate($code);
-        }
-    }
-
-    /**
-    * Pre generation method
-    * @param CodeWriter
-    * @return void
-    * @access protected
-    */
-    function preGenerate(&$code) {
-        foreach( array_keys($this->properties) as $key) {
-            if ($this->properties[$key]->isActive()) {
-                $this->properties[$key]->generateScopeEntry($code);
-            }
-        }
-    }
-
-    /**
-    * Post generation method
-    * @param CodeWriter
-    * @return void
-    * @access protected
-    */
-    function postGenerate(&$code) {
-        foreach( array_keys($this->properties) as $key) {
-            if ($this->properties[$key]->isActive()) {
-                $this->properties[$key]->generateScopeExit($code);
-            }
-        }
-    }
-
-    /**
-    * Calls the local preGenerate(), generateContents() and postGenerate()
-    * methods.
-    * @param CodeWriter
-    * @return void
-    * @access protected
-    */
-    function generate(&$code) {
-        $this->preGenerate($code);
-        $this->generateContents($code);
-        $this->postGenerate($code);
-    }
-}
-?>
\ No newline at end of file

Deleted: 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerTreeRootNode.class.php
===================================================================
--- 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerTreeRootNode.class.php	2006-10-16 07:28:34 UTC (rev 4164)
+++ 3.x/packages/wact/trunk/framework/template/compiler/compile_tree_node/CompilerTreeRootNode.class.php	2006-10-16 07:29:40 UTC (rev 4165)
@@ -1,24 +0,0 @@
-<?php
-class CompileTreeRootNode extends CompileTreeNode
-{
-  function getComponentRefCode()
-  {
-    return '$root';
-  }
-
-  function getDataSourceRefCode()
-  {
-    return '$root->_datasource';
-  }
-
-  function getDataSource() {
-    return $this;
-  }
-
-  function isDataSource()
-  {
-    return TRUE;
-  }
-
-}
-?>
\ No newline at end of file

Copied: 3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeRootNodeTest.class.php (from rev 4164, 3.x/packages/wact/trunk/tests/cases/template/compiler/CompilerTreeRootNodeTest.class.php)
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeRootNodeTest.class.php	                        (rev 0)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/CompileTreeRootNodeTest.class.php	2006-10-16 07:29:40 UTC (rev 4165)
@@ -0,0 +1,24 @@
+<?php
+require_once(WACT_TEST_CASES . '/template/compiler/CompileTreeNodeTest.class.php');
+
+class CompileTreeRootNodeTest extends CompileTreeNodeTest
+{
+  function testGetDataSourceRefCode()
+  {
+    $this->component = new CompileTreeRootNode();
+    $this->assertEqual($this->component->getDataSourceRefCode(), '$root->_datasource');
+  }
+
+  function testGetComponentRefCode()
+  {
+    $this->component = new CompileTreeRootNode();
+    $this->assertEqual($this->component->getComponentRefCode(), '$root');
+  }
+
+  function testGetDataSource()
+  {
+    $this->component = new CompileTreeRootNode();
+    $this->assertIsA($this->component->getDataSource(), 'CompileTreeRootNode');
+  }
+}
+?>
\ No newline at end of file

Deleted: 3.x/packages/wact/trunk/tests/cases/template/compiler/CompilerTreeRootNodeTest.class.php
===================================================================
--- 3.x/packages/wact/trunk/tests/cases/template/compiler/CompilerTreeRootNodeTest.class.php	2006-10-16 07:28:34 UTC (rev 4164)
+++ 3.x/packages/wact/trunk/tests/cases/template/compiler/CompilerTreeRootNodeTest.class.php	2006-10-16 07:29:40 UTC (rev 4165)
@@ -1,24 +0,0 @@
-<?php
-require_once(WACT_TEST_CASES . '/template/compiler/CompileTreeNodeTest.class.php');
-
-class CompileTreeRootNodeTest extends CompileTreeNodeTest
-{
-  function testGetDataSourceRefCode()
-  {
-    $this->component = new CompileTreeRootNode();
-    $this->assertEqual($this->component->getDataSourceRefCode(), '$root->_datasource');
-  }
-
-  function testGetComponentRefCode()
-  {
-    $this->component = new CompileTreeRootNode();
-    $this->assertEqual($this->component->getComponentRefCode(), '$root');
-  }
-
-  function testGetDataSource()
-  {
-    $this->component = new CompileTreeRootNode();
-    $this->assertIsA($this->component->getDataSource(), 'CompileTreeRootNode');
-  }
-}
-?>
\ No newline at end of file



More information about the limb-svn mailing list