Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 31, 2008, 11:24:44 PM (16 years ago)
Author:
rgrieder
Message:
  • set the svn:eol-style property to all files so, that where ever you check out, you'll get the right line endings (had to change every file with mixed endings to windows in order to set the property)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/util/SubString.h

    • Property svn:eol-style set to native
    r1349 r1494  
    1 /*
    2  *   ORXONOX - the hottest 3D action shooter ever to exist
    3  *                    > www.orxonox.net <
    4  *
    5  *
    6  *   License notice:
    7  *
    8  *   This program is free software; you can redistribute it and/or
    9  *   modify it under the terms of the GNU General Public License
    10  *   as published by the Free Software Foundation; either version 2
    11  *   of the License, or (at your option) any later version.
    12  *
    13  *   This program is distributed in the hope that it will be useful,
    14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  *   GNU General Public License for more details.
    17  *
    18  *   You should have received a copy of the GNU General Public License
    19  *   along with this program; if not, write to the Free Software
    20  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    21  *
    22  *   Author:
    23  *      Christian Meyer
    24  *   Co-authors:
    25  *      Benjamin Grauer
    26  *      Fabian 'x3n' Landau
    27  *
    28 
    29 //  splitLine
    30 //  STL string tokenizer
    31 //
    32 //  Created by Clemens Wacha.
    33 //  Version 1.0
    34 //  Copyright (c) 2005 Clemens Wacha. All rights reserved.
    35 
    36  * Extended by Fabian 'x3n' Landau with the SL_PARENTHESES mode.
    37  */
    38 
    39  /*!
     1/* *   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 *      Fabian 'x3n' Landau *//  splitLine//  STL string tokenizer////  Created by Clemens Wacha.//  Version 1.0//  Copyright (c) 2005 Clemens Wacha. All rights reserved. * Extended by Fabian 'x3n' Landau with the SL_PARENTHESES mode. */ /*!
    402 * @file substring.h
    413 * @brief a small class to get the parts of a string separated by commas
     
    6022
    6123#include "UtilPrereqs.h"
    62 
    6324#include <vector>
    6425#include <string>
     
    7839    SL_SAFEMODE,          //!< In safe mode (between "" mostly).
    7940    SL_SAFEESCAPE,        //!< In safe mode with the internal escape character, that escapes even the savemode character.
    80     SL_COMMENT,           //!< In Comment mode.
    81     SL_PARENTHESES,       //!< Between parentheses (usually '(' and ')')
    82     SL_PARENTHESESESCAPE, //!< Between parentheses with the internal escape character, that escapes even the closing paranthesis character.
     41    SL_COMMENT,           //!< In Comment mode.    SL_PARENTHESES,       //!< Between parentheses (usually '(' and ')')    SL_PARENTHESESESCAPE, //!< Between parentheses with the internal escape character, that escapes even the closing paranthesis character.
    8342  } SPLIT_LINE_STATE;
    8443
     
    8948  SubString(const std::string& string,
    9049            const std::string& delimiters, const std::string& delimiterNeighbours = "", bool emptyEntries=false,
    91             char escapeChar ='\\', bool removeEscapeChar = true, char safemode_char = '"', bool removeSafemodeChar = true,
    92             char openparenthesis_char = '(', char closeparenthesis_char = ')',  bool removeParenthesisChars = true, char comment_char = '\0');
     50            char escapeChar ='\\', bool removeEscapeChar = true, char safemode_char = '"', bool removeSafemodeChar = true,            char openparenthesis_char = '(', char closeparenthesis_char = ')',  bool removeParenthesisChars = true, char comment_char = '\0');
    9351  SubString(unsigned int argc, const char** argv);
    9452  /** @brief create a Substring as a copy of another one. @param subString the SubString to copy. */
     
    11371  unsigned int split(const std::string& string,
    11472                     const std::string& delimiters, const std::string& delimiterNeighbours = "", bool emptyEntries = false,
    115                      char escapeChar ='\\', bool removeExcapeChar = true, char safemode_char = '"', bool removeSafemodeChar = true,
    116                      char openparenthesis_char = '(', char closeparenthesis_char = ')',  bool removeParenthesisChars = true, char comment_char = '\0');
     73                     char escapeChar ='\\', bool removeExcapeChar = true, char safemode_char = '"', bool removeSafemodeChar = true,                     char openparenthesis_char = '(', char closeparenthesis_char = ')',  bool removeParenthesisChars = true, char comment_char = '\0');
    11774  std::string join(const std::string& delimiter = " ") const;
    11875  ////////////////////////////////////////
     
    13087  inline const std::string& operator[](unsigned int i) const { return this->strings[i]; };
    13188  /** @brief Returns the i'th string from the subset of Strings @param i the i'th String */
    132   inline const std::string& getString(unsigned int i) const { return (*this)[i]; };
    133   /** @brief Returns true if the token is in safemode. @param i the i'th token */
    134   inline bool isInSafemode(unsigned int i) const { return this->bInSafemode[i]; }
     89  inline const std::string& getString(unsigned int i) const { return (*this)[i]; };  /** @brief Returns true if the token is in safemode. @param i the i'th token */  inline bool isInSafemode(unsigned int i) const { return this->bInSafemode[i]; }
    13590  /** @brief Returns the front of the StringList. */
    13691  inline const std::string& front() const { return this->strings.front(); };
     
    14196
    14297  // the almighty algorithm.
    143   static SPLIT_LINE_STATE splitLine(std::vector<std::string>& ret,
    144                                     std::vector<bool>& bInSafemode,
     98  static SPLIT_LINE_STATE splitLine(std::vector<std::string>& ret,                                    std::vector<bool>& bInSafemode,
    14599                                    const std::string& line,
    146100                                    const std::string& delimiters = SubString::WhiteSpaces,
    147101                                    const std::string& delimiterNeighbours = "",
    148102                                    bool emptyEntries = false,
    149                                     char escape_char = '\\',
    150                                     bool removeExcapeChar = true,
     103                                    char escape_char = '\\',                                    bool removeExcapeChar = true,
    151104                                    char safemode_char = '"',
    152                                     bool removeSafemodeChar = true,
    153                                     char openparenthesis_char = '(',
    154                                     char closeparenthesis_char = ')',
    155                                     bool removeParenthesisChars = true,
    156                                     char comment_char = '\0',
     105                                    bool removeSafemodeChar = true,                                    char openparenthesis_char = '(',                                    char closeparenthesis_char = ')',                                    bool removeParenthesisChars = true,                                    char comment_char = '\0',
    157106                                    SPLIT_LINE_STATE start_state = SL_NORMAL);
    158107  // debugging.
     
    165114
    166115private:
    167   std::vector<std::string>  strings;                      //!< strings produced from a single string splitted in multiple strings
    168   std::vector<bool>         bInSafemode;
     116  std::vector<std::string>  strings;                      //!< strings produced from a single string splitted in multiple strings  std::vector<bool>         bInSafemode;
    169117};
    170118
Note: See TracChangeset for help on using the changeset viewer.