Refactored the way the ReadResult/WriteResult lists are handled, with them now being sorted so that the Read/WriteResult with highest numerical value ReadStatus/WriteStatus is returned.

Changed the enum order of ReadStatus/WriteStatus to ensure that the more relevant errors are last and with the highest numerical value
This commit is contained in:
Robert Osfield
2013-06-11 09:05:35 +00:00
parent bdfd18dc03
commit b0a28a5b2c
2 changed files with 70 additions and 121 deletions

View File

@@ -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; }