summaryrefslogtreecommitdiff
path: root/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx')
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
index 5dca746d5f25..9dee02a0ac45 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
@@ -148,4 +148,23 @@ const std::string GtvHelpers::getDirPath(const std::string& filePath)
return dirPath;
}
+const std::vector<int> GtvHelpers::splitIntoIntegers(const std::string& aPayload, const std::string& aDelim, const int nItems)
+{
+ std::vector<int> aRet;
+
+ if (!aPayload.empty())
+ {
+ gchar** ppCoordinates = g_strsplit(aPayload.c_str(), aDelim.c_str(), nItems);
+ gchar** ppCoordinate = ppCoordinates;
+ while (*ppCoordinate)
+ {
+ aRet.push_back(atoi(*ppCoordinate));
+ ++ppCoordinate;
+ }
+ g_strfreev(ppCoordinates);
+ }
+
+ return aRet;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */