예제 #1
0
        public void cleanup(Env env)
        {
            QuercusClass     qClass = getQuercusClass();
            AbstractFunction fun    = qClass.getDestructor();

            if (fun != null)
            {
                fun.callMethod(env, qClass, this);
            }
        }
        public bool hasNext()
        {
            if (_needNext)
            {
                _nextFun.callMethod(_env, _qClass, _obj);
            }

            _needNext = true;

            return(_validFun.callMethod(_env, _qClass, _obj).toBoolean());
        }
        public bool rename(Env env, StringValue from, StringValue to)
        {
            // php/1e24
            Value            obj      = _qClass.createObject(env);
            AbstractFunction function = _qClass.findFunction("rename");

            if (function == null)
            {
                return(false);
            }

            Value result = function.callMethod(env, _qClass, obj, from, to);

            return(result.toBoolean());
        }
        public bool unlink(Env env, StringValue path)
        {
            // php/1e23
            Value            obj      = _qClass.createObject(env);
            AbstractFunction function = _qClass.findFunction("unlink");

            if (function == null)
            {
                return(false);
            }

            Value result = function.callMethod(env, _qClass, obj, path);

            return(result.toBoolean());
        }
        public bool stream_metadata(Env env, StringValue path,
                                    LongValue options, Value arg)
        {
            Value            obj      = _qClass.createObject(env);
            AbstractFunction function = _qClass.findFunction("stream_metadata");

            if (function == null)
            {
                return(false);
            }

            Value result = function.callMethod(env, _qClass, obj, path, options, arg);

            return(result.toBoolean());
        }
        public Value url_stat(Env env, StringValue path, LongValue flags)
        {
            // php/1e26
            Value            obj      = _qClass.createObject(env);
            AbstractFunction function = _qClass.findFunction("url_stat");

            if (function == null)
            {
                return(BooleanValue.FALSE);
            }

            Value result = function.callMethod(env, _qClass, obj, path, flags);

            return(result);
        }
        public bool rmdir(Env env, StringValue path, LongValue options)
        {
            // php/1e25
            Value            obj      = _qClass.createObject(env);
            AbstractFunction function = _qClass.findFunction("rmdir");

            if (function == null)
            {
                return(false);
            }

            Value result = function.callMethod(env, _qClass, obj, path, options);

            return(result.toBoolean());
        }
        private Value evalPrivate(Env env, AbstractFunction fun, Value qThis,
                                  Expr [] argExprs)
        {
            Value [] args = evalArgs(env, argExprs);

            env.pushCall(this, qThis, args);

            try {
                env.checkTimeout();

                return(fun.callMethod(env, qThis.getQuercusClass(), qThis, args));
            }
            finally {
                env.popCall();
            }
        }
        public bool mkdir(Env env,
                          StringValue path, LongValue mode, LongValue options)
        {
            // creating an uninitialized object makes no sense but it's here
            // to match PHP 5.3.8 behavior for drupal-7.12
            // php/1e22
            Value            obj      = _qClass.createObject(env);
            AbstractFunction function = _qClass.findFunction("mkdir");

            if (function == null)
            {
                return(false);
            }

            Value result = function.callMethod(env, _qClass, obj, path, mode, options);

            return(result.toBoolean());
        }
        public AbstractIteratorImpl(Env env,
                                    ObjectValue obj)
        {
            _env    = env;
            _qClass = obj.getQuercusClass();
            _obj    = obj;

            if (!obj.isA(env, "iterator"))
            {
                throw new IllegalStateException(L.l("'{0}' @is an invalid iterator", obj));
            }

            _currentFun = _qClass.getFunction(env.createString("current"));
            _keyFun     = _qClass.getFunction(env.createString("key"));
            _nextFun    = _qClass.getFunction(env.createString("next"));
            _rewindFun  = _qClass.getFunction(env.createString("rewind"));
            _validFun   = _qClass.getFunction(env.createString("valid"));

            _rewindFun.callMethod(_env, _qClass, _obj);

            _needNext = false;
        }
 protected Value getCurrentValue()
 {
     return(_currentFun.callMethod(_env, _qClass, _obj));
 }
 protected Value getCurrentKey()
 {
     return(_keyFun.callMethod(_env, _qClass, _obj));
 }