]> git.llucax.com Git - software/bife/bife-all.git/commitdiff
- Added a roadmap.
authorLeandro Lucarella <llucax@gmail.com>
Wed, 21 May 2003 03:38:13 +0000 (03:38 +0000)
committerLeandro Lucarella <llucax@gmail.com>
Wed, 21 May 2003 03:38:13 +0000 (03:38 +0000)
- Removed all rendering from the Parser class.
- Added a parseString() method to the Parser (parse() is just for internal
  use).
- Updated example.

Doxyfile
doc/ROADMAP [new file with mode: 0644]
doc/bife.xmi
examples/index.php
src/BIFE/Generic.php
src/BIFE/Parser.php

index 704aaeb4421900a93512762385f70793168e646e..8206aa3add0eae59b5ae904a45b740cf8cca3254 100644 (file)
--- a/Doxyfile
+++ b/Doxyfile
@@ -30,7 +30,7 @@
 # General configuration options
 #---------------------------------------------------------------------------
 PROJECT_NAME           = "BIFE - Build It FastEr"
-PROJECT_NUMBER         = 0.5
+PROJECT_NUMBER         = 0.6
 OUTPUT_DIRECTORY       = doc/api
 OUTPUT_LANGUAGE        = English
 EXTRACT_ALL            = YES
diff --git a/doc/ROADMAP b/doc/ROADMAP
new file mode 100644 (file)
index 0000000..c1e042c
--- /dev/null
@@ -0,0 +1,35 @@
+$Id$
+
+Version 0.7
+===========
+
+    Parser:
+        - Implement the Fallback class.
+
+
+
+Version 0.8
+===========
+
+    General:
+        - Add a Root interface and derivate Page from Root.
+        - Make a Core Package with the core classes (Parser, Widget, Container,
+          Root, Fallback).
+        - Make a Basic (or Generic?) Package with simple implementations of all
+          classes in Core Package.
+        - Make other more specific Packages (like Album) with other widgets.
+
+    Parser:
+        - Remove include statement, replace it with Root 'use' attribute.
+
+
+
+Version 0.9
+===========
+
+    Makefile:
+        - Make a way to put all classes in a package together in a single file to
+          avoid overhead in require_once calls.
+
+
+
index f36bd7e85fd35422ff7c2772cf5ac686dedc48b5..d2bb8fd5479e73202e88eff4264cd51df3c09741 100644 (file)
@@ -9,7 +9,7 @@
   <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
  </XMI.header>
  <XMI.content>
-  <docsettings viewid="2" documentation="" uniqueid="72" />
+  <docsettings viewid="2" documentation="" uniqueid="75" />
   <umlobjects>
    <UML:Class stereotype="" package="BIFE" xmi.id="3" abstract="1" documentation="Base widget class." name="Widget" static="0" scope="200" >
     <UML:Operation stereotype="" package="" xmi.id="4" type="string" abstract="1" documentation="Renders the widget using a template returning a string with the results." name="render" static="0" scope="200" >
     <UML:Attribute stereotype="" package="" xmi.id="21" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
    </UML:Class>
    <UML:Class stereotype="" package="BIFE" xmi.id="25" abstract="0" documentation="This is the XML Parser." name="Parser" static="0" scope="200" >
