diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | e9ae80694875f869892f13f4fcaf1170a00dea41 (patch) | |
tree | aa2f8d8a217e2d376224c8d46b7397b68d35de2d /kommander/widget/function.h | |
download | tdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.tar.gz tdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kommander/widget/function.h')
-rw-r--r-- | kommander/widget/function.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/kommander/widget/function.h b/kommander/widget/function.h new file mode 100644 index 00000000..fbd8b99b --- /dev/null +++ b/kommander/widget/function.h @@ -0,0 +1,73 @@ +/*************************************************************************** + function.h - Functions for internal parser + ------------------- + copyright : (C) 2004 Michal Rudolf <mrudolf@kdewebdwev.org> + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _HAVE_FUNCTION_H_ +#define _HAVE_FUNCTION_H_ + +#include "parsenode.h" +#include <qvaluevector.h> + +class Parser; + +typedef QValueVector<ParseNode> ParameterList; +typedef QValueVector<Parse::ValueType> TypeList; +typedef ParseNode(*FunctionPointer)(Parser*, const ParameterList&); + +class Function +{ + public: + /* default constructor - empty function */ + Function(); + /* construct a function from parameterlist */ + Function(FunctionPointer fp, Parse::ValueType value, const TypeList& params, uint min = 99999, + uint max = 0); + /* construct a function from parameters */ + Function(FunctionPointer fp, Parse::ValueType value, Parse::ValueType param1, uint min = 99999, + uint max = 0); + Function(FunctionPointer fp, Parse::ValueType value, Parse::ValueType param1, Parse::ValueType param2, + uint min = 99999, uint max = 0); + Function(FunctionPointer fp, Parse::ValueType value, Parse::ValueType param1, Parse::ValueType param2, + Parse::ValueType param3, uint min = 99999, uint max = 0); + Function(FunctionPointer fp, Parse::ValueType value, Parse::ValueType param1, Parse::ValueType param2, + Parse::ValueType param3, Parse::ValueType param4, uint min = 99999, uint max = 0); + Function(FunctionPointer fp, Parse::ValueType value, Parse::ValueType param1, Parse::ValueType param2, + Parse::ValueType param3, Parse::ValueType param4, Parse::ValueType param5, + uint min = 99999, uint max = 0); + /* if function returns value */ + bool isVoid() const; + /* type of returned value */ + Parse::ValueType returnValue() const; + /* type of i-th argument */ + Parse::ValueType argType(uint i) const; + /* minimum number of arguments */ + uint minArgs() const; + /* maximum number of arguments */ + uint maxArgs() const; + /* check whether given list is appropriate for this function */ + bool isValid(const ParameterList& params) const; + /* execute */ + ParseNode execute(Parser* P, const ParameterList& params) const; + +private: + FunctionPointer m_function; + TypeList m_params; + Parse::ValueType m_returnValue; + uint m_minArgs; + uint m_maxArgs; +}; + +#endif + |