summaryrefslogtreecommitdiff
path: root/src/tests/signal.cpp
blob: 93519faa8d3b26460a1faf85ee1bc124bf3b2d06 (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
42
43
44
45
46
#include <bu/signals.h>
#include <bu/list.h>
#include <bu/string.h>
#include <bu/sio.h>

using namespace Bu;

void PrintPlain( const Bu::String &s )
{
	println(s);
}

void PrintFancy( const Bu::String &s )
{
	println("STRING!!! ->%1<- !!!GNIRTS").arg( s );
}

int Square( int a )
{
    println("Square called");
	return a*a;
}

int Double( int a )
{
    println("Double called");
	return a+a;
}

int main()
{
	SignalList1<void,const Bu::String &> lPrints;

	lPrints += slot(PrintPlain);
	lPrints += slot(PrintFancy);

	lPrints("Hello there");

	SignalList1<int,int> lMaths;
	lMaths += slot(Double);
	lMaths += slot(Square);
	println("Math'd %1 = %2").arg( 5 ).arg( lMaths(5) );

	return 0;
}