/usr/include/osgDB/Input is in libopenscenegraph-dev 3.2.0~rc1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* 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.
*/
#ifndef OSGDB_INPUT
#define OSGDB_INPUT 1
#include <osg/Image>
#include <osg/Shader>
#include <osg/Node>
#include <osg/Drawable>
#include <osg/StateAttribute>
#include <osg/ArgumentParser>
#include <osgDB/ReaderWriter>
#include <osgDB/Options>
#include <map>
#include <string>
namespace osgDB {
/** basic structure for custom runtime inheritance checking */
struct basic_type_wrapper {
virtual ~basic_type_wrapper() {}
virtual bool matches(const osg::Object *proto) const = 0;
};
/** a class template that checks inheritance between a given
Object's class and a class defined at compile time through
the template parameter T.
This is used in conjunction with readObjectOfType() to
specify an abstract class as reference type.
**/
template<class T>
struct type_wrapper: basic_type_wrapper {
bool matches(const osg::Object *proto) const
{
return dynamic_cast<const T*>(proto) != 0;
}
};
/** deprecated. */
class OSGDB_EXPORT Field
{
public:
enum {
MIN_CACHE_SIZE = 256
};
Field();
Field(const Field& field);
virtual ~Field();
virtual Field& operator = (const Field& ic);
void reset();
void addChar(char c);
int getNoCharacters() const { return _fieldCacheSize; }
void setWithinQuotes(bool withinQuotes=true);
bool getWithinQuotes();
void setNoNestedBrackets(int no);
int getNoNestedBrackets();
enum FieldType
{
OPEN_BRACKET,
CLOSE_BRACKET,
STRING,
WORD,
REAL,
INTEGER,
BLANK,
UNINITIALISED
};
FieldType getFieldType() const;
bool isValid() const;
bool isOpenBracket() const;
bool isCloseBracket() const;
bool isWord() const;
bool matchWord(const char* str) const;
bool matchWord(const char* str,int noCharacters) const;
bool isString() const;
bool matchString(const char* str) const;
bool matchString(const char* str,int noCharacters) const;
bool isQuotedString() const;
const char* getStr() const;
char* takeStr();
bool isInt() const;
bool matchInt(int i) const;
bool getInt(int& i) const;
bool isUInt() const;
bool matchUInt(unsigned int i) const;
bool getUInt(unsigned int& i) const;
bool isFloat() const;
bool matchFloat(float f) const;
bool getFloat(float& f) const;
bool getFloat(double& f) const;
static FieldType calculateFieldType(const char* str,bool withinQuotes=false);
protected:
void _init();
void _free();
void _copy(const Field& ic);
int _fieldCacheCapacity;
int _fieldCacheSize;
char* _fieldCache;
mutable FieldType _fieldType;
bool _withinQuotes;
int _noNestedBrackets;
};
/** deprecated. */
class OSGDB_EXPORT FieldReader
{
public:
FieldReader();
FieldReader(const FieldReader& ic);
virtual ~FieldReader();
virtual FieldReader& operator = (const FieldReader& ic);
void attach(std::istream* input);
void detach();
virtual bool eof() const;
bool readField(Field& fieldPtr);
void ignoreField();
/** no of unmatched `{' encountered so far in file*/
int getNoNestedBrackets() const;
private:
bool _readField(Field* fieldPtr);
void _init();
void _free();
void _copy(const FieldReader& ic);
std::istream* _fin;
bool _eof;
bool findStartOfNextField();
int _noNestedBrackets;
bool _delimiterEatLookUp[256];
bool _delimiterKeepLookUp[256];
};
/** deprecated. */
class OSGDB_EXPORT FieldReaderIterator
{
public:
enum {
MINIMUM_FIELD_READER_QUEUE_SIZE = 10
};
FieldReaderIterator();
FieldReaderIterator(const FieldReaderIterator& ic);
virtual ~FieldReaderIterator();
FieldReaderIterator& operator = (const FieldReaderIterator& ic);
void attach(std::istream* input);
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);
/** increments the iterator of the next simple field or
* whole block if the current field[0] is an open bracket */
void advanceOverCurrentFieldOrBlock();
void advanceToEndOfCurrentBlock();
void advanceToEndOfBlock(int noNestBrackets);
bool matchSequence(const char* str);
bool readSequence(const char* keyword,std::string& value);
bool readSequence(const char* keyword,unsigned int& value);
bool readSequence(const char* keyword,int& value);
bool readSequence(const char* keyword,float& value);
bool readSequence(const char* keyword,osg::Vec2f& value);
bool readSequence(const char* keyword,osg::Vec3f& value);
bool readSequence(const char* keyword,osg::Vec4f& value);
bool readSequence(const char* keyword,osg::Vec2d& value);
bool readSequence(const char* keyword,osg::Vec3d& value);
bool readSequence(const char* keyword,osg::Vec4d& value);
bool readSequence(std::string& value);
bool readSequence(unsigned int& value);
bool readSequence(int& value);
bool readSequence(float& value);
bool readSequence(osg::Vec2f& value);
bool readSequence(osg::Vec3f& value);
bool readSequence(osg::Vec4f& value);
bool readSequence(osg::Vec2d& value);
bool readSequence(osg::Vec3d& value);
bool readSequence(osg::Vec4d& value);
private:
void _init();
void _free();
void _copy(const FieldReaderIterator& ic);
FieldReader _reader;
Field _blank;
Field* _previousField;
Field** _fieldQueue;
int _fieldQueueSize;
int _fieldQueueCapacity;
};
/** deprecated. */
class OSGDB_EXPORT Input : public FieldReaderIterator
{
public:
Input();
virtual ~Input();
void setOptions(const Options* options) { _options = options; }
const Options* getOptions() const { return _options.get(); }
virtual osg::Object* readObjectOfType(const osg::Object& compObj);
virtual osg::Object* readObjectOfType(const basic_type_wrapper &btw);
template<typename T>
inline T* readObjectOfType()
{
return dynamic_cast<T*>(readObjectOfType(osgDB::type_wrapper<T>()));
}
virtual osg::Object* readObject();
virtual osg::Image* readImage();
virtual osg::Drawable* readDrawable();
virtual osg::StateAttribute* readStateAttribute();
virtual osg::Uniform* readUniform();
virtual osg::Node* readNode();
virtual osg::Shader* readShader();
virtual osg::Object* readObject(const std::string& fileName);
virtual osg::Image* readImage(const std::string& fileName);
virtual osg::Node* readNode(const std::string& fileName);
virtual osg::Shader* readShader(const std::string& fileName);
virtual osg::Object* getObjectForUniqueID(const std::string& uniqueID);
virtual void registerUniqueIDForObject(const std::string& uniqueID,osg::Object* obj);
typedef osg::ArgumentParser::Parameter Parameter;
bool read(Parameter value1);
bool read(Parameter value1, Parameter value2);
bool read(Parameter value1, Parameter value2, Parameter value3);
bool read(Parameter value1, Parameter value2, Parameter value3, Parameter value4);
bool read(Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5);
bool read(Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6);
bool read(Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7);
bool read(Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8);
bool read(const char* str);
bool read(const char* str, Parameter value1);
bool read(const char* str, Parameter value1, Parameter value2);
bool read(const char* str, Parameter value1, Parameter value2, Parameter value3);
bool read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4);
bool read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5);
bool read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6);
bool read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7);
bool read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8);
private:
typedef std::map< std::string, osg::ref_ptr<osg::Object> > UniqueIDToObjectMapping;
UniqueIDToObjectMapping _uniqueIDToObjectMap;
osg::ref_ptr<const Options> _options;
};
}
#endif // __SG_INPUT_H
|