43 #define FILEMANAGERT_CC 51 #include <OpenVolumeMesh/Geometry/VectorT.hh> 52 #include <OpenVolumeMesh/Mesh/PolyhedralMesh.hh> 54 #include "FileManager.hh" 74 void FileManager::trimString(std::string& _string)
const {
77 size_t start = _string.find_first_not_of(
" \t\r\n");
78 size_t end = _string.find_last_not_of(
" \t\r\n");
80 if((std::string::npos == start) || (std::string::npos == end)) {
83 _string = _string.substr(start, end - start + 1);
89 void FileManager::extractQuotedText(std::string& _string)
const {
92 size_t start = _string.find_first_of(
"\""); ++start;
93 size_t end = _string.find_last_not_of(
"\"");
95 if((std::string::npos == start) || (std::string::npos == end)) {
98 _string = _string.substr(start, end - start + 1);
104 bool FileManager::getCleanLine(std::istream& _ifs, std::string& _string,
bool _skipEmptyLines)
const {
110 std::getline(_ifs, _string);
116 if(_string.size() != 0) {
119 if(_string[0] !=
'#') {
129 if (verbosity_level_ >= 2) {
130 std::cerr <<
"End of file reached while searching for input!" << std::endl;
143 std::ifstream iff(_filename.c_str(), std::ios::in);
146 if (verbosity_level_ >= 1) {
147 std::cerr <<
"Could not open file " << _filename <<
" for reading!" << std::endl;
159 if (s ==
"Polyhedra") {
172 if(n == 0)
return false;
175 for (
unsigned int i = 0; i < n; ++i) {
177 iff.getline(tmp, 256);
189 std::ifstream iff(_filename.c_str(), std::ios::in);
192 if (verbosity_level_ >= 1) {
193 std::cerr <<
"Could not open file " << _filename <<
" for reading!" << std::endl;
205 if (s ==
"Polyhedra") {
218 if(n == 0)
return false;
221 for (
unsigned int i = 0; i < n; ++i) {
223 iff.getline(tmp, 256);
~FileManager()
Default destructor.
bool isHexahedralMesh(const std::string &_filename) const
Test whether given file contains a hexahedral mesh.
FileManager()
Default constructor.
bool isTetrahedralMesh(const std::string &_filename) const
Test whether given file contains a tetrahedral mesh.