summaryrefslogtreecommitdiffstats
path: root/overloaddata.h
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-09-02 02:21:23 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-09-02 02:21:23 -0300
commit0e137b5969f73a980827058e724bcdd00a2e0802 (patch)
tree5aef3712401455c33f16271ee387b71787d986a4 /overloaddata.h
parent146a43e6ab75e97c92ebef8cf7c218e8eb3a5c4a (diff)
downloadshiboken-0e137b5969f73a980827058e724bcdd00a2e0802.tar.gz
shiboken-0e137b5969f73a980827058e724bcdd00a2e0802.tar.xz
shiboken-0e137b5969f73a980827058e724bcdd00a2e0802.zip
renamed PolymorphicData class to OverloadData, this should represent correctly
the class' function; other relative renamings were also performed
Diffstat (limited to 'overloaddata.h')
-rw-r--r--overloaddata.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/overloaddata.h b/overloaddata.h
new file mode 100644
index 00000000..508aca78
--- /dev/null
+++ b/overloaddata.h
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the Shiboken Python Bindings Generator project.
+ *
+ * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: PySide team <contact@pyside.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef OVERLOADDATA_H
+#define OVERLOADDATA_H
+
+#include <apiextractor/abstractmetalang.h>
+#include <QtCore/QList>
+#include <QtCore/QBitArray>
+
+class OverloadData;
+typedef QList<OverloadData*> OverloadDataList;
+
+class OverloadData
+{
+public:
+ OverloadData(const AbstractMetaFunctionList overloads);
+
+ int minArgs() const { return m_headOverloadData->m_minArgs; }
+ int maxArgs() const { return m_headOverloadData->m_maxArgs; }
+ int argPos() const { return m_argPos; }
+
+ const AbstractMetaType* argType() const { return m_argType; }
+ const AbstractMetaFunction* referenceFunction() const;
+ const AbstractMetaArgument* argument(const AbstractMetaFunction* func) const;
+ OverloadDataList overloadDataOnPosition(int argPos) const;
+
+ bool isHeadOverloadData() const { return this == m_headOverloadData; }
+ bool hasDefaultValue() const;
+ bool nextArgumentHasDefaultValue() const;
+ bool isFinalOccurrence(const AbstractMetaFunction* func) const;
+
+ QList<const AbstractMetaFunction*> overloads() const { return m_overloads; }
+ OverloadDataList nextOverloadData() const { return m_nextOverloadData; }
+
+ QList<int> invalidArgumentLengths() const;
+
+ static int numberOfRemovedArguments(const AbstractMetaFunction* func, int finalArgPos = -1);
+ static QPair<int, int> getMinMaxArguments(const AbstractMetaFunctionList overloads);
+
+ void dumpGraph(QString filename) const;
+ QString dumpGraph() const;
+
+ ~OverloadData();
+
+private:
+ OverloadData(OverloadData* headOverloadData, const AbstractMetaFunction* func,
+ const AbstractMetaType* argType, int argPos);
+
+ void addOverload(const AbstractMetaFunction* func);
+ OverloadData* addOverloadData(const AbstractMetaFunction* func, const AbstractMetaType* argType);
+
+ int functionNumber(const AbstractMetaFunction* func) const;
+ OverloadDataList overloadDataOnPosition(OverloadData* overloadData, int argPos) const;
+
+ int m_minArgs;
+ int m_maxArgs;
+ int m_argPos;
+ const AbstractMetaType* m_argType;
+ QList<const AbstractMetaFunction*> m_overloads;
+
+ OverloadData* m_headOverloadData;
+ OverloadDataList m_nextOverloadData;
+};
+
+
+#endif // OVERLOADDATA_H