public function onData($data) { $b = com_wiris_system_TypeTools::string2ByteData_iso8859_1($data); $store = $this->plugin->getStorageAndCache(); $store->storeData($this->digest, "png", $b->b); $bs = $b->b; $this->call->returnBytes($bs); }
static function compare($a, $b, $eps) { if (com_wiris_system_TypeTools::isHash($a)) { $isBHash = com_wiris_system_TypeTools::isHash($b); if (!$isBHash) { return false; } $ha = $a; $hb = $b; $it = $ha->keys(); while ($it->hasNext()) { $key = $it->next(); if (!$hb->exists($key) || !com_wiris_util_json_JSon::compare($ha->get($key), $hb->get($key), $eps)) { return false; } unset($key); } return true; } else { if (com_wiris_system_TypeTools::isArray($a)) { $isBArray = com_wiris_system_TypeTools::isArray($b); if (!$isBArray) { return false; } $aa = $a; $ab = $b; if ($aa->length !== $ab->length) { return false; } $i = null; $_g1 = 0; $_g = $aa->length; while ($_g1 < $_g) { $i1 = $_g1++; if (!com_wiris_util_json_JSon::compare($aa[$i1], $ab[$i1], $eps)) { return false; } unset($i1); } return true; } else { if (Std::is($a, _hx_qtype("String"))) { if (!Std::is($b, _hx_qtype("String"))) { return false; } return _hx_equal($a, $b); } else { if (Std::is($a, _hx_qtype("Int"))) { if (!Std::is($b, _hx_qtype("Int"))) { return false; } return _hx_equal($a, $b); } else { if (Std::is($a, _hx_qtype("haxe.Int64"))) { $isBLong = Std::is($b, _hx_qtype("haxe.Int64")); if (!$isBLong) { return false; } return _hx_equal($a, $b); } else { if (Std::is($a, _hx_qtype("com.wiris.util.json.JSonIntegerFormat"))) { if (!Std::is($b, _hx_qtype("com.wiris.util.json.JSonIntegerFormat"))) { return false; } $ja = $a; $jb = $b; return $ja->toString() === $jb->toString(); } else { if (Std::is($a, _hx_qtype("Bool"))) { if (!Std::is($b, _hx_qtype("Bool"))) { return false; } return _hx_equal($a, $b); } else { if (Std::is($a, _hx_qtype("Float"))) { if (!Std::is($b, _hx_qtype("Float"))) { return false; } $da = com_wiris_util_json_JSon::getFloat($a); $db = com_wiris_util_json_JSon::getFloat($b); return $da >= $db - $eps && $da <= $db + $eps; } } } } } } } } return true; }
static function getDepth($o) { if (com_wiris_system_TypeTools::isHash($o)) { $h = $o; $m = 0; if ($h->exists("_left_") || $h->exists("_right_")) { if ($h->exists("_left_")) { $m = com_wiris_common_WInteger::max(com_wiris_util_json_JSon::getDepth($h->get("_left_")), $m); } if ($h->exists("_right_")) { $m = com_wiris_common_WInteger::max(com_wiris_util_json_JSon::getDepth($h->get("_right_")), $m); } return $m; } $iter = $h->keys(); while ($iter->hasNext()) { $key = $iter->next(); $m = com_wiris_common_WInteger::max(com_wiris_util_json_JSon::getDepth($h->get($key)), $m); unset($key); } return $m + 2; } else { if (com_wiris_system_TypeTools::isArray($o)) { $a = $o; $i = null; $m = 0; $_g1 = 0; $_g = $a->length; while ($_g1 < $_g) { $i1 = $_g1++; $m = com_wiris_common_WInteger::max(com_wiris_util_json_JSon::getDepth($a[$i1]), $m); unset($i1); } return $m + 1; } else { return 1; } } }