BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
StringParse.h
Go to the documentation of this file.
1// --------------------------------------------------
2//
3// File: GeneratorModule/StringParse.h
4// Description:
5// This code is used to parse a string.
6// It breaks it into components which are seperated by spaces
7// in the original.
8// Three methods can then be called to
9// Return the nth component as a string (piece method)
10// Return the nth component as an integer (intpiece method) if conversion is possible, returns -1 if it is off the end and 0 if it cannot be converted
11// Return the nth component as a double (numpiece method) if conversion is possible, returns -1.1 if it is off the end and 0 if it cannot be converted
12// AuthorList:
13// Ian Hinchliffe April 2000
14
15#ifndef STRINGPARSE_H
16#define STRINGPARSE_H
17#include <string>
18#include <vector>
20public:
21 StringParse(std::string input); //constructor
22 StringParse(); //constructor
23 ~StringParse(); //constructor
24 std::string piece(const int & num);
25 int intpiece(const int & num);
26 long longpiece(const int & num);
27 float numpiece(const int & num);
28 unsigned string_size(void) const;
29
30private:
31 std::string m_lstring;
32 std::vector<std::string> m_lsubstring;
33 int m_nword;
34 std::string m_past_end;
35};
36
37
38inline unsigned
40{ return m_nword; }
41
42#endif
unsigned string_size(void) const
Definition: StringParse.h:39
int intpiece(const int &num)
Definition: StringParse.cxx:39
float numpiece(const int &num)
Definition: StringParse.cxx:57
std::string piece(const int &num)
Definition: StringParse.cxx:31
long longpiece(const int &num)
Definition: StringParse.cxx:48