[ekiga] Added some properties-api to the Ekiga::Service base class, with reference implementation answering



commit e7de2cc2c22f1056e91d77b57747f93972b97d28
Author: Julien Puydt <jpuydt free fr>
Date:   Mon Nov 12 10:39:22 2012 +0100

    Added some properties-api to the Ekiga::Service base class, with reference implementation answering nothing is available

 lib/engine/framework/services.cpp |   24 ++++++++++++++++++++++++
 lib/engine/framework/services.h   |   17 +++++++++++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/lib/engine/framework/services.cpp b/lib/engine/framework/services.cpp
index 63c6ac9..87af7a7 100644
--- a/lib/engine/framework/services.cpp
+++ b/lib/engine/framework/services.cpp
@@ -45,6 +45,30 @@
 
 #include "services.h"
 
+boost::optional<bool>
+Ekiga::Service::get_bool_property (const std::string /*name*/) const
+{
+  boost::optional<bool> result;
+
+  return result;
+}
+
+boost::optional<int>
+Ekiga::Service::get_int_property (const std::string /*name*/) const
+{
+  boost::optional<int> result;
+
+  return result;
+}
+
+boost::optional<std::string>
+Ekiga::Service::get_string_property (const std::string /*name*/) const
+{
+  boost::optional<std::string> result;
+
+  return result;
+}
+
 Ekiga::ServiceCore::~ServiceCore ()
 {
   /* this frees the memory, if we're the only to hold references,
diff --git a/lib/engine/framework/services.h b/lib/engine/framework/services.h
index e6e89de..1c92d90 100644
--- a/lib/engine/framework/services.h
+++ b/lib/engine/framework/services.h
@@ -41,6 +41,7 @@
  */
 
 #include <boost/smart_ptr.hpp>
+#include <boost/optional.hpp>
 
 #include <list>
 #include <string>
@@ -62,6 +63,22 @@ namespace Ekiga
     virtual const std::string get_name () const = 0;
 
     virtual const std::string get_description () const = 0;
+
+    /* beware that if you check the result directly (in an if, or passing it
+     * through a function, the obtained value will be wether or not the value
+     * is available, and not the value itself!
+     *
+     * To be more specific, you're supposed to:
+     * val = foo.get_bool_property ("bar");
+     * if (val) {
+     *   <do something with *val> (notice *val not val!)
+     * }
+     */
+    virtual boost::optional<bool> get_bool_property (const std::string) const;
+
+    virtual boost::optional<int> get_int_property (const std::string) const;
+
+    virtual boost::optional<std::string> get_string_property (const std::string) const;
   };
   typedef boost::shared_ptr<Service> ServicePtr;
 



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