Import Geant4 11.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2025-12-05 08:54:02 +01:00
parent a499fb82e9
commit b4a16de652
6484 changed files with 232674 additions and 221097 deletions
+31
View File
@@ -48,6 +48,37 @@ inline void double_quotes_tokenize(const std::string& a_cmd, std::vector<std::st
while ( endIdx < a_cmd.length() ); // Loop checking, 23.06.2015, I. Hrivnacova
}
inline void words(const std::string& a_string,const std::string& a_sep,bool a_take_empty,
std::vector<std::string>& a_words,bool a_clear = true){
// If a_sep is for exa "|" and for "xxx||xxx" :
// - a_take_empty false : {"xxx","xxx"} will be created
// (and NOT {"xxx","","xxx"}).
// - a_take_empty true : {"xxx","","xxx"} will be created.
if(a_clear) a_words.clear();
if(a_string.empty()) return;
std::string::size_type lim = (a_take_empty?0:1);
if(a_sep.empty()) {
a_words.push_back(a_string);
} else {
std::string::size_type l = a_string.length();
std::string::size_type llimiter = a_sep.length();
std::string::size_type pos = 0;
while(true) {
std::string::size_type index = a_string.find(a_sep,pos);
if(index==std::string::npos){ // Last word.
if((l-pos)>=lim) a_words.push_back(a_string.substr(pos,l-pos));
break;
} else {
// abcxxxef
// 0 3 67
if((index-pos)>=lim) a_words.push_back(a_string.substr(pos,index-pos));
pos = index + llimiter;
}
}
}
}
}
#endif