[ekiga/ds-gsettings3] Device: Extended definition to add convenience constructor.



commit f8be45c632c9c2e840b12bc93e8a90ddafe291cb
Author: Damien Sandras <dsandras beip be>
Date:   Sat Nov 30 15:38:52 2013 +0100

    Device: Extended definition to add convenience constructor.
    
    It is easier and nicer than using the class like a C Struct.

 lib/engine/audioinput/audioinput-info.h |   12 +++++++++---
 lib/engine/framework/device-def.h       |   25 ++++++++++++++++---------
 2 files changed, 25 insertions(+), 12 deletions(-)
---
diff --git a/lib/engine/audioinput/audioinput-info.h b/lib/engine/audioinput/audioinput-info.h
index f415a0a..eebe540 100644
--- a/lib/engine/audioinput/audioinput-info.h
+++ b/lib/engine/audioinput/audioinput-info.h
@@ -41,7 +41,14 @@
 
 namespace Ekiga
 {
-  class AudioInputDevice : public Device {};
+  class AudioInputDevice : public Device
+  {
+public:
+    AudioInputDevice () : Device () {};
+    AudioInputDevice (const std::string & t,
+                      const std::string & s,
+                      const std::string & n) : Device (t, s, n) {};
+  };
 
   typedef struct AudioInputSettings {
     unsigned volume;
@@ -50,10 +57,9 @@ namespace Ekiga
 
   enum AudioInputErrorCodes {
     AI_ERROR_NONE = 0,
-    AI_ERROR_DEVICE, 
+    AI_ERROR_DEVICE,
     AI_ERROR_READ
   };
-                                     
 };
 
 #endif
diff --git a/lib/engine/framework/device-def.h b/lib/engine/framework/device-def.h
index f4caa0c..7b493e2 100644
--- a/lib/engine/framework/device-def.h
+++ b/lib/engine/framework/device-def.h
@@ -47,21 +47,28 @@ namespace Ekiga
   class Device
   {
   public:
-    /** The backend type. 
+
+    Device () {};
+
+    Device (const std::string & t,
+            const std::string & s,
+            const std::string & n) : type(t), source(s), name(n) {};
+
+    /** The backend type.
      *  The backend type like "PTLIB", "NULL", etc.
      */
     std::string type;
-    
-    /** The device source. 
+
+    /** The device source.
      *  The device source like "V4L", "ALSA", "DC", "OSS", etc.
      */
     std::string source;
 
-    /** The device name. 
+    /** The device name.
      *  The device name like "Logitech Quickcam Zoom"
      */
     std::string name;
-    
+
     /** Set the device identifier from a consendes string.
      * Set the device identifier from a condensed string like "type/source/name"
      * Used for setting devices from the saved gmconf configuration.
@@ -86,18 +93,18 @@ namespace Ekiga
     {
       return ( name + " (" + type + "/" + source + ")");
     }
-    
+
     Device & operator= (const Device & rhs)
     {
       type   = rhs.type;
       source = rhs.source;
       name   = rhs.name;
       return *this;
-    } 
+    }
 
     bool operator==( const Device & rhs ) const
     {
-     if ( (type   == rhs.type)   && 
+     if ( (type   == rhs.type)   &&
           (source == rhs.source) &&
           (name   == rhs.name)   )
        return true;
@@ -119,5 +126,5 @@ namespace Ekiga
    * @}
    */
 
-};  
+};
 #endif


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