2005-04-15 05:41:28 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2005 Robert Osfield
|
2003-01-22 00:45:36 +08:00
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
2001-10-04 23:12:57 +08:00
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
#ifndef OSGDB_FIELDREADER
|
|
|
|
#define OSGDB_FIELDREADER 1
|
|
|
|
|
|
|
|
#include <osgDB/Export>
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2004-03-03 21:27:21 +08:00
|
|
|
#include <istream>
|
2001-09-20 05:08:56 +08:00
|
|
|
|
|
|
|
namespace osgDB {
|
|
|
|
|
|
|
|
class Field;
|
|
|
|
|
|
|
|
class OSGDB_EXPORT FieldReader
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
FieldReader();
|
|
|
|
FieldReader(const FieldReader& ic);
|
|
|
|
virtual ~FieldReader();
|
|
|
|
|
|
|
|
virtual FieldReader& operator = (const FieldReader& ic);
|
|
|
|
|
2001-12-15 05:49:04 +08:00
|
|
|
void attach(std::istream* input);
|
2001-09-20 05:08:56 +08:00
|
|
|
void detach();
|
|
|
|
|
|
|
|
virtual bool eof() const;
|
|
|
|
|
|
|
|
bool readField(Field& fieldPtr);
|
|
|
|
void ignoreField();
|
|
|
|
|
2001-09-28 20:36:40 +08:00
|
|
|
/** no of unmatched `{' encountered so far in file*/
|
2001-09-20 05:08:56 +08:00
|
|
|
int getNoNestedBrackets() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
bool _readField(Field* fieldPtr);
|
|
|
|
|
|
|
|
void _init();
|
|
|
|
void _free();
|
|
|
|
void _copy(const FieldReader& ic);
|
|
|
|
|
2001-12-15 05:49:04 +08:00
|
|
|
std::istream* _fin;
|
2001-09-20 05:08:56 +08:00
|
|
|
bool _eof;
|
|
|
|
|
|
|
|
bool findStartOfNextField();
|
|
|
|
|
|
|
|
int _noNestedBrackets;
|
|
|
|
|
|
|
|
bool _delimiterEatLookUp[256];
|
|
|
|
bool _delimiterKeepLookUp[256];
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2002-02-03 20:33:41 +08:00
|
|
|
}
|
2001-09-20 05:08:56 +08:00
|
|
|
|
|
|
|
#endif // __SG_FIELD_READER_H
|