Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4Tokenizer Class Reference

#include <G4Tokenizer.hh>

Public Member Functions

 G4Tokenizer (const G4String &stn)
 
G4String operator() (const char *str=" \t\n", size_t l=0)
 

Detailed Description

Definition at line 48 of file G4Tokenizer.hh.

Constructor & Destructor Documentation

G4Tokenizer::G4Tokenizer ( const G4String stn)
inline

Definition at line 51 of file G4Tokenizer.hh.

51 :string2tokenize(stn),actual(0){}

Member Function Documentation

G4String G4Tokenizer::operator() ( const char *  str = " \t\n",
size_t  l = 0 
)
inline

Definition at line 53 of file G4Tokenizer.hh.

54  {
55  size_t i,j,tmp;
56  G4bool hasws=false;
57  if(l==0) l=strlen(str);
58  //Skip leading delimeters
59  while(actual<string2tokenize.size())
60  {
61 
62  for(i=0;i<l;i++)
63  if(string2tokenize[actual]==str[i]) hasws=true;
64  if(hasws)
65  {
66  actual++;
67  hasws=false;
68  }
69  else
70  break;
71  }
72 
73  for(j=actual;j<string2tokenize.size();j++)
74  {
75  for(i=0;i<l;i++)
76  if(string2tokenize[j]==str[i]) break;
77  if(i<l) break;
78  }
79  if(j!=string2tokenize.size())
80  {
81  tmp=actual;
82  actual=j+1;
83  return string2tokenize(tmp,j-tmp);
84  }
85  else
86  {
87  tmp=actual;
88  actual=j;
89  return string2tokenize(tmp,j-tmp);
90  }
91  }
bool G4bool
Definition: G4Types.hh:79

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