BEAST/BSE - Better Audio System and Sound Engine  0.8.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
bsecxxvalue.hh
Go to the documentation of this file.
00001  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
00002 #ifndef __BSE_CXX_VALUE_H__
00003 #define __BSE_CXX_VALUE_H__
00004 
00005 #include <bse/bsecxxutils.hh>
00006 
00007 namespace Bse {
00008 
00009 class CxxBase; // prototype CxxBase since we deal with pointers thereof
00010 
00011 /* Generic Value keeping, basically a convenient wrapper around GValue */
00012 
00013 struct Value : GValue {
00014   bool                  get_bool    () const { return get_num(); }
00015   SfiInt                get_int     () const { return get_num(); }
00016   SfiInt                get_enum    () const { return get_num(); }
00017   SfiNum                get_num     () const;
00018   SfiReal               get_real    () const;
00019   const char*           get_string  () const;
00020   const char*           get_choice  () const { return get_string(); }
00021   gpointer              get_pointer () const;
00022   CxxBase*              get_base    () const;
00023   GObject*              get_object  () const;
00024   GParamSpec*           get_pspec   () const;
00025   GValue*               gvalue  () const { return (GValue*) this; }
00026   void set_bool    (bool          b) { set_num (b); }
00027   void set_int     (SfiInt        i) { set_num (i); }
00028   void set_enum    (SfiInt        e) { set_num (e); }
00029   void set_num     (SfiNum        n);
00030   void set_real    (SfiReal       r);
00031   void set_string  (const char   *s);
00032   void set_string  (const String &s) { set_string (s.c_str()); }
00033   void set_choice  (const char   *c) { set_string (c); }
00034   void set_pointer (gpointer      p);
00035   void set_base    (CxxBase      *b);
00036   void set_object  (GObject      *o);
00037   void set_pspec   (GParamSpec   *p);
00038   void operator=   (bool          b) { set_bool (b); }
00039   void operator=   (SfiInt        i) { set_int (i); }
00040   void operator=   (SfiNum        n) { set_num (n); }
00041   void operator=   (SfiReal       r) { set_real (r); }
00042   void operator=   (const String &s) { set_string (s.c_str()); }
00043 };
00044 
00045 } // Bse
00046 
00047 
00048 #endif /* __BSE_CXX_VALUE_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines