Index: code/branches/network/src/util/SubString.cc
===================================================================
--- code/branches/network/src/util/SubString.cc	(revision 1371)
+++ code/branches/network/src/util/SubString.cc	(revision 1494)
@@ -1,38 +1,3 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Christian Meyer
- *   Co-authors:
- *      Benjamin Grauer
- *
-//
-//  splitLine
-//  STL string tokenizer
-//
-//  Created by Clemens Wacha.
-//  Version 1.0
-//  Copyright (c) 2005 Clemens Wacha. All rights reserved.
-//
- */
-
+/* *   ORXONOX - the hottest 3D action shooter ever to exist *                    > www.orxonox.net < * * *   License notice: * *   This program is free software; you can redistribute it and/or *   modify it under the terms of the GNU General Public License *   as published by the Free Software Foundation; either version 2 *   of the License, or (at your option) any later version. * *   This program is distributed in the hope that it will be useful, *   but WITHOUT ANY WARRANTY; without even the implied warranty of *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *   GNU General Public License for more details. * *   You should have received a copy of the GNU General Public License *   along with this program; if not, write to the Free Software *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. * *   Author: *      Christian Meyer *   Co-authors: *      Benjamin Grauer *////  splitLine//  STL string tokenizer////  Created by Clemens Wacha.//  Version 1.0//  Copyright (c) 2005 Clemens Wacha. All rights reserved.// */
 #include "SubString.h"
 
