GnuCash  4.8a-132-gcdaeb421d+
gmock-qofinstance.cpp
1 #include <glib.h>
2 
3 #include <gmock/gmock.h>
4 
5 extern "C"
6 {
7 #include <qofinstance.h>
8 }
9 #include <qofinstance-p.h>
10 
11 
12 G_DEFINE_TYPE(QofInstance, qof_instance, G_TYPE_OBJECT);
13 
14 static void
15 qof_instance_init (QofInstance *inst)
16 {
17  // function is unused, initialization is done in the constructor of the derived mock class
18 }
19 
20 static void
21 qof_instance_class_init(QofInstanceClass *klass)
22 {
23  // function is unused, class functions are defined in C++ code
24 }
25 
26 extern "C"
27 {
28 // This is a reimplementation of the function from qofinstance.cpp
29 void
30 qof_instance_get (const QofInstance *inst, const gchar *first_prop, ...)
31 {
32  va_list ap;
33  ASSERT_TRUE (QOF_IS_INSTANCE (inst));
34 
35  va_start (ap, first_prop);
36  g_object_get_valist (G_OBJECT (inst), first_prop, ap);
37  va_end (ap);
38 }
39 
40 // This is a reimplementation of the function from qofinstance.cpp
41 // without calling qof_instance_set_dirty()
42 void
43 qof_instance_set (QofInstance *inst, const gchar *first_prop, ...)
44 {
45  va_list ap;
46  ASSERT_TRUE (QOF_IS_INSTANCE (inst));
47 
48  va_start (ap, first_prop);
49  g_object_set_valist (G_OBJECT (inst), first_prop, ap);
50  va_end (ap);
51 }
52 
53 } // extern "C"
void qof_instance_get(const QofInstance *inst, const gchar *first_prop,...)
Wrapper for g_object_get.
void qof_instance_set(QofInstance *inst, const gchar *first_prop,...)
Wrapper for g_object_set Group setting multiple parameters in a single begin/commit/rollback.
Object instance holds common fields that most gnucash objects use.