-    <UML:Operation stereotype="" package="" xmi.id="30" type="void" abstract="0" documentation="Constructor." name="BIFE_Parser" static="0" scope="200" >
-     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="&amp;HTML_Template_Sigma" abstract="0" documentation="Template to use to render the widgets." name="template" static="0" scope="200" />
-    </UML:Operation>
-    <UML:Operation stereotype="" package="" xmi.id="31" type="void" abstract="0" documentation="Constructor." name="__construct" static="0" scope="200" >
-     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="&amp;HTML_Template_Sigma" abstract="0" documentation="Template to use to render the widgets." name="template" static="0" scope="200" />
-    </UML:Operation>
+    <UML:Operation stereotype="" package="" xmi.id="30" type="void" abstract="0" documentation="Constructor." name="BIFE_Parser" static="0" scope="200" />
+    <UML:Operation stereotype="" package="" xmi.id="31" type="void" abstract="0" documentation="Constructor." name="__construct" static="0" scope="200" />
     <UML:Operation stereotype="" package="" xmi.id="32" type="void" abstract="0" documentation="Destructor." name="__destruct" static="0" scope="200" />
     <UML:Operation stereotype="" package="" xmi.id="33" type="void" abstract="0" documentation="XML parser start of element handler." name="startElement" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="resource" abstract="0" documentation="XML parser resource." name="parser" static="0" scope="200" />
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="XML string to parse." name="data" static="0" scope="200" />
      <UML:Parameter stereotype="" package="" xmi.id="2" value="true" type="bool" abstract="0" documentation="Indicates if is the last string to parse." name="final" static="0" scope="200" />
     </UML:Operation>
-    <UML:Operation stereotype="" package="" xmi.id="37" type="void" abstract="0" documentation="Parse a XML file returning the rendered output." name="parseFile" static="0" scope="200" >
+    <UML:Operation stereotype="" package="" xmi.id="37" type="&amp;BIFE_Widget" abstract="0" documentation="Parse a XML file with a complete and valid XML document." name="parseFile" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Filename to parse." name="filename" static="0" scope="200" />
     </UML:Operation>
-    <UML:Operation stereotype="" package="" xmi.id="38" type="string" abstract="0" documentation="Get rendered output." name="getOutput" static="0" scope="200" />
-    <UML:Attribute stereotype="" package="" xmi.id="26" value="" type="string" abstract="0" documentation="Output string." name="output" static="0" scope="200" />
+    <UML:Operation stereotype="" package="" xmi.id="74" type="&amp;BIFE_Widget" abstract="0" documentation="Parse a XML string with a complete and valid XML document." name="parseString" static="0" scope="200" >
+     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="XML data to parse." name="data" static="0" scope="200" />
+    </UML:Operation>
+    <UML:Attribute stereotype="" package="" xmi.id="26" value="" type="BIFE_Widget" abstract="0" documentation="Top level widget." name="root" static="0" scope="200" />
     <UML:Attribute stereotype="" package="" xmi.id="27" value="" type="resource" abstract="0" documentation="XML parser resource." name="parser" static="0" scope="200" />
     <UML:Attribute stereotype="" package="" xmi.id="28" value="" type="HTML_Template_Sigma" abstract="0" documentation="Template to use to render the parsed file." name="template" static="0" scope="200" />
     <UML:Attribute stereotype="" package="" xmi.id="29" value="" type="array" abstract="0" documentation="BIFE widgets stack." name="stack" static="0" scope="200" />
        <listitem open="0" type="815" id="32" label="__destruct" />
        <listitem open="0" type="815" id="35" label="characterData" />
        <listitem open="0" type="815" id="34" label="endElement" />
-       <listitem open="0" type="815" id="38" label="getOutput" />
-       <listitem open="0" type="814" id="26" label="output" />
+       <listitem open="0" type="814" id="26" label="root" />
        <listitem open="0" type="815" id="36" label="parse" />
        <listitem open="0" type="815" id="37" label="parseFile" />
+       <listitem open="0" type="815" id="74" label="parseString" />
        <listitem open="0" type="814" id="27" label="parser" />
        <listitem open="0" type="814" id="29" label="stack" />
        <listitem open="0" type="815" id="33" label="startElement" />
index 5e216233c96e1ec6e3701765914ddaab9f49ad9f..18f9ce3e8388621ca1acbbd96af5d5fea17e94f2 100644 (file)
@@ -43,8 +43,8 @@ $template =& new HTML_Template_Sigma('templates');
 $template->setErrorHandling(PEAR_ERROR_PRINT);
 
 $parser =& new BIFE_Parser($template);
-$parser->parseFile($file);
-echo $parser->getOutput();
+$page =& $parser->parseFile($file);
 $parser->__destruct();
+echo $page->render($template);
 
 ?>
