Last change
on this file since 6788 was
6648,
checked in by bensch, 19 years ago
|
orxonox/trunk: built two new functions for the NETWORK precache
fromResourceableStrin and toResourceableString
these two functions can be used to CACHE a Resource loaded on one Machine on the other one
|
File size:
1.0 KB
|
Rev | Line | |
---|
[4597] | 1 | /*! |
---|
[4220] | 2 | \file substring.h |
---|
| 3 | \brief a small class to get the parts of a string separated by commas |
---|
| 4 | */ |
---|
[3941] | 5 | |
---|
| 6 | #ifndef _SUBSTRING_H |
---|
| 7 | #define _SUBSTRING_H |
---|
[4220] | 8 | |
---|
[4482] | 9 | //! A class that can load one string and split it in multipe ones |
---|
[3941] | 10 | class SubString |
---|
| 11 | { |
---|
[4220] | 12 | public: |
---|
[4734] | 13 | SubString(const char* string, char splitter = ','); |
---|
[5183] | 14 | SubString(const char* string, bool whiteSpaces); |
---|
[5656] | 15 | SubString(const char* string, const char* splitters, char escapeChar ='\\'); |
---|
[4220] | 16 | ~SubString(); |
---|
[4597] | 17 | |
---|
[6648] | 18 | const char* operator[](unsigned int i) { return this->getString(i); }; |
---|
| 19 | |
---|
[5150] | 20 | inline unsigned int getCount() { return this->splittersCount; }; |
---|
| 21 | const char* getString(unsigned int i); |
---|
[5200] | 22 | unsigned int getOffset(unsigned int i); |
---|
[4597] | 23 | |
---|
[4833] | 24 | void debug() const; |
---|
| 25 | |
---|
[4220] | 26 | private: |
---|
[5150] | 27 | char** strings; //!< strings produced from a single string splitted in multiple strings |
---|
[5200] | 28 | unsigned int* offsets; //!< offsets of the beginning of the input-string to the beginning of each substring. |
---|
[5150] | 29 | unsigned int splittersCount; //!< how many splitted parts |
---|
[3941] | 30 | }; |
---|
| 31 | |
---|
| 32 | #endif /* _SUBSTRING_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.