Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bsecxxvalue.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __BSE_CXX_VALUE_H__
3 #define __BSE_CXX_VALUE_H__
4 
5 #include <bse/bsecxxutils.hh>
6 
7 namespace Bse {
8 
9 class CxxBase; // prototype CxxBase since we deal with pointers thereof
10 
11 /* Generic Value keeping, basically a convenient wrapper around GValue */
12 
13 struct Value : GValue {
14  bool get_bool () const { return get_num(); }
15  SfiInt get_int () const { return get_num(); }
16  SfiInt get_enum () const { return get_num(); }
17  SfiNum get_num () const;
18  SfiReal get_real () const;
19  const char* get_string () const;
20  const char* get_choice () const { return get_string(); }
21  gpointer get_pointer () const;
22  CxxBase* get_base () const;
23  GObject* get_object () const;
24  GParamSpec* get_pspec () const;
25  GValue* gvalue () const { return (GValue*) this; }
26  void set_bool (bool b) { set_num (b); }
27  void set_int (SfiInt i) { set_num (i); }
28  void set_enum (SfiInt e) { set_num (e); }
29  void set_num (SfiNum n);
30  void set_real (SfiReal r);
31  void set_string (const char *s);
32  void set_string (const String &s) { set_string (s.c_str()); }
33  void set_choice (const char *c) { set_string (c); }
34  void set_pointer (gpointer p);
35  void set_base (CxxBase *b);
36  void set_object (GObject *o);
37  void set_pspec (GParamSpec *p);
38  void operator= (bool b) { set_bool (b); }
39  void operator= (SfiInt i) { set_int (i); }
40  void operator= (SfiNum n) { set_num (n); }
41  void operator= (SfiReal r) { set_real (r); }
42  void operator= (const String &s) { set_string (s.c_str()); }
43 };
44 
45 } // Bse
46 
47 
48 #endif /* __BSE_CXX_VALUE_H__ */
The Bse namespace contains all functions of the synthesis engine.
Definition: bstbseutils.cc:91
Definition: bsecxxvalue.hh:13
STL class.
Definition: bsecxxbase.hh:43
T c_str(T...args)