class used to implement serialization engines.
This class is used to load and save files of various types, using the gcu::Object framework. Derived classes should be implemented in plugins, using the goffice plugins API. When Loader::Init is called, the framework collects informations about the services exposed by each plugin in XML files. For the CDX file loader plugin, the corresponding plugin.xml.in file content is:
<?xml version="1.0" encoding="UTF-8"?>
<plugin id="GCULoader_cdxml">
<information>
<_description>Chemdraw XML files loader.</_description>
</information>
<loader type="Gnumeric_Builtin:module">
<attribute name="module_file" value="cdxml"/>
</loader>
<services>
<service type="chemical_loader" id="GCULoader_cdxml">
<mime_type name="chemical/x-cdxml" capabilities="r" scope="2"/>
<information>
<_description>Chemdraw XML files loader</_description>
</information>
</service>
</services>
</plugin>
In the present context, the important node is the mime type related one. Its attributes are:
- name: the mime type.
- capabilities: what is supported: r for reading, w for writing. Both "rw" and "wr" are valid.
- scope: 2 and 3 mean 2D and 3D structures, repectively, c means crystal structure, and s, spectra . Any combination might be used.
Other fields are standard in the goffice world. The plugin is loaded only when needed.
Each plugin should implement at least one derived class and a static instance of this class. The CDX loader has:
{
public:
CDXLoader ();
virtual ~CDXLoader ();
bool Read (Document *doc, GsfInput *in,
char const *mime_type, IOContext *io);
bool Write (Document *doc, GsfOutput *out,
char const *mime_type, IOContext *io);
private:
...
};
...
static CDXLoader loader;
Definition at line 144 of file loader.h.