[vlmc-devel] commit: Effect: Adding some getters. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Sun Aug 15 20:53:49 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sat Jul 31 20:02:44 2010 +0200| [fd71245d3bd091525824bda363304124644c1c67] | committer: Hugo Beauzée-Luyssen 

Effect: Adding some getters.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=fd71245d3bd091525824bda363304124644c1c67
---

 src/EffectsEngine/Effect.cpp |   24 +++++++++++++++++++++++-
 src/EffectsEngine/Effect.h   |    6 ++++++
 2 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/src/EffectsEngine/Effect.cpp b/src/EffectsEngine/Effect.cpp
index 582fe67..b0fe98d 100644
--- a/src/EffectsEngine/Effect.cpp
+++ b/src/EffectsEngine/Effect.cpp
@@ -29,7 +29,10 @@
 
 Effect::Effect( const QString &fileName ) :
         QLibrary( fileName ),
-        m_type( Unknown )
+        m_type( Unknown ),
+        m_major( -1 ),
+        m_minor( -1 ),
+        m_nbParams( -1 )
 {
 }
 
@@ -65,6 +68,9 @@ Effect::load()
     m_name = infos.name;
     m_desc = infos.explanation;
     m_type = static_cast<Type>( infos.plugin_type );
+    m_major = infos.major_version;
+    m_minor = infos.minor_version;
+    m_nbParams = infos.num_params;
     return true;
 }
 
@@ -94,6 +100,22 @@ Effect::type()
     return m_type;
 }
 
+int
+Effect::getMajor()
+{
+    if ( m_major == -1 )
+        load();
+    return m_major;
+}
+
+int
+Effect::getMinor()
+{
+    if ( m_minor == -1 )
+        load();
+    return m_minor;
+}
+
 EffectInstance*
 Effect::createInstance()
 {
diff --git a/src/EffectsEngine/Effect.h b/src/EffectsEngine/Effect.h
index 21c7c88..30dc2c5 100644
--- a/src/EffectsEngine/Effect.h
+++ b/src/EffectsEngine/Effect.h
@@ -55,6 +55,9 @@ class Effect : public QLibrary
         const QString&  name();
         const QString&  description();
         Type            type();
+        //This breaks coding convention, but it would be safe just to undef major/minor.
+        int             getMajor();
+        int             getMinor();
         EffectInstance  *createInstance();
 
     private:
@@ -64,6 +67,9 @@ class Effect : public QLibrary
         QString         m_name;
         QString         m_desc;
         Type            m_type;
+        int             m_major;
+        int             m_minor;
+        int             m_nbParams;
         QAtomicInt      m_instCount;
 
         //Symbols:



More information about the Vlmc-devel mailing list