ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PHPExcel_CachedObjectStorage_CacheBase Class Reference
+ Inheritance diagram for PHPExcel_CachedObjectStorage_CacheBase:
+ Collaboration diagram for PHPExcel_CachedObjectStorage_CacheBase:

Public Member Functions

 __construct (PHPExcel_Worksheet $parent)
 Initialise this new cell collection. More...
 
 getParent ()
 Return the parent worksheet for this cell collection. More...
 
 isDataSet ($pCoord)
 Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? More...
 
 moveCell ($fromAddress, $toAddress)
 Move a cell object from one address to another. More...
 
 updateCacheData (PHPExcel_Cell $cell)
 Add or Update a cell in cache. More...
 
 deleteCacheData ($pCoord)
 Delete a cell in cache identified by coordinate address. More...
 
 getCellList ()
 Get a list of all cell addresses currently held in cache. More...
 
 getSortedCellList ()
 Sort the list of all cell addresses currently held in cache by row and column. More...
 
 getHighestRowAndColumn ()
 Get highest worksheet column and highest row that have cell records. More...
 
 getCurrentAddress ()
 Return the cell address of the currently active cell object. More...
 
 getCurrentColumn ()
 Return the column address of the currently active cell object. More...
 
 getCurrentRow ()
 Return the row address of the currently active cell object. More...
 
 getHighestColumn ($row=null)
 
 getHighestRow ($column=null)
 
 copyCellCollection (PHPExcel_Worksheet $parent)
 Clone the cell collection. More...
 
 removeRow ($row)
 Remove a row, deleting all cells in that row. More...
 
 removeColumn ($column)
 Remove a column, deleting all cells in that column. More...
 

Static Public Member Functions

static cacheMethodIsAvailable ()
 Identify whether the caching method is currently available Some methods are dependent on the availability of certain extensions being enabled in the PHP build. More...
 

Protected Member Functions

 _getUniqueID ()
 Generate a unique ID for cache referencing. More...
 

Protected Attributes

 $_parent
 
 $_currentObject = null
 
 $_currentObjectID = null
 
 $_currentCellIsDirty = true
 
 $_cellCache = array()
 

Detailed Description

Definition at line 36 of file CacheBase.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_CachedObjectStorage_CacheBase::__construct ( PHPExcel_Worksheet  $parent)

Initialise this new cell collection.

Parameters
PHPExcel_Worksheet$parentThe worksheet for this cell collection

Reimplemented in PHPExcel_CachedObjectStorage_SQLite, and PHPExcel_CachedObjectStorage_SQLite3.

Definition at line 81 of file CacheBase.php.

81 {
82 // Set our parent worksheet.
83 // This is maintained within the cache controller to facilitate re-attaching it to PHPExcel_Cell objects when
84 // they are woken from a serialized state
85 $this->_parent = $parent;
86 } // function __construct()

Member Function Documentation

◆ _getUniqueID()

◆ cacheMethodIsAvailable()

static PHPExcel_CachedObjectStorage_CacheBase::cacheMethodIsAvailable ( )
static

Identify whether the caching method is currently available Some methods are dependent on the availability of certain extensions being enabled in the PHP build.

Returns
boolean

Reimplemented in PHPExcel_CachedObjectStorage_APC, PHPExcel_CachedObjectStorage_Igbinary, PHPExcel_CachedObjectStorage_Memcache, PHPExcel_CachedObjectStorage_SQLite, PHPExcel_CachedObjectStorage_SQLite3, and PHPExcel_CachedObjectStorage_Wincache.

Definition at line 372 of file CacheBase.php.

372 {
373 return true;
374 }

◆ copyCellCollection()

PHPExcel_CachedObjectStorage_CacheBase::copyCellCollection ( PHPExcel_Worksheet  $parent)

Clone the cell collection.

Parameters
PHPExcel_Worksheet$parentThe new worksheet
Returns
void

Reimplemented in PHPExcel_CachedObjectStorage_APC, PHPExcel_CachedObjectStorage_DiscISAM, PHPExcel_CachedObjectStorage_Memcache, PHPExcel_CachedObjectStorage_Memory, PHPExcel_CachedObjectStorage_PHPTemp, PHPExcel_CachedObjectStorage_SQLite, PHPExcel_CachedObjectStorage_SQLite3, and PHPExcel_CachedObjectStorage_Wincache.

Definition at line 326 of file CacheBase.php.

326 {
328 $this->_storeData();
329
330 $this->_parent = $parent;
331 if (($this->_currentObject !== NULL) && (is_object($this->_currentObject))) {
332 $this->_currentObject->attach($this);
333 }
334 } // function copyCellCollection()

References $_currentCellIsDirty.

◆ deleteCacheData()

PHPExcel_CachedObjectStorage_CacheBase::deleteCacheData (   $pCoord)

Delete a cell in cache identified by coordinate address.

Parameters
string$pCoordCoordinate address of the cell to delete
Exceptions
PHPExcel_Exception

Reimplemented in PHPExcel_CachedObjectStorage_APC, PHPExcel_CachedObjectStorage_Memcache, PHPExcel_CachedObjectStorage_SQLite, PHPExcel_CachedObjectStorage_SQLite3, and PHPExcel_CachedObjectStorage_Wincache.

