Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59890 - website/public_html/beta/common/code
From: daniel_james_at_[hidden]
Date: 2010-02-25 03:42:20


Author: danieljames
Date: 2010-02-25 03:42:19 EST (Thu, 25 Feb 2010)
New Revision: 59890
URL: http://svn.boost.org/trac/boost/changeset/59890

Log:
Move render logic into filters (which are getting increasingly less like
filters).
Text files modified:
   website/public_html/beta/common/code/boost_archive.php | 70 ++++++++++++++++++++++-----------------
   1 files changed, 39 insertions(+), 31 deletions(-)

Modified: website/public_html/beta/common/code/boost_archive.php
==============================================================================
--- website/public_html/beta/common/code/boost_archive.php (original)
+++ website/public_html/beta/common/code/boost_archive.php 2010-02-25 03:42:19 EST (Thu, 25 Feb 2010)
@@ -44,7 +44,6 @@
     $get_as_raw = false)
 {
     $_file = new boost_archive($archive_location_details, $content_map, $get_as_raw);
- $_file->render();
 }
 
 class boost_archive
@@ -111,17 +110,11 @@
         $this->content_ = $this->extractor_instance_->extract($this, $unzip);
         $this->extractor_instance_->init($this);
 
- if ($this->extractor_ != 'h404' && $this->extractor_ != 'raw')
- {
- if($this->preprocess_) {
- $this->content_ = call_user_func($this->preprocess_, $this->content_);
- }
-
- if ($this->extractor_ == 'simple')
- {
- $this->extractor_instance_->content($this);
- }
+ if ($this->extractor_ != 'h404' && $this->extractor_ != 'raw' && $this->preprocess_) {
+ $this->content_ = call_user_func($this->preprocess_, $this->content_);
         }
+
+ $this->extractor_instance_->render($this);
     }
     
     function content_head()
@@ -135,16 +128,6 @@
 HTML;
     }
     
- function is_basic()
- {
- return $this->extractor_ == 'basic';
- }
-
- function is_raw()
- {
- return $this->extractor_ == 'raw' || $this->extractor_ == 'simple';
- }
-
     function content()
     {
         if ($this->extractor_instance_)
@@ -153,16 +136,6 @@
         }
     }
     
- function render()
- {
- if ($this->is_basic()) {
- print $this->content();
- }
- else if(!$this->is_raw()) {
- $this->display_template();
- }
- }
-
     function display_template() {
         $_file = $this;
         include(dirname(__FILE__)."/template.php");
@@ -174,6 +147,7 @@
     function extract($archive, $unzip) {}
     function init($archive) {}
     function content($archive) {}
+ function render($archive) {}
 };
 
 class raw_filter extends filter_base
@@ -229,6 +203,10 @@
         print htmlentities($archive->content_);
         print "</pre>\n";
     }
+
+ function render($archive) {
+ $archive->display_template();
+ }
 }
 
 class cpp_filter extends extract_filter_base
@@ -256,6 +234,10 @@
         print $text;
         print "</pre>\n";
     }
+
+ function render($archive) {
+ $archive->display_template();
+ }
 }
 
 class html_base_filter extends extract_filter_base
@@ -335,6 +317,10 @@
         
         print $text;
     }
+
+ function render($archive) {
+ $archive->display_template();
+ }
 }
 
 class boost_libs_filter extends html_base_filter
@@ -515,6 +501,10 @@
         
         print $text;
     }
+
+ function render($archive) {
+ $archive->display_template();
+ }
 }
 
 class boost_frame1_filter extends html_base_filter
@@ -545,6 +535,10 @@
         
         print $text;
     }
+
+ function render($archive) {
+ $archive->display_template();
+ }
 }
 
 class simple_filter extends html_base_filter
@@ -557,6 +551,11 @@
     {
         print parent::content($archive);
     }
+
+ function render($archive)
+ {
+ $this->content($archive);
+ }
 }
 
 class basic_filter extends html_base_filter
@@ -602,6 +601,11 @@
             }
         }
     }
+
+ function render($archive)
+ {
+ $this->content($archive);
+ }
 }
 
 class h404_filter extends filter_base
@@ -622,6 +626,10 @@
             print '<p>Unzip error: '.htmlentities($archive->content_).'</p>';
         }
     }
+
+ function render($archive) {
+ $archive->display_template();
+ }
 }
 
 // Return a readable error message for unzip exit state.


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk