[gnote] * make the "add interface" a macro for sake of brievity.



commit efd8304fbabddfba86ebd8ab9dba52686b54bb32
Author: Hubert Figuiere <hub figuiere net>
Date:   Fri Apr 24 14:13:44 2009 -0400

    * make the "add interface" a macro for sake of brievity.
---
 src/addins/fixedwidth/fixedwidthnoteaddin.cpp      |    3 +--
 .../inserttimestamp/inserttimestampnoteaddin.cpp   |    6 ++----
 src/addins/printnotes/printnotesnoteaddin.cpp      |    3 +--
 src/sharp/dynamicmodule.hpp                        |    6 ++++++
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/addins/fixedwidth/fixedwidthnoteaddin.cpp b/src/addins/fixedwidth/fixedwidthnoteaddin.cpp
index c822c1c..b55cd67 100644
--- a/src/addins/fixedwidth/fixedwidthnoteaddin.cpp
+++ b/src/addins/fixedwidth/fixedwidthnoteaddin.cpp
@@ -35,8 +35,7 @@ namespace fixedwidth {
 
   FixedWidthModule::FixedWidthModule()
   {
-    add(gnote::NoteAddin::IFACE_NAME, 
-        new sharp::IfaceFactory<FixedWidthNoteAddin>);
+    ADD_INTERFACE_IMPL(FixedWidthNoteAddin);
   }
 
   const char * FixedWidthModule::id() const
diff --git a/src/addins/inserttimestamp/inserttimestampnoteaddin.cpp b/src/addins/inserttimestamp/inserttimestampnoteaddin.cpp
index 7867cf8..a70424a 100644
--- a/src/addins/inserttimestamp/inserttimestampnoteaddin.cpp
+++ b/src/addins/inserttimestamp/inserttimestampnoteaddin.cpp
@@ -32,10 +32,8 @@ namespace inserttimestamp {
 
   InsertTimeStampModule::InsertTimeStampModule()
   {
-    add(gnote::NoteAddin::IFACE_NAME, 
-        new sharp::IfaceFactory<InsertTimestampNoteAddin>);
-    add(gnote::AddinPreferenceFactory::IFACE_NAME,
-        new sharp::IfaceFactory<InsertTimestampPreferencesFactory>);
+    ADD_INTERFACE_IMPL(InsertTimestampNoteAddin);
+    ADD_INTERFACE_IMPL(InsertTimestampPreferencesFactory);
   }
   const char * InsertTimeStampModule::id() const
   {
diff --git a/src/addins/printnotes/printnotesnoteaddin.cpp b/src/addins/printnotes/printnotesnoteaddin.cpp
index 0160ca0..3291e6d 100644
--- a/src/addins/printnotes/printnotesnoteaddin.cpp
+++ b/src/addins/printnotes/printnotesnoteaddin.cpp
@@ -36,8 +36,7 @@ namespace printnotes {
 
   PrintNotesModule::PrintNotesModule()
   {
-    add(gnote::NoteAddin::IFACE_NAME, 
-       new sharp::IfaceFactory<PrintNotesNoteAddin>);
+    ADD_INTERFACE_IMPL(PrintNotesNoteAddin);
   }
   const char * PrintNotesModule::id() const
   {
diff --git a/src/sharp/dynamicmodule.hpp b/src/sharp/dynamicmodule.hpp
index a215bfd..c585a61 100644
--- a/src/sharp/dynamicmodule.hpp
+++ b/src/sharp/dynamicmodule.hpp
@@ -43,6 +43,12 @@ typedef DynamicModule* (*instanciate_func_t)();
   extern "C" sharp::DynamicModule* dynamic_module_instanciate() \
   { return new klass; }
 
+
+#define ADD_INTERFACE_IMPL(klass) \
+    add(klass::IFACE_NAME, \
+        new sharp::IfaceFactory<klass>)
+
+
 class DynamicModule
 {
 public:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]