Definition at line 153 of file CacheBase.php.

153 {
154 if ($pCoord === $this->_currentObjectID && !is_null($this->_currentObject)) {
155 $this->_currentObject->detach();
156 $this->_currentObjectID = $this->_currentObject = null;
157 }
158
159 if (is_object($this->_cellCache[$pCoord])) {
160 $this->_cellCache[$pCoord]->detach();
161 unset($this->_cellCache[$pCoord]);
162 }
163 $this->_currentCellIsDirty = false;
164 } // function deleteCacheData()

Referenced by removeColumn(), and removeRow().

+ Here is the caller graph for this function:

◆ getCellList()

PHPExcel_CachedObjectStorage_CacheBase::getCellList ( )

◆ getCurrentAddress()

PHPExcel_CachedObjectStorage_CacheBase::getCurrentAddress ( )

Return the cell address of the currently active cell object.

Returns
string

Definition at line 227 of file CacheBase.php.

References $_currentObjectID.

◆ getCurrentColumn()

PHPExcel_CachedObjectStorage_CacheBase::getCurrentColumn ( )

Return the column address of the currently active cell object.

Returns
string

Definition at line 237 of file CacheBase.php.

238 {
239 sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row);
240 return $column;
241 }
$column
Definition: 39dropdown.php:62

References $column, and $row.

◆ getCurrentRow()

PHPExcel_CachedObjectStorage_CacheBase::getCurrentRow ( )

Return the row address of the currently active cell object.

Returns
integer

Definition at line 248 of file CacheBase.php.

249 {
250 sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row);
251 return (integer) $row;
252 }

References $column, and $row.

◆ getHighestColumn()

PHPExcel_CachedObjectStorage_CacheBase::getHighestColumn (   $row = null)
Get highest worksheet column
Parameters
string$rowReturn the highest column for the specified row, or the highest column of any row if no row number is passed
Returns
string Highest column name

Definition at line 261 of file CacheBase.php.

262 {
263 if ($row == null) {
264 $colRow = $this->getHighestRowAndColumn();
265 return $colRow['column'];
266 }
267
268 $columnList = array(1);
269 foreach ($this->getCellList() as $coord) {
270 sscanf($coord,'%[A-Z]%d', $c, $r);
271 if ($r != $row) {
272 continue;
273 }
274 $columnList[] = PHPExcel_Cell::columnIndexFromString($c);
275 }
276 return PHPExcel_Cell::stringFromColumnIndex(max($columnList) - 1);
277 }
getCellList()
Get a list of all cell addresses currently held in cache.
Definition: CacheBase.php:172
getHighestRowAndColumn()
Get highest worksheet column and highest row that have cell records.
Definition: CacheBase.php:200
static stringFromColumnIndex($pColumnIndex=0)
String from columnindex.
Definition: Cell.php:825
static columnIndexFromString($pString='A')
Column index from string.
Definition: Cell.php:782
$r
Definition: example_031.php:79

References $r, $row, PHPExcel_Cell\columnIndexFromString(), getCellList(), getHighestRowAndColumn(), and PHPExcel_Cell\stringFromColumnIndex().

+ Here is the call graph for this function:

◆ getHighestRow()

PHPExcel_CachedObjectStorage_CacheBase::getHighestRow (   $column = null)
Get highest worksheet row
Parameters
string$columnReturn the highest row for the specified column, or the highest row of any column if no column letter is passed
Returns
int Highest row number

Definition at line 286 of file CacheBase.php.

287 {
288 if ($column == null) {
289 $colRow = $this->getHighestRowAndColumn();
290 return $colRow['row'];
291 }
292
293 $rowList = array(0);
294 foreach ($this->getCellList() as $coord) {
295 sscanf($coord,'%[A-Z]%d', $c, $r);
296 if ($c != $column) {
297 continue;
298 }
299 $rowList[] = $r;
300 }
301
302 return max($rowList);
303 }

References $column, $r, getCellList(), and getHighestRowAndColumn().

+ Here is the call graph for this function:

◆ getHighestRowAndColumn()

PHPExcel_CachedObjectStorage_CacheBase::getHighestRowAndColumn ( )

Get highest worksheet column and highest row that have cell records.

Returns
array Highest column name and highest row number

Definition at line 200 of file CacheBase.php.

201 {
202 // Lookup highest column and highest row
203 $col = array('A' => '1A');
204 $row = array(1);
205 foreach ($this->getCellList() as $coord) {
206 sscanf($coord,'%[A-Z]%d', $c, $r);
207 $row[$r] = $r;
208 $col[$c] = strlen($c).$c;
209 }
210 if (!empty($row)) {
211 // Determine highest column and row
212 $highestRow = max($row);
213 $highestColumn = substr(max($col),1);
214 }
215
216 return array( 'row' => $highestRow,
217 'column' => $highestColumn
218 );
219 }

References $r, $row, and getCellList().

Referenced by getHighestColumn(), and getHighestRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParent()

PHPExcel_CachedObjectStorage_CacheBase::getParent ( )

