diff --git a/include/osgDB/ReaderWriter b/include/osgDB/ReaderWriter index 44e06a297..46c98bedf 100644 --- a/include/osgDB/ReaderWriter +++ b/include/osgDB/ReaderWriter @@ -109,9 +109,9 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object NOT_IMPLEMENTED, //!< read*() method not implemented in concrete ReaderWriter. FILE_NOT_HANDLED, //!< File is not appropriate for this file reader, due to some incompatibility, but *not* a read error. FILE_NOT_FOUND, //!< File could not be found or could not be read. + ERROR_IN_READING_FILE, //!< File found, loaded, but an error was encountered during processing. FILE_LOADED, //!< File successfully found, loaded, and converted into osg. FILE_LOADED_FROM_CACHE, //!< File found in cache and returned. - ERROR_IN_READING_FILE, //!< File found, loaded, but an error was encountered during processing. FILE_REQUESTED, //!< Asynchronous file read has been requested, but returning immediately, keep polling plugin until file read has been completed. INSUFFICIENT_MEMORY_TO_LOAD //!< File found but not loaded because estimated required memory surpasses available memory. }; @@ -123,6 +123,8 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object ReadResult(const ReadResult& rr):_status(rr._status),_message(rr._message),_object(rr._object) {} ReadResult& operator = (const ReadResult& rr) { if (this==&rr) return *this; _status=rr._status; _message=rr._message;_object=rr._object; return *this; } + bool operator < (const ReadResult& rhs) const { return _status < rhs._status; } + osg::Object* getObject(); osg::Image* getImage(); osg::HeightField* getHeightField(); @@ -171,8 +173,8 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object { NOT_IMPLEMENTED, //!< write*() method not implemented in concrete ReaderWriter. FILE_NOT_HANDLED, - FILE_SAVED, - ERROR_IN_WRITING_FILE + ERROR_IN_WRITING_FILE, + FILE_SAVED }; WriteResult(WriteStatus status=FILE_NOT_HANDLED):_status(status) {} @@ -181,6 +183,8 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object WriteResult(const WriteResult& rr):_status(rr._status),_message(rr._message) {} WriteResult& operator = (const WriteResult& rr) { if (this==&rr) return *this; _status=rr._status; _message=rr._message; return *this; } + bool operator < (const WriteResult& rhs) const { return _status < rhs._status; } + std::string& message() { return _message; } const std::string& message() const { return _message; } diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index 80a218c69..5d9dd9a3c 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -1166,52 +1166,6 @@ ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) } } - - if (!results.empty()) - { - unsigned int num_FILE_NOT_HANDLED = 0; - unsigned int num_FILE_NOT_FOUND = 0; - unsigned int num_ERROR_IN_READING_FILE = 0; - - Results::iterator ritr; - for(ritr=results.begin(); - ritr!=results.end(); - ++ritr) - { - if (ritr->status()==ReaderWriter::ReadResult::FILE_NOT_HANDLED) ++num_FILE_NOT_HANDLED; - else if (ritr->status()==ReaderWriter::ReadResult::NOT_IMPLEMENTED) ++num_FILE_NOT_HANDLED;//Freetype and others - else if (ritr->status()==ReaderWriter::ReadResult::FILE_NOT_FOUND) ++num_FILE_NOT_FOUND; - else if (ritr->status()==ReaderWriter::ReadResult::ERROR_IN_READING_FILE) ++num_ERROR_IN_READING_FILE; - } - - if (num_FILE_NOT_HANDLED!=results.size()) - { - for(ritr=results.begin(); ritr!=results.end(); ++ritr) - { - if (ritr->status()==ReaderWriter::ReadResult::ERROR_IN_READING_FILE) - { - // OSG_NOTICE<<"Warning: error reading file \""<status()==ReaderWriter::ReadResult::FILE_NOT_FOUND) - { - //OSG_NOTICE<<"Warning: could not find file \""<status()==ReaderWriter::ReadResult::FILE_NOT_HANDLED) ++num_FILE_NOT_HANDLED; - else if (ritr->status()==ReaderWriter::ReadResult::FILE_NOT_FOUND) ++num_FILE_NOT_FOUND; - else if (ritr->status()==ReaderWriter::ReadResult::ERROR_IN_READING_FILE) ++num_ERROR_IN_READING_FILE; - } - - if (num_FILE_NOT_HANDLED!=results.size()) - { - for(ritr=results.begin(); ritr!=results.end(); ++ritr) - { - if (ritr->status()==ReaderWriter::ReadResult::ERROR_IN_READING_FILE) - { - // OSG_NOTICE<<"Warning: error reading file \""<status()==ReaderWriter::ReadResult::FILE_NOT_FOUND) - { - // OSG_NOTICE<<"Warning: could not find file \""<