Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/util/substring.h @ 6693

Last change on this file since 6693 was 6693, checked in by patrick, 18 years ago

branches: removed spaceshipcontrol branche

File size: 1.0 KB
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  const char* operator[](unsigned int i) { return this->getString(i); };
19
20  inline unsigned int getCount() { return this->splittersCount; };
21  const char* getString(unsigned int i);
22  unsigned int getOffset(unsigned int i);
23
24  void debug() const;
25
26 private:
27  char**          strings;                      //!< strings produced from a single string splitted in multiple strings
28  unsigned int*   offsets;                      //!< offsets of the beginning of the input-string to the beginning of each substring.
29  unsigned int    splittersCount;               //!< how many splitted parts
30};
31
32#endif /* _SUBSTRING_H */
Note: See TracBrowser for help on using the repository browser.