UpdateInfoContainer.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Pdf
  17. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. * @version $Id$
  20. */
  21. /** Zend_Pdf_Element */
  22. require_once 'Zend/Pdf/Element.php';
  23. /** Zend_Pdf_Element_Object */
  24. require_once 'Zend/Pdf/Element/Object.php';
  25. /** Zend_Memory */
  26. require_once 'Zend/Memory.php';
  27. /**
  28. * Container which collects updated object info.
  29. *
  30. * @package Zend_Pdf
  31. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  32. * @license http://framework.zend.com/license/new-bsd New BSD License
  33. */
  34. class Zend_Pdf_UpdateInfoContainer
  35. {
  36. /**
  37. * Object number
  38. *
  39. * @var integer
  40. */
  41. private $_objNum;
  42. /**
  43. * Generation number
  44. *
  45. * @var integer
  46. */
  47. private $_genNum;
  48. /**
  49. * Flag, which signals, that object is free
  50. *
  51. * @var boolean
  52. */
  53. private $_isFree;
  54. /**
  55. * String representation of the object
  56. *
  57. * @var Zend_Memory_Container|null
  58. */
  59. private $_dump = null;
  60. /**
  61. * Object constructor
  62. *
  63. * @param integer $objCount
  64. */
  65. public function __construct($objNum, $genNum, $isFree, $dump = null)
  66. {
  67. $this->_objNum = $objNum;
  68. $this->_genNum = $genNum;
  69. $this->_isFree = $isFree;
  70. if ($dump !== null) {
  71. if (strlen($dump) > 1024) {
  72. $this->_dump = Zend_Pdf::getMemoryManager()->create($dump);
  73. } else {
  74. $this->_dump = $dump;
  75. }
  76. }
  77. }
  78. /**
  79. * Get object number
  80. *
  81. * @return integer
  82. */
  83. public function getObjNum()
  84. {
  85. return $this->_objNum;
  86. }
  87. /**
  88. * Get generation number
  89. *
  90. * @return integer
  91. */
  92. public function getGenNum()
  93. {
  94. return $this->_genNum;
  95. }
  96. /**
  97. * Check, that object is free
  98. *
  99. * @return boolean
  100. */
  101. public function isFree()
  102. {
  103. return $this->_isFree;
  104. }
  105. /**
  106. * Get string representation of the object
  107. *
  108. * @return string
  109. */
  110. public function getObjectDump()
  111. {
  112. if ($this->_dump === null) {
  113. return '';
  114. }
  115. if (is_string($this->_dump)) {
  116. return $this->_dump;
  117. }
  118. return $this->_dump->getRef();
  119. }
  120. }