43 stringList::stringList(std::string& txt, std::string& ws, std::string& del,
bool remove):removeWS(remove), whitespace(ws),delimiters(del)
52 for (
size_t i=0;i<
line.size();i++){
53 if (
line[i].find(txt) != std::string::npos){
61 for (
size_t i=0;i<
line.size();i++){
62 if (
line[i].compare(txt) == 0){
72 for (
size_t i=0;i<
line.size();i++){
73 if (
line[i].find(txt) != std::string::npos){
84 for (
size_t i=pos;i<
line.size();i++){
85 if (
line[i].find(txt) != std::string::npos){
127 found=txt.find_first_of(
delimiters.c_str(),found);
128 std::string st=txt.substr(initial,found-initial);
134 }
while (found!=std::string::npos);
152 for(
size_t i=0;i<txt.size();i+=charSize){
153 line.push_back(txt.substr(i,charSize));
166 size_t initial=txt.find(del);
169 size_t found=txt.find(del,initial+1);
170 std::string st=txt.substr(initial,found-initial);
176 }
while (initial!=std::string::npos);
186 for(
size_t i=0;i<this->
size();i++){
213 getline(in, temp,
'\n');
235 getline(in, temp,
'\n');
257 getline(in, temp,
'\n');
285 for(
size_t i=0;i<txt.size();i++){
310 getline(in, temp,
'\n');
341 getline(in, temp,
'\n');
347 if (pos>=
line.size()){
351 std::string temp=
line[pos];
359 std::vector<double> temp;
360 for(
size_t iter=0;iter<
line.size();iter++){
373 for(
size_t iter=0;iter<
line.size();iter++){
378 std::cerr <<
"Couldn't convert " <<
line[iter] <<
" to an integer\n";
381 ret_val.push_back(val);
393 for(
size_t i=0;i<
line.size();i++){
394 std::cout <<
line[i] << std::endl;
396 std::cout <<
"#" <<
comment << std::endl;
415 for(
size_t iter=0;iter<
line.size();iter++){
424 size_t commentPos=txt.find_first_of(commentChar);
425 if (commentPos!=std::string::npos){
426 comment=txt.substr(commentPos);
427 txt=txt.substr(0,commentPos);
437 found=input.find_first_of(white);
439 while(found!=std::string::npos){
440 input.erase(found,1);
442 found=input.find_first_of(white);
451 size_t start = txt.find_first_not_of(ws);
452 if (start==std::string::npos){
456 txt=txt.substr(start);
467 void getKeyValue(std::string& txt,std::string& key,std::string& value){
468 size_t found=txt.find(
"<<");
470 if (found==std::string::npos){
476 size_t ending=txt.find(
">>");
477 if (ending!=std::string::npos){
478 key=txt.substr(found+2,ending-(found+2));
486 std::cerr <<
"Missing closing brackets on Key\n";
508 size_t found = txt.find(ch);
509 while(found!=std::string::npos){
510 txt[found]=replaceCh;
519 std::string
join(std::vector<int> &input,
char c){
521 if (input.size()==0){
525 else if (input.size()==1){
531 for(
size_t i=1;i<input.size();i++){
542 std::string
join(std::vector<size_t> &input,
char c){
544 if (input.size()==0){
548 else if (input.size()==1){
554 for(
size_t i=1;i<input.size();i++){
565 std::stringstream ss;
567 std::string s=ss.str();
575 std::stringstream ss;
577 std::string s=ss.str();
586 std::stringstream ss;
588 std::string s=ss.str();
595 std::stringstream ss;
597 std::string s=ss.str();
608 std::istringstream input(txt);
609 if (!(input >> val)){
622 std::istringstream input(txt);
623 if (!(input >> val)){
637 std::istringstream input(txt);
650 std::string
join(std::vector<short> &input,
char c){
652 if (input.size()==0){
656 else if (input.size()==1){
662 for(
size_t i=1;i<input.size();i++){
673 std::string
join(std::vector<double> &input,
char c){
675 if (input.size()==0){
679 else if (input.size()==1){
685 for(
size_t i=1;i<input.size();i++){
696 std::string
join(std::vector<std::string> &input,
char c){
698 size_t sz=input.size();
704 for(
size_t i=1;i<sz;i++){
716 void split_line(std::vector<std::string> &line,std::string &input){
719 size_t found=input.find_first_of(
"\", \n\t");
720 while(found!=std::string::npos){
722 line.push_back(input.substr(0,found));
724 input=input.substr(found+1);
728 input.erase(found,1);
731 found=input.find_first_of(
"\", \n\t");
735 line.push_back(input);
746 if (tagCoord.first!=tagCoord.second){
747 std::string tag = txt.substr(tagCoord.first+1,tagCoord.second-tagCoord.first-1);
748 txt.erase(tagCoord.first,tagCoord.second-tagCoord.first+1);
758 std::pair<size_t,size_t>
balanced_brackets(
const std::string& text,
const std::string& brackets,
size_t offset){
759 char opening = brackets[0];
760 char closing = brackets[1];
767 found=text.find_first_of(opening,offset);
769 if (found!=std::string::npos){
774 return std::make_pair(0,0);
777 while(currentTotal!=0){
779 found=text.find_first_of(brackets,found);
780 if (found!=std::string::npos){
781 if (text[found]==opening){
784 else if (text[found]==closing){
789 return std::make_pair(0,0);
793 return std::make_pair(start,found);
800 std::pair<size_t,size_t>
balanced_brackets(
const std::string& text,
const std::string& brackets){
810 found = str.find_first_not_of(
"0123456789.-eE");
812 if (found!=std::string::npos){
824 std::ifstream in(file.c_str(),std::ifstream::in);
826 std::cerr <<
"File doesn't exist:" << file;
830 std::stringstream sstr;