summaryrefslogtreecommitdiff
path: root/ThirdParty/toluapp/src/tests/tclass.h
blob: de64ae6b448697fe826139dd87c7faf6efd47f7e (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#ifndef TCLASS_H
#define TCLASS_H

#include <stdio.h>

namespace Test {

class Tst_Dummy
{
};

class Tst_A
{

	int number;
public:
	static Tst_A* last;
	Tst_A () {last = this;}
	virtual char* a () { return "A"; }
	class Tst_AA
	{
 public:
		Tst_AA () {}
		~Tst_AA () { }
		char* aa () { return "AA"; }
	};
	class Tst_BB : public Tst_AA
	{
 public:
		Tst_BB () {}
		~Tst_BB () {}
		Tst_AA* Base () { return this; }
	};

	void set_number(int p_number) { number = p_number;};
	int get_number() {return number*2;};
	
	virtual ~Tst_A() {};
};

class Tst_B : public Tst_A
{
public:
	static Tst_B* last;
	Tst_B () {last = this;}
	virtual char* b () { return "B"; }

	static Tst_A* create() {return new Tst_B;};
	static void* create_void() {return new Tst_B;};
	
	virtual ~Tst_B() {};
};

class Tst_C : public Tst_B
{
	int i;
public:
	static Tst_C* last;
	Tst_C (int n) : i(n) {last = this;}
 virtual ~Tst_C () { printf("deleting C: %d\n",i); }
	virtual char* c () { return "C"; }
};

inline Tst_A::Tst_AA* Tst_create_aa ()
{
	return new Tst_A::Tst_AA();
}

inline bool Tst_is_aa (Tst_A::Tst_AA* obj)
{
	return true;
}

class Tst_E {
	void* ptr;

public:
	enum Pete {
		ONE,
		TWO,
	} pete;

	void get_pete(Pete p) {};

	template <class T>
	T get_t() {T a=0; return a;};

	Tst_E& operator+(const Tst_E& rvalue) {return *this;};

	void pars(int a=0, int b=0) {};
	void get_pointer(void* a) {};

	Tst_A a;

	void set_ptr(void* p_ptr) {
		printf("this is %p, ptr is %p\n", this, p_ptr);
		ptr = p_ptr;
	};
	void* get_ptr() {return ptr;};

	Tst_E(int) {};
};

class Tst_Outside {

public:

	Tst_Outside() {};
};

}; // end of namespace


static void outside_func(Test::Tst_Outside* p_out, lua_State* ls) {

	if (p_out) printf("method!\n");
	else printf("static!\n");
	//printf("luastate: %i\n", ls);
};

#endif