Qore Programming Language  0.8.3
include/qore/CallReferenceNode.h (4311)
00001 /* -*- mode: c++; indent-tabs-mode: nil -*- */
00002 /*
00003  CallReferenceNode.h
00004  
00005  Qore Programming Language
00006  
00007  Copyright 2003 - 2011 David Nichols
00008  
00009  This library is free software; you can redistribute it and/or
00010  modify it under the terms of the GNU Lesser General Public
00011  License as published by the Free Software Foundation; either
00012  version 2.1 of the License, or (at your option) any later version.
00013  
00014  This library is distributed in the hope that it will be useful,
00015  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  Lesser General Public License for more details.
00018  
00019  You should have received a copy of the GNU Lesser General Public
00020  License along with this library; if not, write to the Free Software
00021  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00022  */
00023 
00024 #ifndef _QORE_FUNCTIONREFERENCENODE_H
00025 
00026 #define _QORE_FUNCTIONREFERENCENODE_H
00027 
00029 
00031 class AbstractCallReferenceNode : public AbstractQoreNode {
00032 private:
00034 
00036    DLLLOCAL virtual AbstractQoreNode *realCopy() const;
00037 
00039 
00041    DLLLOCAL virtual bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const;
00042 
00044 
00046    DLLLOCAL virtual bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const;
00047 
00048 protected:
00050 
00052    DLLLOCAL virtual AbstractQoreNode *evalImpl(ExceptionSink *xsink) const;
00053 
00055 
00057    DLLLOCAL virtual AbstractQoreNode *evalImpl(bool &needs_deref, ExceptionSink *xsink) const;
00058 
00060 
00062    DLLLOCAL virtual int64 bigIntEvalImpl(ExceptionSink *xsink) const;
00063 
00065 
00067    DLLLOCAL virtual int integerEvalImpl(ExceptionSink *xsink) const;
00068 
00070 
00072    DLLLOCAL virtual bool boolEvalImpl(ExceptionSink *xsink) const;
00073 
00075 
00077    DLLLOCAL virtual double floatEvalImpl(ExceptionSink *xsink) const;
00078 
00080    DLLLOCAL AbstractCallReferenceNode(bool n_needs_eval, bool n_there_can_be_only_one, qore_type_t n_type = NT_FUNCREF);
00081 
00082 public:
00083    DLLLOCAL AbstractCallReferenceNode(bool n_needs_eval = false, qore_type_t n_type = NT_FUNCREF);
00084 
00085    DLLLOCAL virtual ~AbstractCallReferenceNode();
00086 
00088 
00094    DLLLOCAL virtual int getAsString(QoreString &str, int foff, ExceptionSink *xsink) const;
00095 
00097 
00104    DLLLOCAL virtual QoreString *getAsString(bool &del, int foff, ExceptionSink *xsink) const;
00105 
00107    DLLLOCAL virtual const char *getTypeName() const;
00108 
00109    DLLLOCAL static const char *getStaticTypeName() {
00110       return "call reference";
00111    }
00112 };
00113 
00115 class ResolvedCallReferenceNode : public AbstractCallReferenceNode {
00116 public:
00118    DLLLOCAL ResolvedCallReferenceNode(bool n_needs_eval = false, qore_type_t n_type = NT_FUNCREF);
00119 
00121 
00126    DLLLOCAL virtual AbstractQoreNode *exec(const QoreListNode *args, ExceptionSink *xsink) const = 0;
00127 
00129 
00132    DLLLOCAL virtual QoreProgram *getProgram() const;
00133 
00134    DLLLOCAL virtual AbstractQoreFunction *getFunction() = 0;
00135 
00136    DLLLOCAL ResolvedCallReferenceNode *refRefSelf() const {
00137       ref();
00138       return const_cast<ResolvedCallReferenceNode *>(this);
00139    }
00140 };
00141 
00142 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines