Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9313 in orxonox.OLD


Ignore:
Timestamp:
Jul 18, 2006, 1:43:21 AM (18 years ago)
Author:
bensch
Message:

orxonox/proxy: new substring functions

Location:
branches/proxy/src/lib/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/util/substring.cc

    r9312 r9313  
    2727
    2828#include "substring.h"
    29 #include <cassert>
    30 
    3129
    3230/**
  • branches/proxy/src/lib/util/substring.h

    r8408 r9313  
    22 * @file substring.h
    33 * @brief a small class to get the parts of a string separated by commas
     4 *
     5 * This class is also identified as a Tokenizer. It splits up one long
     6 * String into multiple small ones by a designated Delimiter.
     7 *
     8 * Substring is Advanced, and it is possible, to split a string by ','
     9 * but also removing leading and trailing spaces around the comma.
     10 *
     11 * @example
     12 * Split the String std::string st = "1345, The new empire   , is , orxonox"
     13 * is splitted with:
     14 * SubString(st, ',', " \n\t")
     15 * into
     16 * "1345", "The new empire", "is", "orxonox"
     17 * As you can see, the useless spaces around ',' were removed.
    418 */
    519
    6 #ifndef _SUBSTRING_H
    7 #define _SUBSTRING_H
     20#ifndef __SUBSTRING_H__
     21#define __SUBSTRING_H__
    822
    923#include <vector>
     
    7387  /** @param i the i'th String @returns the i'th string from the subset of Strings */
    7488  inline const std::string& getString(unsigned int i) const { return (*this)[i]; };
     89  /** @returns the front of the StringList. */
     90  inline const std::string& front() const { return this->strings.front(); };
     91  /** @returns the back of the StringList. */
     92  inline const std::string& back() const { return this->strings.back(); };
    7593
    7694  // the almighty algorithm.
     
    97115};
    98116
    99 #endif /* _SUBSTRING_H */
     117#endif /* __SUBSTRING_H__ */
Note: See TracChangeset for help on using the changeset viewer.