summaryrefslogtreecommitdiff
path: root/tests/glibmm_interface_implementation/main.cc
blob: dfbb71693a85501baf376f3dd1936866110126f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <glibmm.h>
#include <giomm.h> //There are no Interfaces in glibmm, but there are in giomm.
#include <iostream>

//TODO: I also tried Glib::Action, but that needs us to implement interface properties. murrayc
class CustomConverter :
  public Glib::Object,
  public Gio::Converter
{
public:
  CustomConverter();

protected:
  //Implement a vfunc:
  virtual void reset_vfunc();
};

CustomConverter::CustomConverter()
: Glib::ObjectBase( typeid(CustomConverter) ),
  Glib::Object()
{
}

static bool reset_called = false;

void CustomConverter::reset_vfunc()
{
  reset_called = true;
}


int main(int, char**)
{
  Glib::init();

  CustomConverter converter;
  converter.reset();
  g_assert(reset_called);

  return EXIT_SUCCESS;
}