summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-08-18 14:20:10 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-08-18 14:20:10 +0000
commitc8f5d847e530083a7aa658dad9a37af7b4647615 (patch)
tree60c55c879a31ab92614f10b8f6f2722448f8f87a
parentbc9d6f66c127f06c37f89ba6477fd1156a9e43f6 (diff)
step one of removing Glib::ustring from ardour2
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@10003 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/pbd/basename.cc9
-rw-r--r--libs/pbd/convert.cc46
-rw-r--r--libs/pbd/copyfile.cc2
-rw-r--r--libs/pbd/pbd/basename.h4
-rw-r--r--libs/pbd/pbd/convert.h2
-rw-r--r--libs/pbd/pbd/copyfile.h4
-rw-r--r--libs/pbd/pbd/shortpath.h4
-rw-r--r--libs/pbd/pbd/strsplit.h2
-rw-r--r--libs/pbd/pbd/whitespace.h5
-rw-r--r--libs/pbd/shortpath.cc21
-rw-r--r--libs/pbd/strsplit.cc38
-rw-r--r--libs/pbd/whitespace.cc9
12 files changed, 21 insertions, 125 deletions
diff --git a/libs/pbd/basename.cc b/libs/pbd/basename.cc
index 0b631f4249..702f711eb4 100644
--- a/libs/pbd/basename.cc
+++ b/libs/pbd/basename.cc
@@ -20,13 +20,12 @@
#include <pbd/basename.h>
#include <glibmm/miscutils.h>
-using Glib::ustring;
+using std::string;
-ustring
-PBD::basename_nosuffix (ustring str)
+string
+PBD::basename_nosuffix (const string& str)
{
- ustring base = Glib::path_get_basename (str);
-
+ string base = Glib::path_get_basename (str);
return base.substr (0, base.find_last_of ('.'));
}
diff --git a/libs/pbd/convert.cc b/libs/pbd/convert.cc
index 598473c244..622e1dfdd4 100644
--- a/libs/pbd/convert.cc
+++ b/libs/pbd/convert.cc
@@ -31,7 +31,6 @@
using std::string;
using std::vector;
-using Glib::ustring;
namespace PBD {
@@ -196,51 +195,6 @@ url_decode (string& url)
}
}
-void
-url_decode (ustring& url)
-{
- ustring::iterator last;
- ustring::iterator next;
-
- for (ustring::iterator i = url.begin(); i != url.end(); ++i) {
- if ((*i) == '+') {
- next = i;
- ++next;
- url.replace (i, next, 1, ' ');
- }
- }
-
- if (url.length() <= 3) {
- return;
- }
-
- last = url.end();
-
- --last; /* points at last char */
- --last; /* points at last char - 1 */
-
- for (ustring::iterator i = url.begin(); i != last; ) {
-
- if (*i == '%') {
-
- next = i;
-
- url.erase (i);
-
- i = next;
- ++next;
-
- if (isxdigit (*i) && isxdigit (*next)) {
- /* replace first digit with char */
- url.replace (i, next, 1, (gunichar) int_from_hex (*i,*next));
- ++i; /* points at 2nd of 2 digits */
- url.erase (i);
- }
- } else {
- ++i;
- }
- }
-}
#if 0
string
diff --git a/libs/pbd/copyfile.cc b/libs/pbd/copyfile.cc
index 2284a6b26d..a6177fe8bc 100644
--- a/libs/pbd/copyfile.cc
+++ b/libs/pbd/copyfile.cc
@@ -30,7 +30,7 @@ using namespace PBD;
using namespace std;
int
-PBD::copy_file (Glib::ustring from, Glib::ustring to)
+PBD::copy_file (const string& from, const string& to)
{
ifstream in (from.c_str());
ofstream out (to.c_str());
diff --git a/libs/pbd/pbd/basename.h b/libs/pbd/pbd/basename.h
index f13c3840dc..42b6295713 100644
--- a/libs/pbd/pbd/basename.h
+++ b/libs/pbd/pbd/basename.h
@@ -20,12 +20,12 @@
#ifndef __stupid_basename_h__
#define __stupid_basename_h__
-#include <glibmm/ustring.h>
+#include <string>
namespace PBD
{
-Glib::ustring basename_nosuffix (Glib::ustring);
+std::string basename_nosuffix (const std::string&);
}
diff --git a/libs/pbd/pbd/convert.h b/libs/pbd/pbd/convert.h
index f8358e8801..7270265cb2 100644
--- a/libs/pbd/pbd/convert.h
+++ b/libs/pbd/pbd/convert.h
@@ -25,7 +25,6 @@
#include <vector>
#include <sstream>
#include <iostream>
-#include <glibmm/ustring.h>
namespace PBD {
@@ -34,7 +33,6 @@ std::string short_version (std::string, std::string::size_type target_length);
int atoi (const std::string&);
double atof (const std::string&);
void url_decode (std::string&);
-void url_decode (Glib::ustring&);
// std::string length2string (const int32_t frames, const float sample_rate);
std::string length2string (const int64_t frames, const double sample_rate);
diff --git a/libs/pbd/pbd/copyfile.h b/libs/pbd/pbd/copyfile.h
index 1e8c5c2a42..74bdf4516c 100644
--- a/libs/pbd/pbd/copyfile.h
+++ b/libs/pbd/pbd/copyfile.h
@@ -17,9 +17,9 @@
*/
-#include <glibmm/ustring.h>
+#include <string>
namespace PBD {
- int copy_file (Glib::ustring from, Glib::ustring to);
+ int copy_file (const std::string& from, const std::string& to);
}
diff --git a/libs/pbd/pbd/shortpath.h b/libs/pbd/pbd/shortpath.h
index 55431bf34e..dacd1ebbfe 100644
--- a/libs/pbd/pbd/shortpath.h
+++ b/libs/pbd/pbd/shortpath.h
@@ -20,8 +20,8 @@
#ifndef __pbd_shortpath_h__
#define __pbd_shortpath_h__
-#include <glibmm/ustring.h>
+#include <string>
-Glib::ustring short_path (const Glib::ustring& path, Glib::ustring::size_type target_characters);
+std::string short_path (const std::string& path, std::string::size_type target_characters);
#endif /* __pbd_shortpath_h__ */
diff --git a/libs/pbd/pbd/strsplit.h b/libs/pbd/pbd/strsplit.h
index 25c4526b6a..f235448b31 100644
--- a/libs/pbd/pbd/strsplit.h
+++ b/libs/pbd/pbd/strsplit.h
@@ -22,9 +22,7 @@
#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/pbd/whitespace.h b/libs/pbd/pbd/whitespace.h
index dcdb4e5f27..444be112b0 100644
--- a/libs/pbd/pbd/whitespace.h
+++ b/libs/pbd/pbd/whitespace.h
@@ -22,16 +22,11 @@
#include <string>
-namespace Glib {
- class ustring;
-}
-
namespace PBD {
// returns the empty string if the entire string is whitespace
// so check length after calling.
extern void strip_whitespace_edges (std::string& str);
-extern void strip_whitespace_edges (Glib::ustring& str);
} // namespace PBD
diff --git a/libs/pbd/shortpath.cc b/libs/pbd/shortpath.cc
index f5a6f696a7..069fed32c2 100644
--- a/libs/pbd/shortpath.cc
+++ b/libs/pbd/shortpath.cc
@@ -22,26 +22,25 @@
#include <stdint.h>
-using namespace Glib;
-using namespace std;
+using std::string;
-ustring
-short_path (const Glib::ustring& path, ustring::size_type target_characters)
+string
+short_path (const std::string& path, string::size_type target_characters)
{
- ustring::size_type last_sep;
- ustring::size_type len = path.length();
+ string::size_type last_sep;
+ string::size_type len = path.length();
const char separator = '/';
if (len <= target_characters) {
return path;
}
- if ((last_sep = path.find_last_of (separator)) == ustring::npos) {
+ if ((last_sep = path.find_last_of (separator)) == string::npos) {
/* just a filename, but its too long anyway */
if (target_characters > 3) {
- return path.substr (0, target_characters - 3) + ustring ("...");
+ return path.substr (0, target_characters - 3) + string ("...");
} else {
/* stupid caller, just hand back the whole thing */
return path;
@@ -53,7 +52,7 @@ short_path (const Glib::ustring& path, ustring::size_type target_characters)
/* even the filename itself is too long */
if (target_characters > 3) {
- return path.substr (last_sep+1, target_characters - 3) + ustring ("...");
+ return path.substr (last_sep+1, target_characters - 3) + string ("...");
} else {
/* stupid caller, just hand back the whole thing */
return path;
@@ -64,12 +63,12 @@ short_path (const Glib::ustring& path, ustring::size_type target_characters)
uint32_t space_for = target_characters - so_far;
if (space_for >= 3) {
- ustring res = "...";
+ string res = "...";
res += path.substr (last_sep - space_for);
return res;
} else {
/* remove part of the end */
- ustring res = "...";
+ string res = "...";
res += path.substr (last_sep - space_for, len - last_sep + space_for - 3);
res += "...";
return res;
diff --git a/libs/pbd/strsplit.cc b/libs/pbd/strsplit.cc
index 342daadaa2..74c4a9b3ef 100644
--- a/libs/pbd/strsplit.cc
+++ b/libs/pbd/strsplit.cc
@@ -20,7 +20,6 @@
#include <pbd/strsplit.h>
using namespace std;
-using namespace Glib;
void
split (string str, vector<string>& result, char splitchar)
@@ -60,40 +59,3 @@ split (string str, vector<string>& result, char splitchar)
}
}
-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 (splitchar)) != ustring::npos) {
- result.push_back (remaining.substr (0, pos));
- remaining = remaining.substr (pos+1);
- }
-
- if (remaining.length()) {
-
- result.push_back (remaining);
- }
-}
diff --git a/libs/pbd/whitespace.cc b/libs/pbd/whitespace.cc
index 126039842e..808b990edd 100644
--- a/libs/pbd/whitespace.cc
+++ b/libs/pbd/whitespace.cc
@@ -78,13 +78,4 @@ strip_whitespace_edges (string& str)
}
}
-void
-strip_whitespace_edges (Glib::ustring& str)
-{
- string copy (str.raw());
- strip_whitespace_edges (copy);
- str = copy;
-}
-
-
} // namespace PBD