Module: synfig
Branch: eldruin_ffmpeg
Commit: 8289faf633081201ed763127316009f4a74e700c
URL:    
http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig;a=commit;h=8289faf633081201ed763127316009f4a74e700c

Author: Diego Barrios Romero <[email protected]>
Date:   Tue Dec 22 02:30:22 2009 +0100

Changed target book map to have a struct (BookEntry).

---

 synfig-core/src/synfig/module.h   |    9 +++++----
 synfig-core/src/synfig/target.cpp |   11 ++++++++---
 synfig-core/src/synfig/target.h   |   11 +++++++----
 synfig-core/src/tool/main.cpp     |    2 +-
 4 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/synfig-core/src/synfig/module.h b/synfig-core/src/synfig/module.h
index 26638cd..d064fe9 100644
--- a/synfig-core/src/synfig/module.h
+++ b/synfig-core/src/synfig/module.h
@@ -115,10 +115,11 @@
 //! Marks the start of the targets in the module's inventory
 #define BEGIN_TARGETS {
 
-#define TARGET(x)                                                              
                                                                                
                \
-       synfig::Target::book()[synfig::String(x::name__)]=                      
                                                                \
-               std::pair<synfig::Target::Factory,synfig::String>               
                                                                \
-                       (x::create,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::ext_book()[synfig::String(x::ext__)]=x::name__;
 
 #define TARGET_EXT(x,y) 
synfig::Target::ext_book()[synfig::String(y)]=x::name__;
diff --git a/synfig-core/src/synfig/target.cpp 
b/synfig-core/src/synfig/target.cpp
index 92153b4..47727be 100644
--- a/synfig-core/src/synfig/target.cpp
+++ b/synfig-core/src/synfig/target.cpp
@@ -55,9 +55,14 @@ Target::subsys_init()
        //default_gamma_->set_black_level(0.05); // Default to 5% black level.
 
        // At least one target must be available.
-       
book()["null"]=std::pair<synfig::Target::Factory,String>(Target_Null::create,"null");
+       book()["null"].factory =
+               reinterpret_cast<synfig::Target::Factory>(&Target_Null::create);
+  book()["null"].filename = "null";
        ext_book()["null"]="null";
-       
book()["null-tile"]=std::pair<synfig::Target::Factory,String>(Target_Null_Tile::create,"null-tile");
+
+       book()["null-tile"].factory =
+    reinterpret_cast<synfig::Target::Factory>(&Target_Null_Tile::create);
+  book()["null-tile"].filename = "null-tile";
        ext_book()["null-tile"]="null-tile";
 
        return true;
@@ -110,5 +115,5 @@ Target::create(const String &name, const String &filename)
        if(!book().count(name))
                return handle<Target>();
 
-       return Target::Handle(book()[name].first(filename.c_str()));
+       return Target::Handle(book()[name].factory(filename.c_str()));
 }
diff --git a/synfig-core/src/synfig/target.h b/synfig-core/src/synfig/target.h
index 2f3c038..f93cf87 100644
--- a/synfig-core/src/synfig/target.h
+++ b/synfig-core/src/synfig/target.h
@@ -107,12 +107,15 @@ public:
        **  Receives the output filename (including path).
        */
        typedef Target* (*Factory)(const char *filename);
+       
+       struct BookEntry
+       {
+               Factory factory;
+               String filename; ///< Output filename including path
+       };
 
        //! Book of types of targets indexed by the name of the Target.
-       /*! Each entry contains the Target constructor pointer and the output 
-       **  filename string (including path).
-       */
-       typedef std::map<String,std::pair<Factory,String> > Book;
+       typedef std::map<String,BookEntry> Book;
 
        typedef std::map<String,String> ExtBook;
 
diff --git a/synfig-core/src/tool/main.cpp b/synfig-core/src/tool/main.cpp
index fbf64b0..e325515 100644
--- a/synfig-core/src/tool/main.cpp
+++ b/synfig-core/src/tool/main.cpp
@@ -1307,7 +1307,7 @@ int main(int argc, char *argv[])
                        {
                                job_list.front().outfilename = 
filename_sans_extension(job_list.front().filename) + '.';
                                if(Target::book().count(target_name))
-                                       
job_list.front().outfilename+=Target::book()[target_name].second;
+                                       
job_list.front().outfilename+=Target::book()[target_name].filename;
                                else
                                        
job_list.front().outfilename+=target_name;
                        }


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to