PHPExcel_CachedObjectStorage
[ class tree: PHPExcel_CachedObjectStorage ] [ index: PHPExcel_CachedObjectStorage ] [ all elements ]

Source for file Memory.php

Documentation is available at Memory.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2011 PHPExcel
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPExcel
  22.  * @package    PHPExcel_CachedObjectStorage
  23.  * @copyright  Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.7.6, 2011-02-27
  26.  */
  27.  
  28.  
  29. /**
  30.  * PHPExcel_CachedObjectStorage_Memory
  31.  *
  32.  * @category   PHPExcel
  33.  * @package    PHPExcel_CachedObjectStorage
  34.  * @copyright  Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  35.  */
  36.  
  37.     /**
  38.      *    Add or Update a cell in cache identified by coordinate address
  39.      *
  40.      *    @param    string            $pCoord        Coordinate address of the cell to update
  41.      *    @param    PHPExcel_Cell    $cell        Cell to update
  42.      *    @return    void 
  43.      *    @throws    Exception
  44.      */
  45.     public function addCacheData($pCoordPHPExcel_Cell $cell{
  46.         $this->_cellCache[$pCoord$cell;
  47.         return $cell;
  48.     }    //    function addCacheData()
  49.  
  50.  
  51.     /**
  52.      * Get cell at a specific coordinate
  53.      *
  54.      * @param     string             $pCoord        Coordinate of the cell
  55.      * @throws     Exception
  56.      * @return     PHPExcel_Cell     Cell that was found, or null if not found
  57.      */
  58.     public function getCacheData($pCoord{
  59.         //    Check if the entry that has been requested actually exists
  60.         if (!isset($this->_cellCache[$pCoord])) {
  61.             //    Return null if requested entry doesn't exist in cache
  62.             return null;
  63.         }
  64.  
  65.         //    Return requested entry
  66.         return $this->_cellCache[$pCoord];
  67.     }    //    function getCacheData()
  68.  
  69.  
  70.     public function copyCellCollection(PHPExcel_Worksheet $parent{
  71.         parent::copyCellCollection($parent);
  72.  
  73.         $newCollection array();
  74.         foreach($this->_cellCache as $k => &$cell{
  75.             $newCollection[$kclone $cell;
  76.             $newCollection[$k]->attach($parent);
  77.         }
  78.  
  79.         $this->_cellCache = $newCollection;
  80.     }
  81.  
  82.  
  83.     public function unsetWorksheetCells({
  84.         //    Because cells are all stored as intact objects in memory, we need to detach each one from the parent
  85.         foreach($this->_cellCache as $k => &$cell{
  86.             $cell->detach();
  87.             $this->_cellCache[$knull;
  88.         }
  89.         unset($cell);
  90.  
  91.         $this->_cellCache = array();
  92.  
  93.         //    detach ourself from the worksheet, so that it can then delete this object successfully
  94.         $this->_parent = null;
  95.     }    //    function unsetWorksheetCells()
  96.  
  97. }

Documentation generated on Sun, 27 Feb 2011 16:32:46 -0800 by phpDocumentor 1.4.3