Switched to a new coding style, which plays nicely with the Reader/Writer. This new style allows REFLECT to be used instead of REFLECT_N in most places.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@15 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-10-11 22:26:55 +00:00
parent 33abea6221
commit 9de743030e
51 changed files with 1041 additions and 767 deletions
+20 -3
View File
@@ -52,7 +52,7 @@ String trim(const String& s){
}
}
String trimLeft(const String& s) {
String trim_left(const String& s) {
size_t start = s.find_first_not_of(_(' '));
if (start == String::npos) {
return String();
@@ -63,7 +63,7 @@ String trimLeft(const String& s) {
// ----------------------------------------------------------------------------- : Words
String lastWord(const String& s) {
String last_word(const String& s) {
size_t endLastWord = s.find_last_not_of(_(' '));
size_t startLastWord = s.find_last_of( _(' '), endLastWord);
if (endLastWord == String::npos) {
@@ -75,7 +75,7 @@ String lastWord(const String& s) {
}
}
String stripLastWord(const String& s) {
String strip_last_word(const String& s) {
size_t endLastWord = s.find_last_not_of(_(' '));
size_t startLastWord = s.find_last_of(_(' '), endLastWord);
if (endLastWord == String::npos || startLastWord == String::npos) {
@@ -116,3 +116,20 @@ String capitalize(const String& s) {
}
return result;
}
String cannocial_name_form(const String& str) {
String ret;
ret.reserve(str.size());
bool leading = true;
FOR_EACH_CONST(c, str) {
if ((c == _('_') || c == _(' ')) && !leading) {
ret += _('_');
} else if (isAlnum(c)) {
ret += toLower(c);
leading = false;
} else {
// ignore non alpha numeric
}
}
return ret;
}