summaryrefslogtreecommitdiffstats
path: root/tests/libsample/objecttypeoperators.cpp
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-12-28 15:24:11 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2010-12-28 19:35:40 -0200
commit670b96db4dd58dc4e265a5e49439f705bb6193c1 (patch)
treea49cc7091c7175a95a16022ad30fa2d5a05ac895 /tests/libsample/objecttypeoperators.cpp
parent5bfe40a435b49cf23aac247d1f6336def879ee71 (diff)
downloadshiboken-670b96db4dd58dc4e265a5e49439f705bb6193c1.tar.gz
shiboken-670b96db4dd58dc4e265a5e49439f705bb6193c1.tar.xz
shiboken-670b96db4dd58dc4e265a5e49439f705bb6193c1.zip
Fix bug#495 - "Broken rich compare operators if they use an object-type as parameter"
Diffstat (limited to 'tests/libsample/objecttypeoperators.cpp')
-rw-r--r--tests/libsample/objecttypeoperators.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/libsample/objecttypeoperators.cpp b/tests/libsample/objecttypeoperators.cpp
new file mode 100644
index 00000000..08c49b1a
--- /dev/null
+++ b/tests/libsample/objecttypeoperators.cpp
@@ -0,0 +1,43 @@
+/*
+ * This file is part of the Shiboken Python Binding Generator project.
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: PySide team <contact@pyside.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "objecttypeoperators.h"
+
+ObjectTypeOperators::ObjectTypeOperators(const std::string key) : m_key(key)
+{
+}
+
+bool ObjectTypeOperators::operator==(const ObjectTypeOperators& other) const
+{
+ return m_key == other.m_key;
+}
+
+bool ObjectTypeOperators::operator==(const std::string& other) const
+{
+ return m_key == other;
+}
+
+const ObjectTypeOperators& ObjectTypeOperators::operator<(const ObjectTypeOperators& other) const
+{
+ return m_key < other.m_key ? *this : other;
+}
+