Lines Matching refs:this

94         $this->space = $initial_size;
95 $this->bb = $this->newByteBuffer($initial_size);
117 return $this->bb->capacity() - $this->space;
128 $this->bb->putByte(--$this->space, "\0");
141 if ($size > $this->minalign) {
142 $this->minalign = $size;
145 … $align_size = ((~($this->bb->capacity() - $this->space + $additional_bytes)) + 1) & ($size - 1);
146 while ($this->space < $align_size + $size + $additional_bytes) {
147 $old_buf_size = $this->bb->capacity();
148 $this->bb = $this->growByteBuffer($this->bb);
149 $this->space += $this->bb->capacity() - $old_buf_size;
152 $this->pad($align_size);
187 $this->bb->put($this->space -= 1, chr((int)(bool)($x)));
195 $this->bb->put($this->space -= 1, chr($x));
203 $this->bb->put($this->space -= 1, chr($x));
211 $this->bb->putShort($this->space -= 2, $x);
219 $this->bb->putUshort($this->space -= 2, $x);
227 $this->bb->putInt($this->space -= 4, $x);
239 $this->bb->putUint($this->space -= 4, $x);
251 $this->bb->putLong($this->space -= 8, $x);
263 $this->bb->putUlong($this->space -= 8, $x);
271 $this->bb->putFloat($this->space -= 4, $x);
279 $this->bb->putDouble($this->space -= 8, $x);
287 $new_off = $this->offset() - $off + Constants::SIZEOF_INT;
288 $this->putInt($new_off);
298 $this->prep(1, 0);
299 $this->putBool($x);
308 $this->prep(1, 0);
309 $this->putByte($x);
318 $this->prep(1, 0);
319 $this->putSbyte($x);
328 $this->prep(2, 0);
329 $this->putShort($x);
338 $this->prep(2, 0);
339 $this->putUshort($x);
348 $this->prep(4, 0);
349 $this->putInt($x);
358 $this->prep(4, 0);
359 $this->putUint($x);
368 $this->prep(8, 0);
369 $this->putLong($x);
378 $this->prep(8, 0);
379 $this->putUlong($x);
388 $this->prep(4, 0);
389 $this->putFloat($x);
398 $this->prep(8, 0);
399 $this->putDouble($x);
410 if ($this->force_defaults || $x != $d) {
411 $this->addBool($x);
412 $this->slot($o);
423 if ($this->force_defaults || $x != $d) {
424 $this->addByte($x);
425 $this->slot($o);
436 if ($this->force_defaults || $x != $d) {
437 $this->addSbyte($x);
438 $this->slot($o);
449 if ($this->force_defaults || $x != $d) {
450 $this->addShort($x);
451 $this->slot($o);
462 if ($this->force_defaults || $x != $d) {
463 $this->addUshort($x);
464 $this->slot($o);
475 if ($this->force_defaults || $x != $d) {
476 $this->addInt($x);
477 $this->slot($o);
488 if ($this->force_defaults || $x != $d) {
489 $this->addUint($x);
490 $this->slot($o);
501 if ($this->force_defaults || $x != $d) {
502 $this->addLong($x);
503 $this->slot($o);
514 if ($this->force_defaults || $x != $d) {
515 $this->addUlong($x);
516 $this->slot($o);
528 if ($this->force_defaults || $x != $d) {
529 $this->addFloat($x);
530 $this->slot($o);
541 if ($this->force_defaults || $x != $d) {
542 $this->addDouble($x);
543 $this->slot($o);
555 if ($this->force_defaults || $x != $d) {
556 $this->addOffset($x);
557 $this->slot($o);
570 $this->prep(Constants::SIZEOF_INT, 0); // Ensure alignment is already done
571 if ($off > $this->offset()) {
574 $this->putOffset($off);
586 $this->notNested();
587 $this->vector_num_elems = $num_elems;
588 $this->prep(Constants::SIZEOF_INT, $elem_size * $num_elems);
589 $this->prep($alignment, $elem_size * $num_elems); // Just in case alignemnt > int;
597 $this->putUint($this->vector_num_elems);
598 return $this->offset();
717 if (!$this->is_utf8($s)) {
721 $this->notNested();
722 $this->addByte(0); // null terminated
723 $this->startVector(1, strlen($s), 1);
724 $this->space -= strlen($s);
725 for ($i = $this->space, $j = 0 ; $j < strlen($s) ; $i++, $j++) {
726 $this->bb->_buffer[$i] = $s[$j];
728 return $this->endVector();
737 if ($this->nested) {
748 if ($obj != $this->offset()) {
759 $this->notNested();
760 if ($this->vtable == null || count($this->vtable) < $numfields) {
761 $this->vtable = array();
764 $this->vtable_in_use = $numfields;
766 $this->vtable[$i] = 0;
769 $this->nested = true;
770 $this->object_start = $this->offset();
782 $this->nested($x);
783 $this->slot($voffset);
796 $this->nested($x);
797 $this->slot($voffset);
806 $this->vtable[$voffset] = $this->offset();
815 if ($this->vtable == null || !$this->nested) {
819 $this->addInt(0);
820 $vtableloc = $this->offset();
822 $i = $this->vtable_in_use -1;
824 for (; $i >= 0 && $this->vtable[$i] == 0; $i--) {}
827 $off = ($this->vtable[$i] != 0) ? $vtableloc - $this->vtable[$i] : 0;
828 $this->addShort($off);
832 $this->addShort($vtableloc - $this->object_start);
833 $this->addShort(($trimmed_size + $standard_fields) * Constants::SIZEOF_SHORT);
838 for ($i = 0; $i < $this->num_vtables; $i++) {
839 $vt1 = $this->bb->capacity() - $this->vtables[$i];
840 $vt2 = $this->space;
842 $len = $this->bb->getShort($vt1);
844 if ($len == $this->bb->getShort($vt2)) {
846 if ($this->bb->getShort($vt1 + $j) != $this->bb->getShort($vt2 + $j)) {
850 $existing_vtable = $this->vtables[$i];
858 $this->space = $this->bb->capacity() - $vtableloc;
859 $this->bb->putInt($this->space, $existing_vtable - $vtableloc);
863 if ($this->num_vtables == count($this->vtables)) {
864 $vtables = $this->vtables;
865 $this->vtables = array();
868 $this->vtables[$i] = ($i < count($vtables)) ? $vtables[$i] : 0;
871 $this->vtables[$this->num_vtables++] = $this->offset();
872 $this->bb->putInt($this->bb->capacity() - $vtableloc, $this->offset() - $vtableloc);
875 $this->nested = false;
876 $this->vtable = null;
887 $table_start = $this->bb->capacity() - $table;
888 $vtable_start = $table_start - $this->bb->getInt($table_start);
889 $ok = $this->bb->getShort($vtable_start + $field) != 0;
909 $this->prep($this->minalign, Constants::SIZEOF_INT);
910 $this->addOffset($root_table);
911 $this->bb->setPosition($this->space);
913 $this->prep($this->minalign, Constants::SIZEOF_INT + Constants::FILE_IDENTIFIER_LENGTH);
922 $this->addByte(ord($identifier[$i]));
924 $this->finish($root_table);
936 $this->force_defaults = $forceDefaults;
945 return $this->bb;
954 return $this->space;
966 $start = $this->space;
967 $length = $this->bb->capacity() - $this->space;
970 $this->bb->setPosition($start);
971 $this->bb->getX($result);