From 87ee1fdbffa3c2575015cee307a9cb671b98ce71 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 29 Jul 2008 04:39:59 +0000 Subject: Bump Ingen librdf dependency to 1.0.8. Several serialization fixes. Include Smack 808 Om patches converted to Ingen files. git-svn-id: http://svn.drobilla.net/lad/raul@1301 a436a847-0d15-0410-975c-d299462d15a1 --- src/Path.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Path.cpp b/src/Path.cpp index 04f89e7..24ab2bd 100644 --- a/src/Path.cpp +++ b/src/Path.cpp @@ -128,12 +128,18 @@ Path::replace_invalid_chars(string& str, bool replace_slash) { size_t open_bracket = str.find_first_of('('); if (open_bracket != string::npos) - str = str.substr(0, open_bracket-1); + str = str.substr(0, open_bracket); open_bracket = str.find_first_of('['); if (open_bracket != string::npos) - str = str.substr(0, open_bracket-1); + str = str.substr(0, open_bracket); + if (str[str.length()-1] == ' ') + str = str.substr(0, str.length()-1); + +//#define STRICT_SYMBOLS + +#ifdef STRICT_SYMBOLS // dB = special case, need to avoid CamelCase killing below while (true) { size_t decibels = str.find("dB"); @@ -143,20 +149,25 @@ Path::replace_invalid_chars(string& str, bool replace_slash) break; } - // Kill CamelCase in favour of god_fearing_symbol_names for (size_t i=1; i < str.length(); ++i) { if (str[i] >= 'A' && str[i] <= 'Z' && str[i-1] >= 'a' && str[i-1] <= 'z') str = str.substr(0, i) + '_' + str.substr(i); } +#endif for (size_t i=0; i < str.length(); ++i) { if (str[i] == '\'') { str = str.substr(0, i) + str.substr(i+1); +#ifdef STRICT_SYMBOLS } else if (str[i] >= 'A' && str[i] <= 'Z') { str[i] = std::tolower(str[i]); +#endif } else if ( str[i] != '_' && str[i] != '/' && (str[i] < 'a' || str[i] > 'z') +#ifndef STRICT_SYMBOLS + && (str[i] < 'A' || str[i] > 'Z') +#endif && (str[i] < '0' || str[i] > '9') ) { if (i > 0 && str[i-1] == '_') { str = str.substr(0, i) + str.substr(i+1); -- cgit v1.2.1