/* === S Y N F I G ========================================================= */
/*! \file synfig/module.h
-** \brief writeme
+** \brief Base class for all libraries modules
**
** $Id$
**
#define BEGIN_LAYERS {
//! DEPRECATED - use #INCLUDE_LAYER(class)
+// Really? ^^ The INCLUDE_LAYER(class) macro is defined in a cpp file and
+// is undefined a few lines later. In fact the INCLUDE_LAYER is only
+// used in the layer.cpp file and the functionality is the same. Even
+// more, I think that we should use register_in_book call because maybe
+// the Layer class would like to do something else when register the class.
+//! Register a Layer class in the book of layers
#define LAYER(class) \
synfig::Layer::register_in_book( \
synfig::Layer::BookEntry(class::create, \
class::cvs_id__, \
class::version__));
+//! Register a Layer class in the book of layers with an alias
#define LAYER_ALIAS(class,alias) \
synfig::Layer::register_in_book( \
synfig::Layer::BookEntry(class::create, \
//! Marks the start of the targets in the module's inventory
#define BEGIN_TARGETS {
-#define TARGET(x) \
- synfig::Target::book()[synfig::String(x::name__)].factory = \
- reinterpret_cast<synfig::Target::Factory> (x::create); \
- synfig::Target::book()[synfig::String(x::name__)].filename = \
- synfig::String(x::ext__); \
+#define TARGET(x) \
+ synfig::Target::book()[synfig::String(x::name__)].factory = \
+ reinterpret_cast<synfig::Target::Factory> (x::create); \
+ synfig::Target::book()[synfig::String(x::name__)].filename = \
+ synfig::String(x::ext__); \
+ synfig::Target::book()[synfig::String(x::name__)].target_param = \
+ synfig::TargetParam(); \
synfig::Target::ext_book()[synfig::String(x::ext__)]=x::name__;
#define TARGET_EXT(x,y) synfig::Target::ext_book()[synfig::String(y)]=x::name__;
//! Marks the start of the importers in the module's inventory
#define BEGIN_IMPORTERS {
+//! Register an Importer class in the book of importers by the default extension
#define IMPORTER(x) synfig::Importer::book()[synfig::String(x::ext__)]=x::create;
+//!Register an Importer class in the book of importers by one file extension string
#define IMPORTER_EXT(x,y) synfig::Importer::book()[synfig::String(y)]=x::create;
//! Marks the end of the importers in the module's inventory
//! Marks the start of the valuenodes in the module's inventory
#define BEGIN_VALUENODES { synfig::LinkableValueNode::Book &book(synfig::LinkableValueNode::book());
+//! Registers a valuenode that is defined in the module's inventory
#define VALUENODE(class,name,local,version) \
book[name].factory=reinterpret_cast<synfig::LinkableValueNode::Factory>(&class::create); \
book[name].check_type=&class::check_type; \
typedef etl::handle<const Module> ConstHandle;
public:
- typedef Module*(*constructor_type)(ProgressCallback *);
+ //! Type that represents a pointer to a Module's constructor by name.
+ //! As a pointer to the member, it represents a constructor of the module.
+ typedef Module* (*constructor_type)(ProgressCallback *);
typedef std::map<String, Handle > Book;
private:
static Book* book_;
public:
static Book& book();
+ //! Inits the book of importers and add the paths to search for the
+ //! ltdl library utilities.
static bool subsys_init(const String &prefix);
static bool subsys_stop();
+ //! Register not optional modules
static void register_default_modules(ProgressCallback *cb=NULL);
+ //! Register Module by handle
static void Register(Handle mod);
+ //! Register Module by name
static bool Register(const String &module_name, ProgressCallback *cb=NULL);
+ //!Register Module by instance pointer
static inline void Register(Module *mod) { Register(Handle(mod)); }
+ //! Virtual Modules properties wrappers. Must be defined in the modules classes
virtual const char * Name() { return " "; }
virtual const char * Desc() { return " "; }
virtual const char * Author() { return " "; }