aboutsummaryrefslogtreecommitdiffstats
path: root/tests/libsample
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2013-12-31 14:30:53 -0500
committerJohn Cummings <jcummings2@users.sf.net>2014-01-07 21:48:39 +0100
commita527dd51e69b80c2d5be3a1d8cd60ab2b2616fa5 (patch)
treef0cfee0759f3e6b0547655b887646db1b9869a04 /tests/libsample
parentfaa44f349170667fb918fc25e51cc5f392bfc6ad (diff)
Fix for containers with 'const' values
Fix omission of 'const' specifier when generating binding code for containers whose value type is 'const', which would lead to binding code that does not compile due to 'const' mismatch. Includes test case. Change-Id: Iff99a16ee071bb255f78e86e2456e5206cc00cfb Reviewed-by: John Cummings <jcummings2@users.sf.net>
Diffstat (limited to 'tests/libsample')
-rw-r--r--tests/libsample/cvlist.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/libsample/cvlist.h b/tests/libsample/cvlist.h
new file mode 100644
index 000000000..77b7eca9b
--- /dev/null
+++ b/tests/libsample/cvlist.h
@@ -0,0 +1,47 @@
+/*
+ * This file is part of the Shiboken Python Binding Generator project.
+ *
+ * Copyright (C) 2013 Digia Plc 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
+ */
+
+#ifndef CONSTVALUELIST_H
+#define CONSTVALUELIST_H
+
+#include <list>
+#include "libsamplemacros.h"
+
+class CVValueType
+{
+ CVValueType();
+};
+
+typedef std::list<const CVValueType*> const_ptr_value_list;
+
+// This tests binding generation for a container of a const value type. The
+// class doesn't need to do anything; this is just to verify that the generated
+// binding code (the container conversion in particular) is const-valid.
+
+class CVListUser
+{
+public:
+ static const_ptr_value_list produce() { return const_ptr_value_list(); }
+ static void consume(const const_ptr_value_list& l) { (void)l; }
+};
+
+#endif // LIST_H