BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
StringParse Class Reference

#include <StringParse.h>

Public Member Functions

 StringParse (std::string input)
 
 StringParse ()
 
 ~StringParse ()
 
std::string piece (const int &num)
 
int intpiece (const int &num)
 
long longpiece (const int &num)
 
float numpiece (const int &num)
 
unsigned string_size (void) const
 
 StringParse (std::string input)
 
 StringParse ()
 
 ~StringParse ()
 
std::string piece (const int &num)
 
int intpiece (const int &num)
 
long longpiece (const int &num)
 
float numpiece (const int &num)
 
unsigned string_size (void) const
 

Detailed Description

Constructor & Destructor Documentation

◆ StringParse() [1/4]

StringParse::StringParse ( std::string  input)

Definition at line 17 of file StringParse.cxx.

17 {
18 m_past_end="?!?";
19 m_lstring=input;
20 m_nword=0;
21 std::string::size_type pos=0;
22 std::string::size_type prev_pos=0;
23 while((pos=input.find_first_of(' ',pos)) != std::string::npos){
24 m_lsubstring.push_back(input.substr(prev_pos,pos-prev_pos));
25 prev_pos=++pos;
26 }
27 // special handling for last substring
28 m_lsubstring.push_back(input.substr(prev_pos,pos-prev_pos));
29 m_nword=m_lsubstring.size();
30}

◆ StringParse() [2/4]

StringParse::StringParse ( )

◆ ~StringParse() [1/2]

StringParse::~StringParse ( )

Definition at line 66 of file StringParse.cxx.

66 {
67}

◆ StringParse() [3/4]

StringParse::StringParse ( std::string  input)

◆ StringParse() [4/4]

StringParse::StringParse ( )

◆ ~StringParse() [2/2]

StringParse::~StringParse ( )

Member Function Documentation

◆ intpiece() [1/2]

int StringParse::intpiece ( const int &  num)

Definition at line 39 of file StringParse.cxx.

39 {
40if(num <= m_nword){
41 int i= atoi(m_lsubstring[num-1].c_str());
42 return i;
43 }
44 else {
45 return -1;
46 }
47}
char * c_str(Index i)
Definition: EvtCyclic3.cc:252

◆ intpiece() [2/2]

int StringParse::intpiece ( const int &  num)

◆ longpiece() [1/2]

long StringParse::longpiece ( const int &  num)

Definition at line 48 of file StringParse.cxx.

48 {
49if(num <= m_nword){
50 int i= atol(m_lsubstring[num-1].c_str());
51 return i;
52 }
53 else {
54 return -1;
55 }
56}

◆ longpiece() [2/2]

long StringParse::longpiece ( const int &  num)

◆ numpiece() [1/2]

float StringParse::numpiece ( const int &  num)

Definition at line 57 of file StringParse.cxx.

57 {
58if(num <= m_nword){
59 float x= atof(m_lsubstring[num-1].c_str());
60 return x;
61 }
62 else {
63 return -1.1;
64 }
65}
Double_t x[10]

◆ numpiece() [2/2]

float StringParse::numpiece ( const int &  num)

◆ piece() [1/2]

std::string StringParse::piece ( const int &  num)

Definition at line 31 of file StringParse.cxx.

31 {
32 if(num <= m_nword){
33 return m_lsubstring[num-1];
34 }
35 else {
36 return m_past_end;
37 }
38}

◆ piece() [2/2]

std::string StringParse::piece ( const int &  num)

◆ string_size() [1/2]

unsigned StringParse::string_size ( void  ) const
inline

Definition at line 39 of file Generator/GeneratorUtil/GeneratorUtil-00-00-03/GeneratorUtil/StringParse.h.

40{ return m_nword; }

◆ string_size() [2/2]

unsigned StringParse::string_size ( void  ) const

The documentation for this class was generated from the following files: