2 dnl --------------------------- Accessors ----------------------------
9 dnl Creates accessors for simple types:
10 dnl _MEMBER_GET(cpp_name, c_name, cpp_type, c_type, deprecated (optional))
11 define(`_MEMBER_GET',`dnl
12 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
14 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
16 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
17 $3 __CPPNAME__::get_$1() const
19 return _CONVERT($4,$3,`gobj()->$2');
21 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
25 dnl Creates two accessors for pointer types, one const and one non-const:
26 define(`_MEMBER_GET_PTR',`dnl
27 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
29 const $3 get_$1() const;
30 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
32 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
33 $3 __CPPNAME__::get_$1()
35 return _CONVERT($4,$3,`gobj()->$2');
38 const $3 __CPPNAME__::get_$1() const
40 return _CONVERT($4,const $3,`gobj()->$2');
42 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
46 dnl Creates accessors for GObject-derived types that must be ref()ed.
47 define(`_MEMBER_GET_GOBJECT',`dnl
48 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
49 Glib::RefPtr<$3> get_$1();
50 Glib::RefPtr<const $3> get_$1() const;
51 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
53 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
54 Glib::RefPtr<$3> __CPPNAME__::get_$1()
56 Glib::RefPtr<$3> ref_ptr(_CONVERT($4,Glib::RefPtr<$3>,`gobj()->$2'));
58 dnl We could use the bool with Glib::wrap(), but we want to share the m4 type-conversion map.
65 Glib::RefPtr<const $3> __CPPNAME__::get_$1() const
67 Glib::RefPtr<const $3> ref_ptr(_CONVERT($4,Glib::RefPtr<const $3>,`gobj()->$2'));
69 dnl We could use the bool with Glib::wrap(), but we want to share the m4 type-conversion map.
75 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
82 dnl Creates accessors for simple types:
83 define(`_MEMBER_SET',`dnl
84 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
85 void set_$1(const $3`'& value);
86 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
88 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
89 void __CPPNAME__::set_$1(const $3`'& value)
91 gobj()->$2 = _CONVERT($3,$4,`value');
93 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
97 dnl Creates accessors for pointer types:
98 define(`_MEMBER_SET_PTR',`dnl
99 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
100 void set_$1($3 value);
101 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
103 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
104 void __CPPNAME__::set_$1($3 value)
106 gobj()->$2 = _CONVERT($3,$4,`value');
108 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
112 dnl Creates accessors for GObject-derived types that must be ref()ed.
113 define(`_MEMBER_SET_GOBJECT',`dnl
114 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
115 void set_$1(const Glib::RefPtr<$3>& value);
116 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
118 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
119 void __CPPNAME__::set_$1(const Glib::RefPtr<$3>& value)
121 Glib::RefPtr<$3> valueOld(_CONVERT($4,Glib::RefPtr<$3>,`gobj()->$2')); //Take possession of the old one, unref-ing it in the destructor.
124 value->reference(); //Ref once for the recipient.
126 gobj()->$2 = _CONVERT(const Glib::RefPtr<$3>&,$4,`value');
128 ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl