2 #ifndef __BSE_CXX_ARG_H__
3 #define __BSE_CXX_ARG_H__
18 T
get (
const Value *v) {
return (T) v->get_base(); }
19 void set (
Value *v, T t) { v->set_base (t); }
20 const String token () { void (*f) (T) = 0;
return tokenize (f); }
22 template<
typename U>
static const String
27 template<
typename U>
static const String
28 ptokenize (
void const *)
31 static_assert (0 ==
sizeof (U*),
"unsupported pointer type");
33 template<
typename U>
const String
34 tokenize (
void (*) (U*))
37 return ptokenize<U> (p);
39 template<
typename U>
const String
40 tokenize (
void (*) (U))
43 static_assert (
sizeof (U) !=
sizeof (U),
"unsupported non-pointer type");
46 const String tokenize_gtype (GType t);
50 #define BSE__SPECIALIZE(TYPE, vtype, tok, GCast, SCast) \
51 template<> struct Arg<TYPE> { \
52 TYPE get (const Value *v) \
53 { return GCast (v->get_##vtype ()); } \
54 void set (Value *v, TYPE t) \
55 { v->set_##vtype (SCast (t)); } \
56 const String token () \
59 template<typename T> static inline T no_cast (T t) \
62 BSE__SPECIALIZE(
bool,
bool,
"b", no_cast, no_cast);
68 BSE__SPECIALIZE(
signed int,
int,
"i", no_cast, no_cast);
69 BSE__SPECIALIZE(uint,
int,
"i", no_cast, no_cast);
70 BSE__SPECIALIZE(
signed long,
int,
"i", no_cast, no_cast);
71 BSE__SPECIALIZE(
unsigned long,
int,
"i", no_cast, no_cast);
72 BSE__SPECIALIZE(
signed long long, num,
"n", no_cast, no_cast);
73 BSE__SPECIALIZE(
unsigned long long, num,
"n", no_cast, no_cast);
74 BSE__SPECIALIZE(
float, real,
"r", no_cast, no_cast);
75 BSE__SPECIALIZE(
double, real,
"r", no_cast, no_cast);
76 BSE__SPECIALIZE(gpointer, pointer,
"*", no_cast, no_cast);
77 BSE__SPECIALIZE(GParamSpec*, pspec,
"P", no_cast, no_cast);
80 BSE__SPECIALIZE(
String,
string,
"s", no_cast, no_cast);
84 BSE__SPECIALIZE(
const String,
string,
"s", no_cast, no_cast);
85 BSE__SPECIALIZE(
char*,
string,
"s", const_cast<char*>, no_cast);
86 BSE__SPECIALIZE(GObject*,
object,
"O", no_cast, no_cast);
87 BSE__SPECIALIZE(
BseObject*,
object,
"O", reinterpret_cast<BseObject*>, reinterpret_cast<GObject*>);
88 BSE__SPECIALIZE(
BseItem*,
object,
"O", reinterpret_cast<BseItem*>, reinterpret_cast<GObject*>);
89 BSE__SPECIALIZE(
BseSource*,
object,
"O", reinterpret_cast<BseSource*>, reinterpret_cast<GObject*>);
90 #undef BSE__SPECIALIZE
The Bse namespace contains all functions of the synthesis engine.
Definition: bstbseutils.cc:67
Definition: bsecxxvalue.hh:13
Definition: bsecxxbase.hh:43
Definition: bseobject.hh:60
Definition: bsesource.hh:84
Definition: bsecxxarg.hh:17
Definition: bseitem.hh:34