index 1cca6451eeb989ad7734786292a3b345cc35c6e5..296a4c8213b57dedb9edb9c97885c24728727caf 100644 (file)
@@ -94,7 +94,9 @@ class BIFE_Generic extends BIFE_Container {
         if (is_string($contents)) {
             $contents = trim($contents);
         }
-        parent::addContents($contents);
+        if ($contents) {
+            parent::addContents($contents);
+        }
     }
     // -X2C
 
@@ -109,13 +111,14 @@ class BIFE_Generic extends BIFE_Container {
      */
     function render(&$template) // ~X2C
     {
+        $contents = parent::render($template);
         $template->loadTemplateFile(get_class($this).'.html');
         $template->setVariable($this->attrs);
-        $template->setVariable('CONTENTS', parent::render($template));
+        $template->setVariable('CONTENTS', $contents);
         return $template->get();
     }
     // -X2C
 
 } // -X2C Class :Generic
 
-?>
+?>
\ No newline at end of file
index 001c76eb9fb337b82b85e666be10be51ea2664cc..78ab5b02cf876e9b998d2d18b787598112a958dd 100644 (file)
  */
 class BIFE_Parser {
     /**
-     * Output string.
+     * Top level widget.
      *
-     * @var    string $output
+     * @var    BIFE_Widget $root
      * @access public
      */
-    var $output;
+    var $root;
 
     /**
      * XML parser resource.
@@ -71,12 +71,10 @@ class BIFE_Parser {
     /**
      * Constructor.
      *
-     * @param  HTML_Template_Sigma &$template Template to use to render the widgets.
-     *
      * @return void
      * @access public
      */
-    function BIFE_Parser(&$template) // ~X2C
+    function BIFE_Parser() // ~X2C
     {
         $this->__construct($template);
     }
@@ -86,15 +84,13 @@ class BIFE_Parser {
     /**
      * Constructor.
      *
-     * @param  HTML_Template_Sigma &$template Template to use to render the widgets.
-     *
      * @return void
      * @access public
      */
-    function __construct(&$template) // ~X2C
+    function __construct() // ~X2C
     {
         $this->stack    = array();
-        $this->output   = '';
+        $this->root     = null;
         $this->parser   = xml_parser_create();
         $this->template =& $template;
         xml_set_object($this->parser, $this);
@@ -163,9 +159,9 @@ class BIFE_Parser {
         end($this->stack);
         $parent =& $this->stack[key($this->stack)];
         if ($parent) {
-            $parent->addContents($current->render($this->template));
+            $parent->addContents($current);
         } else {
-            $this->output = $current->render($this->template);
+            $this->root =& $current;
         }
     }
     // -X2C
@@ -214,14 +210,14 @@ class BIFE_Parser {
 
     // +X2C Operation 37
     /**
-     * Parse a XML file returning the rendered output.
+     * Parse a XML file with a complete and valid XML document.
      *
      * @param  string $filename Filename to parse.
      *
-     * @return void
+     * @return &BIFE_Widget
      * @access public
      */
-    function parseFile($filename) // ~X2C
+    function &parseFile($filename) // ~X2C
     {
         if ($fp = @fopen($filename, "r")) {
             while ($data = fread($fp, 4096)) {
@@ -232,22 +228,27 @@ class BIFE_Parser {
                 E_USER_WARNING);
         }
         fclose($fp);
+        return $this->root;
     }
     // -X2C
 
-    // +X2C Operation 38
+
+    // +X2C Operation 74
     /**
-     * Get rendered output.
+     * Parse a XML string with a complete and valid XML document.
+     *
+     * @param  string $data XML data to parse.
      *
-     * @return string
+     * @return &BIFE_Widget
      * @access public
      */
-    function getOutput() // ~X2C
+    function &parseString($data) // ~X2C
     {
-        return $this->output;
+        $this->parse($data, true);
+        return $this->root;
     }
     // -X2C
 
 } // -X2C Class :Parser
 
-?>
\ No newline at end of file
+?>