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 - 2010 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 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.7.3c, 2010-06-01
  26.  */
  27.  
  28.  
  29. /**
  30.  * PHPExcel_CachedObjectStorage_Memory
  31.  *
  32.  * @category   PHPExcel
  33.  * @package    PHPExcel_CachedObjectStorage
  34.  * @copyright  Copyright (c) 2006 - 2010 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 unsetWorksheetCells({
  71.         //    Because cells are all stored as intact objects in memory, we need to detach each one from the parent
  72.         foreach($this->_cellCache as $k => &$cell{
  73.             $cell->detach();
  74.             $this->_cellCache[$knull;
  75.         }
  76.         unset($cell);
  77.  
  78.         $this->_cellCache = array();
  79.  
  80.         //    detach ourself from the worksheet, so that it can then delete this object successfully
  81.         $this->_parent = null;
  82.     }    //    function unsetWorksheetCells()
  83.  
  84. }

Documentation generated on Tue, 01 Jun 2010 17:05:14 +0200 by phpDocumentor 1.4.3