X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Flsolesen%2Fpel%2Fsrc%2FPelEntrySLong.php;fp=vendor%2Flsolesen%2Fpel%2Fsrc%2FPelEntrySLong.php;h=c596a48f96507a77c4e359706291d77d9e34be48;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=0000000000000000000000000000000000000000;hpb=74df008bdbb3a11eeea356744f39b802369bda3c;p=yaffs-website diff --git a/vendor/lsolesen/pel/src/PelEntrySLong.php b/vendor/lsolesen/pel/src/PelEntrySLong.php new file mode 100644 index 000000000..c596a48f9 --- /dev/null +++ b/vendor/lsolesen/pel/src/PelEntrySLong.php @@ -0,0 +1,99 @@ + + * @license http://www.gnu.org/licenses/gpl.html GNU General Public + * License (GPL) + * @package PEL + */ + +/** + * Class for holding signed longs. + * + * This class can hold longs, either just a single long or an array of + * longs. The class will be used to manipulate any of the Exif tags + * which can have format {@link PelFormat::SLONG}. + * + * @author Martin Geisler + * @package PEL + */ +class PelEntrySLong extends PelEntryNumber +{ + + /** + * Make a new entry that can hold a signed long. + * + * The method accept its arguments in two forms: several integer + * arguments or a single array argument. The {@link getValue} + * method will always return an array except for when a single + * integer argument is given here, or when an array with just a + * single integer is given. + * + * @param + * PelTag the tag which this entry represents. This + * should be one of the constants defined in {@link PelTag} + * which have format {@link PelFormat::SLONG}. + * + * @param int $value... + * the long(s) that this entry will represent + * or an array of longs. The argument passed must obey the same + * rules as the argument to {@link setValue}, namely that it should + * be within range of a signed long (32 bit), that is between + * -2147483648 and 2147483647 (inclusive). If not, then a {@link + * PelOverflowException} will be thrown. + */ + public function __construct($tag, $value = null) + { + $this->tag = $tag; + $this->min = - 2147483648; + $this->max = 2147483647; + $this->format = PelFormat::SLONG; + + $value = func_get_args(); + array_shift($value); + $this->setValueArray($value); + } + + /** + * Convert a number into bytes. + * + * @param + * int the number that should be converted. + * + * @param + * PelByteOrder one of {@link PelConvert::LITTLE_ENDIAN} and + * {@link PelConvert::BIG_ENDIAN}, specifying the target byte order. + * + * @return string bytes representing the number given. + */ + public function numberToBytes($number, $order) + { + return PelConvert::sLongToBytes($number, $order); + } +}