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_LIBXMLPLUGIN__ 00010 #define __DAE_LIBXMLPLUGIN__ 00011 00012 #include <vector> 00013 #include <dae/daeElement.h> 00014 #include <dae/daeURI.h> 00015 #include <dae/daeIOPluginCommon.h> 00016 00017 struct _xmlTextReader; 00018 struct _xmlTextWriter; 00019 class DAE; 00020 00029 class DLLSPEC daeLIBXMLPlugin : public daeIOPluginCommon 00030 { 00031 public: 00032 // Constructor / destructor 00036 daeLIBXMLPlugin(DAE& dae); 00040 virtual ~daeLIBXMLPlugin(); 00041 00042 // Operations 00043 virtual daeInt write(const daeURI& name, daeDocument *document, daeBool replace); 00044 00055 virtual daeInt setOption( daeString option, daeString value ); 00056 00063 virtual daeString getOption( daeString option ); 00064 00065 private: 00066 DAE& dae; 00067 00068 _xmlTextWriter *writer; 00069 00070 FILE *rawFile; 00071 unsigned long rawByteCount; 00072 daeURI rawRelPath; 00073 bool saveRawFile; 00074 00075 virtual daeElementRef readFromFile(const daeURI& uri); 00076 virtual daeElementRef readFromMemory(daeString buffer, const daeURI& baseUri); 00077 daeElementRef read(_xmlTextReader* reader); 00078 daeElementRef readElement(_xmlTextReader* reader, 00079 daeElement* parentElement, 00080 /* out */ int& readRetVal); 00081 00082 void writeElement( daeElement* element ); 00083 void writeAttribute( daeMetaAttribute* attr, daeElement* element); 00084 void writeValue(daeElement* element); 00085 00086 void writeRawSource( daeElement* src ); 00087 }; 00088 00089 #endif //__DAE_LIBXMLPLUGIN__