2
0

UpdateInfoContainer.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. * @package Zend_Pdf
  16. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  17. * @license http://framework.zend.com/license/new-bsd New BSD License
  18. */
  19. /** Zend_Pdf_Element */
  20. require_once 'Zend/Pdf/Element.php';
  21. /** Zend_Pdf_Element_Object */
  22. require_once 'Zend/Pdf/Element/Object.php';
  23. /** Zend_Memory */
  24. require_once 'Zend/Memory.php';
  25. /**
  26. * Container which collects updated object info.
  27. *
  28. * @package Zend_Pdf
  29. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  30. * @license http://framework.zend.com/license/new-bsd New BSD License
  31. */
  32. class Zend_Pdf_UpdateInfoContainer
  33. {
  34. /**
  35. * Object number
  36. *
  37. * @var integer
  38. */
  39. private $_objNum;
  40. /**
  41. * Generation number
  42. *
  43. * @var integer
  44. */
  45. private $_genNum;
  46. /**
  47. * Flag, which signals, that object is free
  48. *
  49. * @var boolean
  50. */
  51. private $_isFree;
  52. /**
  53. * String representation of the object
  54. *
  55. * @var Zend_Memory_Container|null
  56. */
  57. private $_dump = null;
  58. /**
  59. * Object constructor
  60. *
  61. * @param integer $objCount
  62. */
  63. public function __construct($objNum, $genNum, $isFree, $dump = null)
  64. {
  65. $this->_objNum = $objNum;
  66. $this->_genNum = $genNum;
  67. $this->_isFree = $isFree;
  68. if ($dump !== null) {
  69. if (strlen($dump) > 1024) {
  70. $this->_dump = Zend_Pdf::getMemoryManager()->create($dump);
  71. } else {
  72. $this->_dump = $dump;
  73. }
  74. }
  75. }
  76. /**
  77. * Get object number
  78. *
  79. * @return integer
  80. */
  81. public function getObjNum()
  82. {
  83. return $this->_objNum;
  84. }
  85. /**
  86. * Get generation number
  87. *
  88. * @return integer
  89. */
  90. public function getGenNum()
  91. {
  92. return $this->_genNum;
  93. }
  94. /**
  95. * Check, that object is free
  96. *
  97. * @return boolean
  98. */
  99. public function isFree()
  100. {
  101. return $this->_isFree;
  102. }
  103. /**
  104. * Get string representation of the object
  105. *
  106. * @return string
  107. */
  108. public function getObjectDump()
  109. {
  110. if ($this->_dump === null) {
  111. return '';
  112. }
  113. if (is_string($this->_dump)) {
  114. return $this->_dump;
  115. }
  116. return $this->_dump->getRef();
  117. }
  118. }