]> code.delx.au - gnu-emacs/blob - test/cedet/tests/testtemplates.cpp
Make tmm-menubar work for the Buffers menu again.
[gnu-emacs] / test / cedet / tests / testtemplates.cpp
1 // Templates Test file:
2 // Written by 'Raf'
3
4 template <class T, int U, class V>
5 class read_ref {
6 public:
7 const T* read_ref_member_one( T);
8 const V* read_ref_member_two();
9 };
10
11 namespace NS {
12 template <class T, int U, class V>
13 class ref {
14 public:
15 read_ref<T,10,V> operator->() {
16 m_// -1-
17 ;
18 // #1# ( "m_datas" )
19 }
20
21 private:
22 T m_datas[U];
23 };
24
25 }
26
27 class FooOne {
28 public:
29 int fooOneMember();
30 };
31
32 class FooTwo {
33 public:
34 int fooTwoMember();
35 };
36
37 class FooThree {
38 public:
39 int fooThreeMember();
40
41 FooOne * operator->();
42 };
43
44 typedef ref<FooOne, 10,FooTwo> Test;
45
46 using NS;
47
48 void
49 main(void) {
50 ref<FooOne, 10, FooTwo> v;
51
52 v->read_ref_member_one()-> // -2-
53 ;
54 // #2# ( "fooOneMember" )
55
56 v->read_ref_member_two()-> // -3-
57 ;
58 // #3# ( "fooTwoMember" )
59
60 v-> // -4-
61 ;
62 // #4# ( "read_ref_member_one" "read_ref_member_two" )
63
64 Test t;
65
66 t->read_ref_member_two()-> // -5-
67 ;
68 // #5# ( "fooTwoMember" )
69
70 ref<FooOne, 10, FooThree> v2;
71
72 v2->read_ref_member_two()-> // -6-
73 ;
74 // #6# ( "fooOneMember" )
75
76 /* Try all these things by also specifying the namespace in the name. */
77 NS::ref<FooOne, 10, FooTwo> v3;
78
79 v3->read_ref_member_one()-> // -7-
80 ;
81 // #7# ( "fooOneMember" )
82
83 v3->read_ref_member_two()-> // -8-
84 ;
85 // #8# ( "fooTwoMember" )
86
87 v3->read_ref_member_two// @1@ 5
88 ;
89
90 }
91
92 // arch-tag: 03cbb8c3-3d01-42ab-b416-42a08ea7b896