Qore Programming Language  0.8.11.1
BuiltinFunctionList.h
Go to the documentation of this file.
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  BuiltinFunctionList.h
4 
5  Qore programming language
6 
7  Copyright (C) 2003 - 2014 David Nichols
8 
9  Permission is hereby granted, free of charge, to any person obtaining a
10  copy of this software and associated documentation files (the "Software"),
11  to deal in the Software without restriction, including without limitation
12  the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  and/or sell copies of the Software, and to permit persons to whom the
14  Software is furnished to do so, subject to the following conditions:
15 
16  The above copyright notice and this permission notice shall be included in
17  all copies or substantial portions of the Software.
18 
19  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25  DEALINGS IN THE SOFTWARE.
26 
27  Note that the Qore library is released under a choice of three open-source
28  licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
29  information.
30 */
31 
32 #ifndef _QORE_BUILTINFUNCTIONLIST_H
33 
34 #define _QORE_BUILTINFUNCTIONLIST_H
35 
36 #include <qore/common.h>
37 #include <qore/Restrictions.h>
38 #include <qore/QoreThreadLock.h>
39 
40 #include <stdarg.h>
41 
49 class QoreFunction;
50 
52 
56 private:
57  // not implemented
59  DLLLOCAL BuiltinFunctionList& operator=(const BuiltinFunctionList&);
60  DLLLOCAL void *operator new(size_t);
61 
62 public:
63  DLLLOCAL BuiltinFunctionList();
64 
66 
73  DLLEXPORT static void add(const char *name, q_func_t f, int functional_domain = QDOM_DEFAULT);
74 
76 
88  DLLEXPORT static void add2(const char *name, q_func_t f, int64 code_flags = QC_NO_FLAGS, int64 functional_domain = QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo = 0, unsigned num_params = 0, ...);
89 
91 
104  DLLEXPORT static void add3(const char *name, q_func_t f, int64 code_flags = QC_NO_FLAGS, int64 functional_domain = QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo = 0, const type_vec_t &typeList = type_vec_t(), const arg_vec_t &defaultArgList = arg_vec_t());
105 
107 
109  DLLEXPORT static int size();
110 
112 
116  DLLEXPORT static const QoreFunction* find(const char *name);
117 };
118 
120 
122 DLLEXPORT extern BuiltinFunctionList builtinFunctions;
123 
124 #endif // _QORE_BUILTINFUNCTIONLIST_H
static DLLEXPORT void add2(const char *name, q_func_t f, int64 code_flags=QC_NO_FLAGS, int64 functional_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
adds a new builtin function variant to the "Qore" namespace and allows for the return type and parame...
the interface to the global list of all builtin functions in the library
Definition: BuiltinFunctionList.h:55
static DLLEXPORT void add(const char *name, q_func_t f, int functional_domain=QDOM_DEFAULT)
adds a new builtin function variant to the "Qore" namespace
std::vector< AbstractQoreNode * > arg_vec_t
vector of value information for default argument lists
Definition: common.h:211
DLLEXPORT BuiltinFunctionList builtinFunctions
old interface to the compeltely-removed builtin function list; now functions are stored in namespaces...
static DLLEXPORT const QoreFunction * find(const char *name)
finds a function by its name in the current QoreProgram object; if there is none, then returns 0 ...
static unsigned num_params(const QoreListNode *n)
returns the number of arguments passed to the function
Definition: params.h:54
static DLLEXPORT int size()
always returns 0
AbstractQoreNode *(* q_func_t)(const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin function signatures
Definition: common.h:223
static DLLEXPORT void add3(const char *name, q_func_t f, int64 code_flags=QC_NO_FLAGS, int64 functional_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, const type_vec_t &typeList=type_vec_t(), const arg_vec_t &defaultArgList=arg_vec_t())
adds a new builtin function variant to the "Qore" and allows for the return type and parameter types ...
std::vector< const QoreTypeInfo * > type_vec_t
vector of type information for parameter lists
Definition: common.h:208
#define QDOM_DEFAULT
the default domain (no domain)
Definition: Restrictions.h:110