aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsample/strlist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/tests/libsample/strlist.cpp')
-rw-r--r--sources/shiboken6/tests/libsample/strlist.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/libsample/strlist.cpp b/sources/shiboken6/tests/libsample/strlist.cpp
new file mode 100644
index 000000000..5840a0516
--- /dev/null
+++ b/sources/shiboken6/tests/libsample/strlist.cpp
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#include "strlist.h"
+
+#include <algorithm>
+
+bool StrList::operator==(const std::list<Str> &other) const
+{
+ return size() == other.size()
+ && std::equal(begin(), end(), other.begin());
+}
+
+Str StrList::join(const Str &sep) const
+{
+ Str result;
+ const auto i1 = begin();
+ const auto i2 = end();
+ for (auto it = i1; i1 != i2; ++it) {
+ if (it != i1)
+ result.append(sep);
+ result.append(*it);
+ }
+ return result;
+}