mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 00:34:59 +01:00
merged with 1697 revision of trunk (which is post-rc1 but pre-rc2
git-svn-id: svn://localhost/ardour2/branches/2.1-staging@1698 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
4bf712f501
commit
45d3ec1437
696 changed files with 48513 additions and 22850 deletions
|
|
@ -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] == gunichar(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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue