Added support for calling throwException() from InputIterator and added a check for negative string sizes.

This commit is contained in:
Robert Osfield
2011-10-20 16:35:50 +00:00
parent 62888dba38
commit affe0b4a6d
3 changed files with 20 additions and 4 deletions

View File

@@ -8,6 +8,9 @@
namespace osgDB
{
// forward declare
class InputStream;
class OSGDB_EXPORT OutputIterator : public osg::Referenced
{
public:
@@ -64,12 +67,16 @@ protected:
class OSGDB_EXPORT InputIterator : public osg::Referenced
{
public:
InputIterator() : _in(0), _failed(false) {}
InputIterator() : _in(0), _inputStream(0), _failed(false) {}
virtual ~InputIterator() {}
void setStream( std::istream* istream ) { _in = istream; }
std::istream* getStream() { return _in; }
const std::istream* getStream() const { return _in; }
void setInputStream( InputStream* inputStream) { _inputStream = inputStream; }
InputStream* getInputStream() { return _inputStream; }
const InputStream* getInputStream() const { return _inputStream; }
void checkStream() const { if (_in->rdstate()&_in->failbit) _failed = true; }
bool isFailed() const { return _failed; }
@@ -100,9 +107,12 @@ public:
virtual bool matchString( const std::string& /*str*/ ) { return false; }
virtual void advanceToCurrentEndBracket() {}
void throwException( const std::string& msg );
protected:
std::istream* _in;
std::istream* _in;
osgDB::InputStream* _inputStream;
mutable bool _failed;
};