@@ -67,6 +32,5 @@
 SubString::SubString(const std::string& string,
                      const std::string& delimiters, const std::string& delimiterNeighbours, bool emptyEntries,
-                     char escapeChar, bool removeEscapeChar, char safemode_char, bool removeSafemodeChar,
-                     char openparenthesis_char, char closeparenthesis_char, bool removeParenthesisChars, char comment_char)
+                     char escapeChar, bool removeEscapeChar, char safemode_char, bool removeSafemodeChar,                     char openparenthesis_char, char closeparenthesis_char, bool removeParenthesisChars, char comment_char)
 {
   SubString::splitLine(this->strings, this->bInSafemode, string, delimiters, delimiterNeighbours, emptyEntries, escapeChar, removeEscapeChar, safemode_char, removeSafemodeChar, openparenthesis_char, closeparenthesis_char, removeParenthesisChars, comment_char);
@@ -80,9 +44,6 @@
 SubString::SubString(const SubString& subString, unsigned int subSetBegin)
 {
-  for (unsigned int i = subSetBegin; i < subString.size(); i++)
-  {
-    this->strings.push_back(subString[i]);
-    this->bInSafemode.push_back(subString.isInSafemode(i));
-  }
+  for (unsigned int i = subSetBegin; i < subString.size(); i++)  {
+    this->strings.push_back(subString[i]);    this->bInSafemode.push_back(subString.isInSafemode(i));  }
 }
 
@@ -96,9 +57,6 @@
 SubString::SubString(const SubString& subString, unsigned int subSetBegin, unsigned int subSetEnd)
 {
-  for (unsigned int i = subSetBegin; i < subString.size() && i < subSetEnd; i++)
-  {
-    this->strings.push_back(subString[i]);
-    this->bInSafemode.push_back(subString.isInSafemode(i));
-  }
+  for (unsigned int i = subSetBegin; i < subString.size() && i < subSetEnd; i++)  {
+    this->strings.push_back(subString[i]);    this->bInSafemode.push_back(subString.isInSafemode(i));  }
 }
 
@@ -110,9 +68,6 @@
 SubString::SubString(unsigned int argc, const char** argv)
 {
-  for(unsigned int i = 0; i < argc; ++i)
-  {
-    this->strings.push_back(std::string(argv[i]));
-    this->bInSafemode.push_back(false);
-  }
+  for(unsigned int i = 0; i < argc; ++i)  {
+    this->strings.push_back(std::string(argv[i]));    this->bInSafemode.push_back(false);  }
 }
 
@@ -139,6 +94,5 @@
 SubString& SubString::operator=(const SubString& subString)
 {
-  this->strings = subString.strings;
-  this->bInSafemode = subString.bInSafemode;
+  this->strings = subString.strings;  this->bInSafemode = subString.bInSafemode;
   return *this;
 }
@@ -201,9 +155,6 @@
 SubString& SubString::operator+=(const SubString& subString)
 {
-  for (unsigned int i = 0; i < subString.size(); i++)
-  {
-    this->strings.push_back(subString[i]);
-    this->bInSafemode.push_back(subString.isInSafemode(i));
-  }
+  for (unsigned int i = 0; i < subString.size(); i++)  {
+    this->strings.push_back(subString[i]);    this->bInSafemode.push_back(subString.isInSafemode(i));  }
   return *this;
 }
@@ -217,6 +168,5 @@
 unsigned int SubString::split(const std::string& string, char splitter)
 {
-  this->strings.clear();
-  this->bInSafemode.clear();
+  this->strings.clear();  this->bInSafemode.clear();
   char split[2];
   split[0] = splitter;
@@ -239,9 +189,7 @@
 unsigned int SubString::split(const std::string& string,
                               const std::string& delimiters, const std::string& delimiterNeighbours, bool emptyEntries,
-                              char escapeChar, bool removeExcapeChar, char safemode_char, bool removeSafemodeChar,
-                              char openparenthesis_char, char closeparenthesis_char, bool removeParenthesisChars, char comment_char)
-{
-  this->strings.clear();
-  this->bInSafemode.clear();
+                              char escapeChar, bool removeExcapeChar, char safemode_char, bool removeSafemodeChar,                              char openparenthesis_char, char closeparenthesis_char, bool removeParenthesisChars, char comment_char)
+{
+  this->strings.clear();  this->bInSafemode.clear();
   SubString::splitLine(this->strings, this->bInSafemode, string, delimiters, delimiterNeighbours, emptyEntries, escapeChar, removeExcapeChar, safemode_char, removeSafemodeChar, openparenthesis_char, closeparenthesis_char, removeParenthesisChars, comment_char);
   return this->strings.size();
@@ -309,9 +257,5 @@
  * @param emptyEntries: if empty Strings are added to the List of Strings.
  * @param escape_char: Escape carater (escapes splitters)
- * @param safemode_char: the beginning of the safemode is marked with this
- * @param removeSafemodeChar removes the safemode_char from the beginning and the ending of a token
- * @param openparenthesis_char the beginning of a safemode is marked with this
- * @param closeparenthesis_char the ending of a safemode is marked with this
- * @param removeParenthesisChars removes the parenthesis from the beginning and the ending of a token
+ * @param safemode_char: the beginning of the safemode is marked with this * @param removeSafemodeChar removes the safemode_char from the beginning and the ending of a token * @param openparenthesis_char the beginning of a safemode is marked with this * @param closeparenthesis_char the ending of a safemode is marked with this * @param removeParenthesisChars removes the parenthesis from the beginning and the ending of a token
  * @param comment_char: the beginning of a comment is marked with this: (until the end of a Line)
  * @param start_state: the Initial state on how to parse the String.
@@ -323,17 +267,11 @@
  */
 SubString::SPLIT_LINE_STATE
-SubString::splitLine(std::vector<std::string>& ret,
-                     std::vector<bool>& bInSafemode,
+SubString::splitLine(std::vector<std::string>& ret,                     std::vector<bool>& bInSafemode,
                      const std::string& line,
                      const std::string& delimiters,
                      const std::string& delimiterNeighbours,
                      bool emptyEntries,
-                     char escape_char,
-                     bool removeExcapeChar,
-                     char safemode_char,
-                     bool removeSafemodeChar,
-                     char openparenthesis_char,
-                     char closeparenthesis_char,
-                     bool removeParenthesisChars,
+                     char escape_char,                     bool removeExcapeChar,
+                     char safemode_char,                     bool removeSafemodeChar,                     char openparenthesis_char,                     char closeparenthesis_char,                     bool removeParenthesisChars,
                      char comment_char,
                      SPLIT_LINE_STATE start_state)
@@ -343,18 +281,8 @@
   unsigned int fallBackNeighbours = 0;
 
-  std::string token;
-  bool inSafemode = false;
-
-  if(start_state != SL_NORMAL && ret.size() > 0)
-  {
-    token = ret[ret.size()-1];
-    ret.pop_back();
-  }
-  if(start_state != SL_NORMAL && bInSafemode.size() > 0)
-  {
-    inSafemode = bInSafemode[bInSafemode.size()-1];
-    bInSafemode.pop_back();
-  }
-
+  std::string token;  bool inSafemode = false;
+
+  if(start_state != SL_NORMAL && ret.size() > 0)  {    token = ret[ret.size()-1];
+    ret.pop_back();  }  if(start_state != SL_NORMAL && bInSafemode.size() > 0)  {    inSafemode = bInSafemode[bInSafemode.size()-1];    bInSafemode.pop_back();  }
   while(i < line.size())
   {
@@ -364,22 +292,10 @@
         if(line[i] == escape_char)
         {
-          state = SL_ESCAPE;
-          if (!removeExcapeChar)
-            token += line[i];
+          state = SL_ESCAPE;          if (!removeExcapeChar)            token += line[i];
         }
         else if(line[i] == safemode_char)
         {
-          state = SL_SAFEMODE;
-          inSafemode = true;
-          if (!removeSafemodeChar)
-            token += line[i];
-        }
-        else if(line[i] == openparenthesis_char)
-        {
-          state = SL_PARENTHESES;
-          inSafemode = true;
-          if (!removeParenthesisChars)
-            token += line[i];
-        }
+          state = SL_SAFEMODE;          inSafemode = true;          if (!removeSafemodeChar)            token += line[i];
+        }        else if(line[i] == openparenthesis_char)        {          state = SL_PARENTHESES;          inSafemode = true;          if (!removeParenthesisChars)            token += line[i];        }
         else if(line[i] == comment_char)
         {
@@ -389,9 +305,5 @@
           if(emptyEntries || token.size() > 0)
           {
-            ret.push_back(token);
-            token.clear();
-            bInSafemode.push_back(inSafemode);
-            inSafemode = false;
-          }
+            ret.push_back(token);            token.clear();            bInSafemode.push_back(inSafemode);            inSafemode = false;          }
           token += line[i];       // EAT
           state = SL_COMMENT;
@@ -407,7 +319,5 @@
             ret.push_back(token);
             token.clear();
-            bInSafemode.push_back(inSafemode);
-            inSafemode = false;
-          }
+            bInSafemode.push_back(inSafemode);            inSafemode = false;          }
           state = SL_NORMAL;
         }
@@ -429,9 +339,5 @@
         }
         break;
