summaryrefslogtreecommitdiff
path: root/libs/pbd
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-03-15 19:42:42 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-03-15 19:42:42 +0000
commit702411f6582073e198fb8c6ae6b0ba43b00a5840 (patch)
treefa975802e3e0e5d776f2a06779d1831c16be49d5 /libs/pbd
parent6fadaae2cbc6ed0bc83136cde7536623894f819d (diff)
edit groups tab gets headers (carl); use sampo's SSE find_peaks code; fix build for find_peaks on x86; don't duplicate sources when embedding; use Glib::ustring for all source-related strings; fixup plugin UI automation buttons
git-svn-id: svn://localhost/ardour2/trunk@1595 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd')
-rw-r--r--libs/pbd/pbd/strsplit.h2
-rw-r--r--libs/pbd/strsplit.cc39
2 files changed, 41 insertions, 0 deletions
diff --git a/libs/pbd/pbd/strsplit.h b/libs/pbd/pbd/strsplit.h
index e55ad1c825..f36a3ae5f0 100644
--- a/libs/pbd/pbd/strsplit.h
+++ b/libs/pbd/pbd/strsplit.h
@@ -3,7 +3,9 @@
#include <string>
#include <vector>
+#include <glibmm/ustring.h>
extern void split (std::string, std::vector<std::string>&, char);
+extern void split (Glib::ustring, std::vector<Glib::ustring>&, char);
#endif // __pbd_strplit_h__
diff --git a/libs/pbd/strsplit.cc b/libs/pbd/strsplit.cc
index 7f29a77887..80da357cc0 100644
--- a/libs/pbd/strsplit.cc
+++ b/libs/pbd/strsplit.cc
@@ -1,6 +1,7 @@
#include <pbd/strsplit.h>
using namespace std;
+using namespace Glib;
void
split (string str, vector<string>& result, char splitchar)
@@ -39,3 +40,41 @@ split (string str, vector<string>& result, char splitchar)
result.push_back (remaining);
}
}
+
+void
+split (ustring str, vector<ustring>& result, char splitchar)
+{
+ ustring::size_type pos;
+ ustring remaining;
+ ustring::size_type len = str.length();
+ int cnt;
+
+ cnt = 0;
+
+ if (str.empty()) {
+ return;
+ }
+
+ for (ustring::size_type n = 0; n < len; ++n) {
+ if (str[n] == splitchar) {
+ cnt++;
+ }
+ }
+
+ if (cnt == 0) {
+ result.push_back (str);
+ return;
+ }
+
+ remaining = str;
+
+ while ((pos = remaining.find_first_of (':')) != ustring::npos) {
+ result.push_back (remaining.substr (0, pos));
+ remaining = remaining.substr (pos+1);
+ }
+
+ if (remaining.length()) {
+
+ result.push_back (remaining);
+ }
+}