|
The Gnome Chemistry Utils
0.14.14
|
class used to implement serialization engines. More...
#include <gcu/loader.h>
Public Member Functions | |
| Loader () | |
| virtual | ~Loader () |
| virtual ContentType | Read (Document *doc, GsfInput *in, char const *mime_type, GOIOContext *io) |
| virtual bool | Write (Object const *obj, GsfOutput *out, char const *mime_type, GOIOContext *io, ContentType type=ContentTypeMisc) |
Static Public Member Functions | |
| static void | Init (Application *app) |
| static bool | GetFirstLoader (std::map< std::string, LoaderStruct >::iterator &it) |
| static bool | GetNextLoader (std::map< std::string, LoaderStruct >::iterator &it) |
| static Loader * | GetLoader (char const *mime_type) |
| static Loader * | GetSaver (char const *mime_type) |
Protected Member Functions | |
| void | AddMimeType (const char *mime_type) |
| void | RemoveMimeType (const char *mime_type) |
Protected Attributes | |
| std::list< std::string > | MimeTypes |
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:
In the present context, the important node is the mime type related one. Its attributes are:
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:
| gcu::Loader::Loader | ( | ) |
The constructor. Derived class need to call Loader::AddMimeType for each mime type they support.
|
virtual |
The destructor Derived class should call Loader::RemoveMimeType for each mime type they support.
|
protected |
| mime_type | a mime type. |
Registers a mime type and stores the instance calling it as the Loader for this mime type.
|
static |
| it | a std::map iterator. |
Must be called to access the first LoaderStruct instance. When successful the iterator can be used to retrieve both the mime type ((*it).first), and the corresponding LoaderStruct ((*it).second)
|
static |
| mime_type | a mime type. |
|
static |
| it | a std::map iterator initialized by Loader::GetFirstLoader |
Gets the next LoderStruct and its associated mime type.
|
static |
| mime_type | a mime type. |
|
static |
| app | an Application instance. |
Initializes the load/save engines system. This must be called before trying to use any loader (no one will be available before, anyway).
|
virtual |
| doc | the gcu::Document being read. |
| in | a GsfInput (see the libgsf documentation at http://library.gnome.org/devel/gsf/stable/gsf-Input-from-unstructured-files.html#GsfInput). |
| mime_type | the mime type of the data. |
| io | a GOffice IOContext. |
This function must be overloaded by a derived class able to read. Default implementation just return false.
|
protected |
| mime_type | a mime type. |
Unregisters a mime type.
|
virtual |
| obj | the gcu::Object being written. |
| out | a GsfOutput (see the libgsf documentation at http://library.gnome.org/devel/gsf/stable/gsf-Output-to-unstructured-files.html#GsfOutput). |
| mime_type | the mime type of the data. |
| io | a GOffice IOContext. |
| type | the type of the data to be saved (see gcu::ContentType). |
This function must be overloaded by a derived class able to write. Default implementation just return false.
|
protected |
1.8.11