diff options
Diffstat (limited to 'buildscripts/phing/classes/phing/mappers')
6 files changed, 0 insertions, 447 deletions
diff --git a/buildscripts/phing/classes/phing/mappers/FileNameMapper.php b/buildscripts/phing/classes/phing/mappers/FileNameMapper.php deleted file mode 100755 index f4306b4c..00000000 --- a/buildscripts/phing/classes/phing/mappers/FileNameMapper.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -/* - * $Id: 24c9367363b11f9ab97509532739bf2353023034 $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -/** - * Interface for filename mapper classes. - * - * @author Andreas Aderhold, andi@binarycloud.com - * @author Hans Lellelid <hans@xmpl.org> - * @version $Id$ - * @package phing.mappers - */ -interface FileNameMapper { - - /** - * The mapper implementation. - * - * @param mixed $sourceFileName The data the mapper works on. - * @return array The data after the mapper has been applied; must be in array format (for some reason). - */ - public function main($sourceFileName); - - /** - * Accessor. Sets the to property. The actual implementation - * depends on the child class. - * - * @param string $to To what this mapper should convert the from string - * @return void - */ - public function setTo($to); - - /** - * Accessor. Sets the from property. What this mapper should - * recognize. The actual implementation is dependent upon the - * child class - * - * @param string $from On what this mapper should work - * @return void - */ - public function setFrom($from); - -} diff --git a/buildscripts/phing/classes/phing/mappers/FlattenMapper.php b/buildscripts/phing/classes/phing/mappers/FlattenMapper.php deleted file mode 100755 index 55ed4113..00000000 --- a/buildscripts/phing/classes/phing/mappers/FlattenMapper.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/* - * $Id: c18f079545fa2c53e9a129ec1dcf32447b597c09 $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -require_once 'phing/mappers/FileNameMapper.php'; - -/** - * Removes any directory information from the passed path. - * - * @author Andreas Aderhold <andi@binarycloud.com> - * @version $Id$ - * @package phing.mappers - */ -class FlattenMapper implements FileNameMapper { - - /** - * The mapper implementation. Returns string with source filename - * but without leading directory information - * - * @param string $sourceFileName The data the mapper works on - * @return array The data after the mapper has been applied - */ - function main($sourceFileName) { - $f = new PhingFile($sourceFileName); - return array($f->getName()); - } - - /** - * Ignored here. - */ - function setTo($to) {} - - /** - * Ignored here. - */ - function setFrom($from) {} - -} diff --git a/buildscripts/phing/classes/phing/mappers/GlobMapper.php b/buildscripts/phing/classes/phing/mappers/GlobMapper.php deleted file mode 100755 index 79df94d6..00000000 --- a/buildscripts/phing/classes/phing/mappers/GlobMapper.php +++ /dev/null @@ -1,113 +0,0 @@ -<?php -/* - * $Id: 464f98975210eee84faed74ef4a53c83d23aa079 $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -include_once 'phing/mappers/FileNameMapper.php'; - -/** - * description here - * - * @author Andreas Aderhold, andi@binarycloud.com - * @version $Id$ - * @package phing.mappers - */ -class GlobMapper implements FileNameMapper { - - /** - * Part of "from" pattern before the *. - */ - private $fromPrefix = null; - - /** - * Part of "from" pattern after the *. - */ - private $fromPostfix = null; - - /** - * Length of the prefix ("from" pattern). - */ - private $prefixLength; - - /** - * Length of the postfix ("from" pattern). - */ - private $postfixLength; - - /** - * Part of "to" pattern before the *. - */ - private $toPrefix = null; - - /** - * Part of "to" pattern after the *. - */ - private $toPostfix = null; - - - function main($_sourceFileName) { - if (($this->fromPrefix === null) - || !StringHelper::startsWith($this->fromPrefix, $_sourceFileName) - || !StringHelper::endsWith($this->fromPostfix, $_sourceFileName)) { - return null; - } - $varpart = $this->_extractVariablePart($_sourceFileName); - $substitution = $this->toPrefix.$varpart.$this->toPostfix; - return array($substitution); - } - - - - function setFrom($from) { - $index = strrpos($from, '*'); - - if ($index === false) { - $this->fromPrefix = $from; - $this->fromPostfix = ""; - } else { - $this->fromPrefix = substr($from, 0, $index); - $this->fromPostfix = substr($from, $index+1); - } - $this->prefixLength = strlen($this->fromPrefix); - $this->postfixLength = strlen($this->fromPostfix); - } - - /** - * Sets the "to" pattern. Required. - */ - function setTo($to) { - $index = strrpos($to, '*'); - if ($index === false) { - $this->toPrefix = $to; - $this->toPostfix = ""; - } else { - $this->toPrefix = substr($to, 0, $index); - $this->toPostfix = substr($to, $index+1); - } - } - - private function _extractVariablePart($_name) { - // ergh, i really hate php's string functions .... all but natural - $start = ($this->prefixLength === 0) ? 0 : $this->prefixLength; - $end = ($this->postfixLength === 0) ? strlen($_name) : strlen($_name) - $this->postfixLength; - $len = $end-$start; - return substr($_name, $start, $len); - } - -} diff --git a/buildscripts/phing/classes/phing/mappers/IdentityMapper.php b/buildscripts/phing/classes/phing/mappers/IdentityMapper.php deleted file mode 100755 index e608a71d..00000000 --- a/buildscripts/phing/classes/phing/mappers/IdentityMapper.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -/* - * $Id: aa11e8f44255c1b191df3230336c57664daf5f4f $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -require_once 'phing/mappers/FileNameMapper.php'; - -/** - * This mapper does nothing ;) - * - * @author Andreas Aderhold <andi@binarycloud.com> - * @author Hans Lellelid <hans@xmpl.org> - * @version $Id$ - * @package phing.mappers - */ -class IdentityMapper implements FileNameMapper { - - /** - * The mapper implementation. Basically does nothing in this case. - * - * @param string $sourceFileName The data the mapper works on. - * @return array The data after the mapper has been applied - */ - function main($sourceFileName) { - return array($sourceFileName); - } - - /** - * Ignored here. - */ - function setTo($to) {} - - /** - * Ignored here. - */ - function setFrom($from) {} - -} diff --git a/buildscripts/phing/classes/phing/mappers/MergeMapper.php b/buildscripts/phing/classes/phing/mappers/MergeMapper.php deleted file mode 100755 index dc60ab34..00000000 --- a/buildscripts/phing/classes/phing/mappers/MergeMapper.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/* - * $Id: 9f014a901932e99fd50820d3f3a78387929f06ee $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -include_once 'phing/mappers/FileNameMapper.php'; - -/** - * For merging files into a single file. In practice just returns whatever value - * was set for "to". - * - * @author Andreas Aderhold <andi@binarycloud.com> - * @version $Id$ - * @package phing.mappers - */ -class MergeMapper implements FileNameMapper { - - /** the merge */ - private $mergedFile; - - /** - * The mapper implementation. Basically does nothing in this case. - * - * @param mixed The data the mapper works on - * @return mixed The data after the mapper has been applied - * @access public - * @author Andreas Aderhold, andi@binarycloud.com - */ - function main($sourceFileName) { - if ($this->mergedFile === null) { - throw new BuildException("MergeMapper error, to attribute not set"); - } - return array($this->mergedFile); - } - - /** - * Accessor. Sets the to property - * - * @param string To what this mapper should convert the from string - * @return boolean True - * @access public - * @author Andreas Aderhold, andi@binarycloud.com - */ - function setTo($to) { - $this->mergedFile = $to; - } - - /** - * Ignored. - */ - function setFrom($from) {} - -} diff --git a/buildscripts/phing/classes/phing/mappers/RegexpMapper.php b/buildscripts/phing/classes/phing/mappers/RegexpMapper.php deleted file mode 100755 index ca387241..00000000 --- a/buildscripts/phing/classes/phing/mappers/RegexpMapper.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php -/* - * $Id: 96aee1ffd32ba919d42e1141129068006e709976 $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -require_once 'phing/mappers/FileNameMapper.php'; -include_once 'phing/util/StringHelper.php'; -include_once 'phing/util/regexp/Regexp.php'; - -/** - * Uses regular expressions to perform filename transformations. - * - * @author Andreas Aderhold <andi@binarycloud.com> - * @author Hans Lellelid <hans@velum.net> - * @version $Id$ - * @package phing.mappers - */ -class RegexpMapper implements FileNameMapper { - - /** - * @var string - */ - private $to; - - /** - * The Regexp engine. - * @var Regexp - */ - private $reg; - - function __construct() { - // instantiage regexp matcher here - $this->reg = new Regexp(); - } - - /** - * Sets the "from" pattern. Required. - */ - function setFrom($from) { - $this->reg->SetPattern($from); - } - - /** - * Sets the "to" pattern. Required. - */ - function setTo($to) { - - // [HL] I'm changing the way this works for now to just use string - //$this->to = StringHelper::toCharArray($to); - - $this->to = $to; - } - - function main($sourceFileName) { - if ($this->reg === null || $this->to === null || !$this->reg->matches((string) $sourceFileName)) { - return null; - } - return array($this->replaceReferences($sourceFileName)); - } - - /** - * Replace all backreferences in the to pattern with the matched groups. - * groups of the source. - * @param string $source The source filename. - */ - private function replaceReferences($source) { - - // FIXME - // Can't we just use engine->replace() to handle this? the Preg engine - // will automatically convert \1 references to $1 - - // the expression has already been processed (when ->matches() was run in Main()) - // so no need to pass $source again to the engine. - $groups = (array) $this->reg->getGroups(); - - // replace \1 with value of $groups[1] and return the modified "to" string - return preg_replace('/\\\([\d]+)/e', "\$groups[$1]", $this->to); - } - -} - |