Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/spaceshipcontrol/src/lib/util/substring.h @ 6429

Last change on this file since 6429 was 5656, checked in by bensch, 19 years ago

orxonox/trunk: new Version of the String-splitter (without Escape-sequence for the time being)

File size: 982 bytes
Line 
1/*!
2  \file substring.h
3  \brief a small class to get the parts of a string separated by commas
4*/
5
6#ifndef _SUBSTRING_H
7#define _SUBSTRING_H
8
9//! A class that can load one string and split it in multipe ones
10class SubString
11{
12 public:
13  SubString(const char* string, char splitter = ',');
14  SubString(const char* string, bool whiteSpaces);
15  SubString(const char* string, const char* splitters, char escapeChar ='\\');
16  ~SubString();
17
18  inline unsigned int getCount() { return this->splittersCount; };
19  const char* getString(unsigned int i);
20  unsigned int getOffset(unsigned int i);
21
22  void debug() const;
23
24 private:
25  char**          strings;                      //!< strings produced from a single string splitted in multiple strings
26  unsigned int*   offsets;                      //!< offsets of the beginning of the input-string to the beginning of each substring.
27  unsigned int    splittersCount;               //!< how many splitted parts
28};
29
30#endif /* _SUBSTRING_H */
Note: See TracBrowser for help on using the repository browser.