GnuCash  5.6-150-g038405b370+
gmock-qofinstance.cpp
1 #include <glib.h>
2 
3 #pragma GCC diagnostic push
4 #pragma GCC diagnostic ignored "-Wcpp"
5 #include <gmock/gmock.h>
6 #pragma GCC diagnostic pop
7 
8 
9 #include <qofinstance.h>
10 #include <qofinstance-p.h>
11 
12 
13 G_DEFINE_TYPE(QofInstance, qof_instance, G_TYPE_OBJECT)
14 
15 static void
16 qof_instance_init (QofInstance *inst)
17 {
18  // function is unused, initialization is done in the constructor of the derived mock class
19 }
20 
21 static void
22 qof_instance_class_init(QofInstanceClass *klass)
23 {
24  // function is unused, class functions are defined in C++ code
25 }
26 
27 // This is a reimplementation of the function from qofinstance.cpp
28 void
29 qof_instance_get (const QofInstance *inst, const gchar *first_prop, ...)
30 {
31  va_list ap;
32  ASSERT_TRUE (QOF_IS_INSTANCE (inst));
33 
34  va_start (ap, first_prop);
35  g_object_get_valist (G_OBJECT (inst), first_prop, ap);
36  va_end (ap);
37 }
38 
39 // This is a reimplementation of the function from qofinstance.cpp
40 // without calling qof_instance_set_dirty()
41 void
42 qof_instance_set (QofInstance *inst, const gchar *first_prop, ...)
43 {
44  va_list ap;
45  ASSERT_TRUE (QOF_IS_INSTANCE (inst));
46 
47  va_start (ap, first_prop);
48  g_object_set_valist (G_OBJECT (inst), first_prop, ap);
49  va_end (ap);
50 }
51 
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.