FairRoot/PandaRoot
PndStringSeparator.h
Go to the documentation of this file.
1 #ifndef PNDSTRINGSEPARATOR_H
23 #define PNDSTRINGSEPARATOR_H
24 
25 #include <string>
26 #include <vector>
27 #include "Rtypes.h"
28 
29 
31 {
32  public :
35  PndStringSeparator(std::string AInput, std::string ADelimiter = " ");
36  void SetInput (std::string AInput) {fInput = AInput;};
37  void SetDelimiter (std::string ADelimiter) {fDelimiter = ADelimiter;};
38  void ResetVector(){fStrings.clear();};
39  std::vector<std::string> GetStringVector (void);
40  void TestFirst(){if(fInput.find_first_of(fDelimiter)==0) fFirstDel=true; else fFirstDel=false;}
41  void TestLast(){if(fInput.find_last_of(fDelimiter)==fInput.size()-1) fLastDel = true; else fLastDel = false;}
42  bool GetIfFirst(){return fFirstDel;}
43  bool GetIfLast(){return fLastDel;}
44  std::string Replace(std::string from, std::string to);
45  void Print();
46 
47  private :
48  std::string::size_type fStartPos;
49  std::vector<std::string> fStrings;
50  std::string fInput;
51  std::string fDelimiter;
52  std::string fOutput;
53  std::string GetString (void);
54  bool fFirstDel; //first element in the string was a delimiter
55  bool fLastDel; //last element in the string was a delimiter
56 };
57 
58 #endif
std::vector< std::string > GetStringVector(void)
std::string Replace(std::string from, std::string to)
std::vector< std::string > fStrings
std::string::size_type fStartPos
void SetInput(std::string AInput)
void SetDelimiter(std::string ADelimiter)
std::string GetString(void)