Return the parent worksheet for this cell collection.

Returns
PHPExcel_Worksheet

Definition at line 94 of file CacheBase.php.

References $_parent.

◆ getSortedCellList()

PHPExcel_CachedObjectStorage_CacheBase::getSortedCellList ( )

Sort the list of all cell addresses currently held in cache by row and column.

Returns
string[]

Definition at line 182 of file CacheBase.php.

182 {
183 $sortKeys = array();
184 foreach ($this->getCellList() as $coord) {
185 sscanf($coord,'%[A-Z]%d', $column, $row);
186 $sortKeys[sprintf('%09d%3s',$row,$column)] = $coord;
187 }
188 ksort($sortKeys);
189
190 return array_values($sortKeys);
191 } // function sortCellList()
sprintf('%.4f', $callTime)

References $column, $row, getCellList(), and sprintf.

+ Here is the call graph for this function:

◆ isDataSet()

PHPExcel_CachedObjectStorage_CacheBase::isDataSet (   $pCoord)

Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?

Parameters
string$pCoordCoordinate address of the cell to check
Returns
boolean

Reimplemented in PHPExcel_CachedObjectStorage_APC, PHPExcel_CachedObjectStorage_Memcache, PHPExcel_CachedObjectStorage_SQLite, PHPExcel_CachedObjectStorage_SQLite3, and PHPExcel_CachedObjectStorage_Wincache.

Definition at line 105 of file CacheBase.php.

105 {
106 if ($pCoord === $this->_currentObjectID) {
107 return true;
108 }
109 // Check if the requested entry exists in the cache
110 return isset($this->_cellCache[$pCoord]);
111 } // function isDataSet()

◆ moveCell()

PHPExcel_CachedObjectStorage_CacheBase::moveCell (   $fromAddress,
  $toAddress 
)

Move a cell object from one address to another.

Parameters
string$fromAddressCurrent address of the cell to move
string$toAddressDestination address of the cell to move
Returns
boolean

Reimplemented in PHPExcel_CachedObjectStorage_SQLite, and PHPExcel_CachedObjectStorage_SQLite3.

Definition at line 121 of file CacheBase.php.

121 {
122 if ($fromAddress === $this->_currentObjectID) {
123 $this->_currentObjectID = $toAddress;
124 }
125 $this->_currentCellIsDirty = true;
126 if (isset($this->_cellCache[$fromAddress])) {
127 $this->_cellCache[$toAddress] = &$this->_cellCache[$fromAddress];
128 unset($this->_cellCache[$fromAddress]);
129 }
130
131 return TRUE;
132 } // function moveCell()

◆ removeColumn()

PHPExcel_CachedObjectStorage_CacheBase::removeColumn (   $column)

Remove a column, deleting all cells in that column.

Parameters
string$columnColumn ID to remove
Returns
void

Definition at line 357 of file CacheBase.php.

357 {
358 foreach ($this->getCellList() as $coord) {
359 sscanf($coord,'%[A-Z]%d', $c, $r);
360 if ($c == $column) {
361 $this->deleteCacheData($coord);
362 }
363 }
364 }
deleteCacheData($pCoord)
Delete a cell in cache identified by coordinate address.
Definition: CacheBase.php:153

References $column, $r, deleteCacheData(), and getCellList().

+ Here is the call graph for this function:

◆ removeRow()

PHPExcel_CachedObjectStorage_CacheBase::removeRow (   $row)

Remove a row, deleting all cells in that row.

Parameters
string$rowRow number to remove
Returns
void

Definition at line 342 of file CacheBase.php.

342 {
343 foreach ($this->getCellList() as $coord) {
344 sscanf($coord,'%[A-Z]%d', $c, $r);
345 if ($r == $row) {
346 $this->deleteCacheData($coord);
347 }
348 }
349 }

References $r, $row, deleteCacheData(), and getCellList().

+ Here is the call graph for this function:

◆ updateCacheData()

PHPExcel_CachedObjectStorage_CacheBase::updateCacheData ( PHPExcel_Cell  $cell)

Add or Update a cell in cache.

Parameters
PHPExcel_Cell$cellCell to update
Returns
PHPExcel_Cell
Exceptions
PHPExcel_Exception

Definition at line 142 of file CacheBase.php.

142 {
143 return $this->addCacheData($cell->getCoordinate(),$cell);
144 } // function updateCacheData()
getCoordinate()
Get cell coordinate.
Definition: Cell.php:171

References PHPExcel_Cell\getCoordinate().

+ Here is the call graph for this function:

Field Documentation

◆ $_cellCache

PHPExcel_CachedObjectStorage_CacheBase::$_cellCache = array()
protected

Definition at line 73 of file CacheBase.php.

◆ $_currentCellIsDirty

PHPExcel_CachedObjectStorage_CacheBase::$_currentCellIsDirty = true
protected

◆ $_currentObject

◆ $_currentObjectID

◆ $_parent

PHPExcel_CachedObjectStorage_CacheBase::$_parent
protected

Definition at line 43 of file CacheBase.php.

Referenced by getParent().


The documentation for this class was generated from the following file: