2002-07-17 04:07:32 +08:00
|
|
|
//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
|
2001-10-04 23:12:57 +08:00
|
|
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
|
|
|
//as published by the Free Software Foundation.
|
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
#ifndef OSGDB_FIELDREADERITERATOR
|
|
|
|
#define OSGDB_FIELDREADERITERATOR 1
|
|
|
|
|
|
|
|
#include <osgDB/Field>
|
|
|
|
#include <osgDB/FieldReader>
|
|
|
|
|
|
|
|
namespace osgDB {
|
|
|
|
|
|
|
|
|
|
|
|
class OSGDB_EXPORT FieldReaderIterator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MINIMUM_FIELD_READER_QUEUE_SIZE = 10
|
|
|
|
};
|
|
|
|
|
|
|
|
FieldReaderIterator();
|
|
|
|
FieldReaderIterator(const FieldReaderIterator& ic);
|
|
|
|
virtual ~FieldReaderIterator();
|
|
|
|
|
2002-02-23 01:12:10 +08:00
|
|
|
FieldReaderIterator& operator = (const FieldReaderIterator& ic);
|
2001-09-20 05:08:56 +08:00
|
|
|
|
2001-12-15 07:18:28 +08:00
|
|
|
void attach(std::istream* input);
|
2001-09-20 05:08:56 +08:00
|
|
|
void detach();
|
|
|
|
|
|
|
|
virtual bool eof() const;
|
|
|
|
|
|
|
|
FieldReader& getFieldReader() { return _reader; }
|
|
|
|
|
|
|
|
void insert(int pos,Field* field);
|
|
|
|
void insert(int pos,const char* str);
|
|
|
|
|
|
|
|
Field& operator [] (int pos);
|
|
|
|
Field& field (int pos);
|
|
|
|
|
|
|
|
FieldReaderIterator& operator ++ ();
|
|
|
|
FieldReaderIterator& operator += (int no);
|
|
|
|
|
2001-09-28 20:36:40 +08:00
|
|
|
/** increments the iterator of the next simple field or
|
|
|
|
* whole block if the current field[0] is an open bracket */
|
2001-09-20 05:08:56 +08:00
|
|
|
void advanceOverCurrentFieldOrBlock();
|
|
|
|
void advanceToEndOfCurrentBlock();
|
|
|
|
void advanceToEndOfBlock(int noNestBrackets);
|
|
|
|
|
|
|
|
bool matchSequence(const char* str);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void _init();
|
|
|
|
void _free();
|
|
|
|
void _copy(const FieldReaderIterator& ic);
|
|
|
|
|
|
|
|
FieldReader _reader;
|
|
|
|
|
|
|
|
Field _blank;
|
|
|
|
|
|
|
|
Field* _previousField;
|
|
|
|
|
|
|
|
Field** _fieldQueue;
|
|
|
|
int _fieldQueueSize;
|
|
|
|
int _fieldQueueCapacity;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2002-02-03 20:33:41 +08:00
|
|
|
}
|
2001-09-20 05:08:56 +08:00
|
|
|
|
|
|
|
#endif // __OSGDB_FIELD_READER_QUEUE_H
|