1 /* 2 * Copyright 2006-2008 The FLWOR Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #pragma once 17 #ifndef ZORBA_FUNCTION_LIBRARY_H 18 #define ZORBA_FUNCTION_LIBRARY_H 19 20 #include "functions/function_consts.h" 21 22 23 namespace zorba 24 { 25 26 class static_context; 27 class function; 28 29 30 class BuiltinFunctionLibrary 31 { 32 friend class GlobalEnvironment; 33 34 public: 35 static function ** theFunctions; 36 37 public: getFunction(FunctionConsts::FunctionKind kind)38 static function* getFunction(FunctionConsts::FunctionKind kind) 39 { 40 return theFunctions[kind]; 41 } 42 43 private: 44 static void create(static_context* sctx); 45 46 static void destroy(); 47 }; 48 49 50 51 #define GET_BUILTIN_FUNCTION(func_code) \ 52 BuiltinFunctionLibrary::getFunction(FunctionConsts::func_code) 53 54 55 } 56 57 #endif 58 59 /* 60 * Local variables: 61 * mode: c++ 62 * End: 63 */ 64 /* vim:set et sw=2 ts=2: */ 65