mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 04:06:26 +01:00
use isspace() and not isgraph() to identify whitespace; remove Glib::ustring version of strip_whitespace_edges()
git-svn-id: svn://localhost/ardour2/branches/3.0@7773 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
4d112a8e6b
commit
c1ee2c6943
2 changed files with 2 additions and 16 deletions
|
|
@ -22,16 +22,11 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Glib {
|
|
||||||
class ustring;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace PBD {
|
namespace PBD {
|
||||||
|
|
||||||
// returns the empty string if the entire string is whitespace
|
// returns the empty string if the entire string is whitespace
|
||||||
// so check length after calling.
|
// so check length after calling.
|
||||||
extern void strip_whitespace_edges (std::string& str);
|
extern void strip_whitespace_edges (std::string& str);
|
||||||
extern void strip_whitespace_edges (Glib::ustring& str);
|
|
||||||
|
|
||||||
} // namespace PBD
|
} // namespace PBD
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pbd/whitespace.h"
|
#include "pbd/whitespace.h"
|
||||||
#include <glibmm/ustring.h>
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
@ -40,7 +39,7 @@ strip_whitespace_edges (string& str)
|
||||||
/* strip front */
|
/* strip front */
|
||||||
|
|
||||||
for (i = 0; i < len; ++i) {
|
for (i = 0; i < len; ++i) {
|
||||||
if (isgraph (str[i])) {
|
if (!isspace (str[i])) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -63,7 +62,7 @@ strip_whitespace_edges (string& str)
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (isgraph (str[i]) || i == 0) {
|
if (!isspace (str[i]) || i == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,12 +77,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
|
} // namespace PBD
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue