15 #include <vsg/core/Inherit.h>
16 #include <vsg/io/FileSystem.h>
17 #include <vsg/io/Options.h>
26 explicit ReadError(
const std::string& msg) :
37 using vsg::Object::read;
38 using vsg::Object::write;
44 auto object = read(filename, options);
52 auto object = read(fin, options);
60 auto object = read(ptr, size, options);
84 READ_FILENAME = (1 << 0),
85 READ_ISTREAM = (1 << 1),
86 READ_MEMORY = (1 << 2),
87 WRITE_FILENAME = (1 << 3),
88 WRITE_OSTREAM = (1 << 4)
93 std::map<vsg::Path, FeatureMask> protocolFeatureMap;
94 std::map<vsg::Path, FeatureMask> extensionFeatureMap;
95 std::map<std::string, std::string> optionNameTypeMap;
107 using ReaderWriters = std::vector<vsg::ref_ptr<ReaderWriter>>;
108 ReaderWriters readerWriters;
112 void read(
Input& input)
override;
113 void write(
Output& output)
const override;
Definition: CommandLine.h:44
Class for managing a list of ReaderWriter, providing a single read/write call to invoke each ReaderWr...
Definition: ReaderWriter.h:105
bool getFeatures(Features &features) const override
get the Features supported by this ReaderWriter
bool readOptions(vsg::Options &options, vsg::CommandLine &arguments) const override
read the command line arguments for any options appropriate for this ReaderWriter
vsg::ref_ptr< vsg::Object > read(std::istream &fin, vsg::ref_ptr< const vsg::Options > options={}) const override
read object from input stream, return object on success, return null ref_ptr<> if format not supporte...
bool write(const vsg::Object *object, const vsg::Path &filename, vsg::ref_ptr< const vsg::Options > options={}) const override
write object to file, return true on success, return false on failure.
vsg::ref_ptr< vsg::Object > read(const uint8_t *ptr, size_t size, vsg::ref_ptr< const vsg::Options > options={}) const override
read object from memory block, return object on success, return null ref_ptr<> if format not supporte...
bool write(const vsg::Object *object, std::ostream &fout, vsg::ref_ptr< const vsg::Options > options={}) const override
write object to output stream, return true on success, return false on failure.
vsg::ref_ptr< vsg::Object > read(const vsg::Path &filename, vsg::ref_ptr< const vsg::Options > options={}) const override
read object from file, return object on success, return null ref_ptr<> if format not supported,...
Class for passing IO related options to vsg::read/write calls.
Definition: Options.h:34
Base class for providing support for reading and/or writing various file formats and IO protocols.
Definition: ReaderWriter.h:35
virtual bool readOptions(Options &, CommandLine &) const
read the command line arguments for any options appropriate for this ReaderWriter
Definition: ReaderWriter.h:80
virtual vsg::ref_ptr< vsg::Object > read(const uint8_t *, size_t, vsg::ref_ptr< const vsg::Options >={}) const
read object from memory block, return object on success, return null ref_ptr<> if format not supporte...
Definition: ReaderWriter.h:71
virtual bool write(const vsg::Object *, const vsg::Path &, vsg::ref_ptr< const vsg::Options >={}) const
write object to file, return true on success, return false on failure.
Definition: ReaderWriter.h:74
virtual vsg::ref_ptr< vsg::Object > read(std::istream &, vsg::ref_ptr< const vsg::Options >={}) const
read object from input stream, return object on success, return null ref_ptr<> if format not supporte...
Definition: ReaderWriter.h:68
virtual vsg::ref_ptr< vsg::Object > read(const vsg::Path &, vsg::ref_ptr< const vsg::Options >={}) const
read object from file, return object on success, return null ref_ptr<> if format not supported,...
Definition: ReaderWriter.h:65
virtual bool getFeatures(Features &) const
get the Features supported by this ReaderWriter
Definition: ReaderWriter.h:99
vsg::ref_ptr< T > read_cast(const uint8_t *ptr, size_t size, vsg::ref_ptr< const vsg::Options > options={}) const
convenience method for casting a read object to a specified type.
Definition: ReaderWriter.h:58
virtual bool write(const vsg::Object *, std::ostream &, vsg::ref_ptr< const vsg::Options >={}) const
write object to output stream, return true on success, return false on failure.
Definition: ReaderWriter.h:77
vsg::ref_ptr< T > read_cast(const vsg::Path &filename, vsg::ref_ptr< const vsg::Options > options={}) const
convenience method for casting a read object to a specified type.
Definition: ReaderWriter.h:42
vsg::ref_ptr< T > read_cast(std::istream &fin, vsg::ref_ptr< const vsg::Options > options={}) const
convenience method for casting a read object to a specified type.
Definition: ReaderWriter.h:50
Definition: ReaderWriter.h:25
Definition: ReaderWriter.h:92