4 public function __construct(){}
5 static function hasField($o, $field) {
6 return _hx_has_field($o, $field);
8 static function field($o, $field) {
9 return _hx_field($o, $field);
11 static function setField($o, $field, $value) {
12 $o->{$field} = $value;
14 static function getProperty($o, $field) {
18 $cls = ((Std::is($o, _hx_qtype("Class"))) ? $o->__tname__ : get_class($o));
19 $cls_vars = get_class_vars($cls);
20 if(isset($cls_vars['__properties__']) && isset($cls_vars['__properties__']['get_'.$field]) && ($field = $cls_vars['__properties__']['get_'.$field])) {
26 static function setProperty($o, $field, $value) {
31 $cls = ((Std::is($o, _hx_qtype("Class"))) ? $o->__tname__ : get_class($o));
32 $cls_vars = get_class_vars($cls);
33 if(isset($cls_vars['__properties__']) && isset($cls_vars['__properties__']['set_'.$field]) && ($field = $cls_vars['__properties__']['set_'.$field])) {
41 static function callMethod($o, $func, $args) {
42 if(is_string($o) && !is_array($func)) {
43 return call_user_func_array(Reflect::field($o, $func), $args->»a);
45 return call_user_func_array(((is_callable($func)) ? $func : array($o, $func)), ((null === $args) ? array() : $args->»a));
47 static function fields($o) {
49 return new _hx_array(array());
51 return (($o instanceof _hx_array) ? new _hx_array(array('concat','copy','insert','iterator','length','join','pop','push','remove','reverse','shift','slice','sort','splice','toString','unshift')) : ((is_string($o)) ? new _hx_array(array('charAt','charCodeAt','indexOf','lastIndexOf','length','split','substr','toLowerCase','toString','toUpperCase')) : new _hx_array(_hx_get_object_vars($o))));
53 static function isFunction($f) {
54 return (is_array($f) && is_callable($f)) || _hx_is_lambda($f) || is_array($f) && _hx_has_field($f[0], $f[1]) && $f[1] !== "length";
56 static function compare($a, $b) {
57 return (($a == $b) ? 0 : (($a > $b) ? 1 : -1));
59 static function compareMethods($f1, $f2) {
60 if(is_array($f1) && is_array($f1)) {
61 return $f1[0] === $f2[0] && $f1[1] == $f2[1];
63 if(is_string($f1) && is_string($f2)) {
64 return _hx_equal($f1, $f2);
68 static function isObject($v) {
73 return $v instanceof _hx_anonymous || Type::getClass($v) !== null;
75 return is_string($v) && !_hx_is_lambda($v);
77 static function deleteField($o, $f) {
78 if(!_hx_has_field($o, $f)) {
81 if(isset($o->»dynamics[$f])) unset($o->»dynamics[$f]); else if($o instanceof _hx_anonymous) unset($o->$f); else $o->$f = null;
84 static function copy($o) {
88 $o2 = _hx_anonymous(array());
90 $_g = 0; $_g1 = Reflect::fields($o);
91 while($_g < $_g1->length) {
94 $o2->{$f} = Reflect::field($o, $f);
100 static function makeVarArgs($f) {
101 return array(new _hx_lambda(array(&$f), '_hx_make_var_args'), 'execute');
103 function __toString() { return 'Reflect'; }