36#define FILEMANAGERT_CC
44#include <OpenVolumeMesh/Geometry/VectorT.hh>
45#include <OpenVolumeMesh/Mesh/PolyhedralMesh.hh>
47#include <OpenVolumeMesh/FileManager/FileManager.hh>
49namespace OpenVolumeMesh {
67void FileManager::trimString(std::string& _string)
const {
70 size_t start = _string.find_first_not_of(
" \t\r\n");
71 size_t end = _string.find_last_not_of(
" \t\r\n");
73 if((std::string::npos == start) || (std::string::npos == end)) {
76 _string = _string.substr(start, end - start + 1);
82void FileManager::extractQuotedText(std::string& _string)
const {
85 size_t start = _string.find_first_of(
"\""); ++start;
86 size_t end = _string.find_last_not_of(
"\"");
88 if((std::string::npos == start) || (std::string::npos == end)) {
91 _string = _string.substr(start, end - start + 1);
97bool FileManager::getCleanLine(std::istream& _ifs, std::string& _string,
bool _skipEmptyLines)
const {
103 std::getline(_ifs, _string);
109 if(_string.size() != 0) {
112 if(_string[0] !=
'#') {
122 if (verbosity_level_ >= 2) {
123 std::cerr <<
"End of file reached while searching for input!" << std::endl;
136 std::ifstream iff(_filename.c_str(), std::ios::in);
139 if (verbosity_level_ >= 1) {
140 std::cerr <<
"Could not open file " << _filename <<
" for reading!" << std::endl;
152 if (s ==
"Polyhedra") {
165 if(n == 0)
return false;
168 for (
unsigned int i = 0; i < n; ++i) {
170 iff.getline(tmp, 256);
183 std::ifstream iff(_filename.c_str(), std::ios::in);
186 if (verbosity_level_ >= 1) {
187 std::cerr <<
"Could not open file " << _filename <<
" for reading!" << std::endl;
199 if (s ==
"Polyhedra") {
212 if(n == 0)
return false;
215 for (
unsigned int i = 0; i < n; ++i) {
217 iff.getline(tmp, 256);
bool isTetrahedralMesh(const std::string &_filename) const
Test whether given file contains a tetrahedral mesh.
bool isHexahedralMesh(const std::string &_filename) const
Test whether given file contains a hexahedral mesh.
~FileManager()
Default destructor.
FileManager()
Default constructor.