-      case SL_ESCAPE:
-        if (!removeSafemodeChar)
-          token += line[i];
-        else
-        {
+      case SL_ESCAPE:        if (!removeSafemodeChar)          token += line[i];        else        {
           if(line[i] == 'n') token += '\n';
           else if(line[i] == 't') token += '\t';
@@ -442,6 +348,5 @@
           else if(line[i] == 'a') token += '\a';
           else if(line[i] == '?') token += '\?';
-          else token += line[i];  // EAT
-        }
+          else token += line[i];  // EAT        }
         state = SL_NORMAL;
         break;
@@ -450,7 +355,5 @@
         {
           state = SL_NORMAL;
-          if (!removeSafemodeChar)
-            token += line[i];
-        }
+          if (!removeSafemodeChar)            token += line[i];        }
         else if(line[i] == escape_char)
         {
@@ -461,7 +364,5 @@
           token += line[i];       // EAT
         }
-        break;
-
-      case SL_SAFEESCAPE:
+        break;      case SL_SAFEESCAPE:
         if(line[i] == 'n') token += '\n';
         else if(line[i] == 't') token += '\t';
@@ -475,35 +376,5 @@
         state = SL_SAFEMODE;
         break;
-
-      case SL_PARENTHESES:
-        if(line[i] == closeparenthesis_char)
-        {
-          state = SL_NORMAL;
-          if (!removeParenthesisChars)
-            token += line[i];
-        }
-        else if(line[i] == escape_char)
-        {
-          state = SL_PARENTHESESESCAPE;
-        }
-        else
-        {
-          token += line[i];       // EAT
-        }
-        break;
-
-      case SL_PARENTHESESESCAPE:
-        if(line[i] == 'n') token += '\n';
-        else if(line[i] == 't') token += '\t';
-        else if(line[i] == 'v') token += '\v';
-        else if(line[i] == 'b') token += '\b';
-        else if(line[i] == 'r') token += '\r';
-        else if(line[i] == 'f') token += '\f';
-        else if(line[i] == 'a') token += '\a';
-        else if(line[i] == '?') token += '\?';
-        else token += line[i];  // EAT
-        state = SL_PARENTHESES;
-        break;
-
+      case SL_PARENTHESES:        if(line[i] == closeparenthesis_char)        {          state = SL_NORMAL;          if (!removeParenthesisChars)            token += line[i];        }        else if(line[i] == escape_char)        {          state = SL_PARENTHESESESCAPE;        }        else        {          token += line[i];       // EAT        }        break;      case SL_PARENTHESESESCAPE:        if(line[i] == 'n') token += '\n';        else if(line[i] == 't') token += '\t';        else if(line[i] == 'v') token += '\v';        else if(line[i] == 'b') token += '\b';        else if(line[i] == 'r') token += '\r';        else if(line[i] == 'f') token += '\f';        else if(line[i] == 'a') token += '\a';        else if(line[i] == '?') token += '\?';        else token += line[i];  // EAT        state = SL_PARENTHESES;        break;
       case SL_COMMENT:
         if(line[i] == '\n')
@@ -514,7 +385,5 @@
             ret.push_back(token);
             token.clear();
-            bInSafemode.push_back(inSafemode);
-            inSafemode = false;
-          }
+            bInSafemode.push_back(inSafemode);            inSafemode = false;          }
           state = SL_NORMAL;
         }
@@ -539,7 +408,5 @@
     ret.push_back(token);
     token.clear();
-    bInSafemode.push_back(inSafemode);
-    inSafemode = false;
-  }
+    bInSafemode.push_back(inSafemode);    inSafemode = false;  }
   return(state);
 }
