Hollowfires

Untitled

Apr 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. #ifndef CSTRTOKENIZER_H
  2. #define CSTRTOKENIZER_H
  3.  
  4. #include <string>
  5. #include <vector>
  6. using namespace std;
  7.  
  8. class CStrTokenizer
  9. {
  10. private:
  11. vector<string> tokens; // vector of strings containing tokens
  12. int it; // vector iterator index for getNextToken function
  13. bool atEnd; // flag true if we reached end of vector with our getNextToken function
  14. void StringTokenize(const string& str, vector<string>& tokens, const string& delimiters);
  15.  
  16. public:
  17. // constructor for CStrTokenizer class
  18. CStrTokenizer(string str, string delim, bool includeDelim);
  19.  
  20. // function to return vector of string of tokens
  21. vector<string> getTokens();
  22.  
  23. // "iterator" like function to return the current token in the vector
  24. string getNextToken();
  25.  
  26. // function to determine if we have more tokens left to read from vector when using the
  27. // getNextToken function
  28. bool hasMoreTokens();
  29.  
  30. // function to reset the "iterator" back to the beginning if needed
  31. void reset();
  32.  
  33. };
  34.  
  35. #endif
Advertisement
Add Comment
Please, Sign In to add comment