diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-09 19:45:27 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-09 19:45:27 +0000 |
commit | f4f8ac034fa04404e2fcd5029ba050c537c07d7a (patch) | |
tree | 0daa81b0533ce203c33d5571dcb842257dba4cd0 /src/function.cpp | |
parent | 4488b6112c4e22493ed88c68035b980a5b42228d (diff) | |
download | abakus-f4f8ac034fa04404e2fcd5029ba050c537c07d7a.tar.gz abakus-f4f8ac034fa04404e2fcd5029ba050c537c07d7a.zip |
TQt4 port Abakus
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/abakus@1231045 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/function.cpp')
-rw-r--r-- | src/function.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/function.cpp b/src/function.cpp index 742bdd3..a61b8f9 100644 --- a/src/function.cpp +++ b/src/function.cpp @@ -20,9 +20,9 @@ #include <kdebug.h> -#include <qvaluevector.h> -#include <qstring.h> -#include <qregexp.h> +#include <tqvaluevector.h> +#include <tqstring.h> +#include <tqregexp.h> #include <math.h> @@ -35,7 +35,7 @@ class DupFinder : public NodeFunctor { public: - DupFinder(const QString &nameToFind) : + DupFinder(const TQString &nameToFind) : m_name(nameToFind), m_valid(true) { } @@ -55,7 +55,7 @@ class DupFinder : public NodeFunctor } private: - QString m_name; + TQString m_name; bool m_valid; }; @@ -70,27 +70,27 @@ FunctionManager *FunctionManager::instance() return m_manager; } -FunctionManager::FunctionManager(QObject *parent, const char *name) : - QObject(parent, name) +FunctionManager::FunctionManager(TQObject *tqparent, const char *name) : + TQObject(tqparent, name) { m_dict.setAutoDelete(true); } // Dummy return value to enable static initialization in the DECL_*() // macros. -bool FunctionManager::addFunction(const QString &name, function_t fn, const QString &desc) +bool FunctionManager::addFunction(const TQString &name, function_t fn, const TQString &desc) { Function *newFn = new Function; - QRegExp returnTrigRE("^a(cos|sin|tan)"); - QRegExp needsTrigRE("^(cos|sin|tan)"); - QString fnName(name); + TQRegExp returnTrigRE("^a(cos|sin|tan)"); + TQRegExp needsTrigRE("^(cos|sin|tan)"); + TQString fnName(name); newFn->name = name; newFn->description = desc; newFn->fn = fn; newFn->userDefined = false; - newFn->returnsTrig = fnName.contains(returnTrigRE); - newFn->needsTrig = fnName.contains(needsTrigRE); + newFn->returnsTrig = fnName.tqcontains(returnTrigRE); + newFn->needsTrig = fnName.tqcontains(needsTrigRE); m_dict.insert(name, newFn); @@ -135,24 +135,24 @@ DECLARE_FUNC1(floor, "Nearest lesser integer"); DECLARE_FUNC2(int, integer, "Integral part of number"); DECLARE_FUNC1(frac, "Fractional part of number"); -Function *FunctionManager::function(const QString &name) +Function *FunctionManager::function(const TQString &name) { return m_dict[name]; } // Returns true if the named identifier is a function, false otherwise. -bool FunctionManager::isFunction(const QString &name) +bool FunctionManager::isFunction(const TQString &name) { return function(name) != 0; } -bool FunctionManager::isFunctionUserDefined(const QString &name) +bool FunctionManager::isFunctionUserDefined(const TQString &name) { const Function *fn = function(name); return (fn != 0) && (fn->userDefined); } -bool FunctionManager::addFunction(BaseFunction *fn, const QString &dependantVar) +bool FunctionManager::addFunction(BaseFunction *fn, const TQString &dependantVar) { // First see if this function is recursive DupFinder dupFinder(fn->name()); @@ -168,7 +168,7 @@ bool FunctionManager::addFunction(BaseFunction *fn, const QString &dependantVar) UserFunction *newFn = new UserFunction; newFn->sequenceNumber = m_dict.count(); newFn->fn = fn; - newFn->varName = QString(dependantVar); + newFn->varName = TQString(dependantVar); // Now setup the Function data structure that holds the information // we need to access and call the function later. @@ -179,16 +179,16 @@ bool FunctionManager::addFunction(BaseFunction *fn, const QString &dependantVar) fnTabEntry->needsTrig = false; fnTabEntry->userDefined = true; - if(m_dict.find(fn->name())) + if(m_dict.tqfind(fn->name())) emit signalFunctionRemoved(fn->name()); - m_dict.replace(fn->name(), fnTabEntry); + m_dict.tqreplace(fn->name(), fnTabEntry); emit signalFunctionAdded(fn->name()); return true; } -void FunctionManager::removeFunction(const QString &name) +void FunctionManager::removeFunction(const TQString &name) { Function *fn = function(name); @@ -205,7 +205,7 @@ void FunctionManager::removeFunction(const QString &name) fn->userFn = 0; m_dict.remove(name); - QDictIterator<Function> it(m_dict); + TQDictIterator<Function> it(m_dict); for (; it.current(); ++it) { UserFunction *userFn = it.current()->userDefined ? it.current()->userFn : 0; if(userFn && userFn->sequenceNumber > savedSeqNum) @@ -214,10 +214,10 @@ void FunctionManager::removeFunction(const QString &name) } } -QStringList FunctionManager::functionList(FunctionManager::FunctionType type) +TQStringList FunctionManager::functionList(FunctionManager::FunctionType type) { - QDictIterator<Function> it(m_dict); - QStringList functions; + TQDictIterator<Function> it(m_dict); + TQStringList functions; switch(type) { case Builtin: @@ -230,8 +230,8 @@ QStringList FunctionManager::functionList(FunctionManager::FunctionType type) // We want to return the function names in the order they were // added. { - QValueVector<Function *> fnTable(m_dict.count(), 0); - QValueVector<int> sequenceNumberTable(m_dict.count(), -1); + TQValueVector<Function *> fnTable(m_dict.count(), 0); + TQValueVector<int> sequenceNumberTable(m_dict.count(), -1); // First find out what sequence numbers we have. for(; it.current(); ++it) |