00001 /* 00002 * Copyright 2006 Sony Computer Entertainment Inc. 00003 * 00004 * Licensed under the MIT Open Source License, for details please see license.txt or the website 00005 * http://www.opensource.org/licenses/mit-license.php 00006 * 00007 */ 00008 00009 #ifndef __DAE_IOPLUGIN__ 00010 #define __DAE_IOPLUGIN__ 00011 00012 #include <string> 00013 #include <vector> 00014 #include <dae/daeTypes.h> 00015 class daeDatabase; 00016 class daeMetaElement; 00017 class daeURI; 00018 class daeDocument; 00019 00025 class DLLSPEC daeIOPlugin 00026 { 00027 public: 00031 virtual ~daeIOPlugin() {} 00041 virtual daeInt setMeta(daeMetaElement *topMeta) = 0; 00042 00052 virtual void setDatabase(daeDatabase* database) = 0; 00054 00055 00068 virtual daeInt read(const daeURI& uri, daeString docBuffer) = 0; 00069 00081 virtual daeInt write(const daeURI& name, daeDocument *document, daeBool replace) = 0; 00083 00088 virtual const std::vector<std::string>& getSupportedProtocols() { 00089 return supportedProtocols; 00090 } 00091 00100 virtual daeInt setOption( daeString option, daeString value ) = 0; 00101 00108 virtual daeString getOption( daeString option ) = 0; 00109 00110 protected: 00111 // This is an array of the URI protocols supported by this plugin, e.g. "http", "file", 00112 // etc. Each plugin should initialize this variable in the constructor. 00113 std::vector<std::string> supportedProtocols; 00114 }; 00115 00116 00117 class DLLSPEC daeIOEmpty : public daeIOPlugin { 00118 public: 00119 virtual daeInt setMeta(daeMetaElement *topMeta) { return DAE_ERROR; } 00120 virtual void setDatabase(daeDatabase* database) { } 00121 virtual daeInt read(const daeURI& uri, daeString docBuffer) { return DAE_ERROR; } 00122 virtual daeInt write(const daeURI& name, daeDocument *document, daeBool replace) { return DAE_ERROR; } 00123 virtual daeInt setOption( daeString option, daeString value ) { return DAE_ERROR; } 00124 virtual daeString getOption( daeString option ) { return ""; } 00125 }; 00126 00127 00128 #endif // __DAE_IOPLUGIN__