-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathfsxml.h
More file actions
59 lines (55 loc) · 1.57 KB
/
Copy pathfsxml.h
File metadata and controls
59 lines (55 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef FSXML_H
#define FSXML_H
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <ios>
#include "safegetline.h" // for cross-platform safely getting lines
namespace fines
{
/**
@brief Reads in the output file
*/
class FsXml
{
public:
FsXml(std::string f);
~FsXml();
std::streampos getLineContaining(std::string str,bool getlast=false);
std::streampos gotoLineContaining(std::string str,bool getlast=false);
inline std::streampos getLastIteration(){
return(getLineContaining("<Iteration>",true));
};///<Gets the last iteration
std::string getLine();
inline std::streampos gotoNextLineContaining(std::string str,bool getlast=false){
getLine();
return(gotoLineContaining(str,getlast));
}
inline void seekg(std::streampos is){iterfile.seekg(is);};
inline std::streampos tellg(){return(iterfile.tellg());};
std::string getTree(std::streampos itstart=-1);
std::string getParam(std::string tag, std::streampos itstart=-1);
inline bool eof(){return(iterfile.eof());};
inline void clear(){iterfile.clear();};
void rewind(){
clear();
std::streampos pos=-1;
iterfile.seekg(pos);
}
inline std::string getLine(bool *ok){
std::string res=getLine();
if ((res.size() > 0) && (res[res.size() - 1] == '\r')) res.resize(res.size() - 1);
if(ok!=NULL)if(iterfile.eofbit) *ok=false;
return(res);
}
void rangeextract(long from, long to,std::ostream * out);
void thin(long by,std::ostream * out);
inline std::string getName(){return(fname);}
private:
std::string fname;
std::ifstream iterfile;
};
}//end namespace
#endif